Page 1 of 1

Centering

Posted: Sat Nov 08, 2003 6:39 pm
by duranike
how do i center this in a php file when called in a browser?

Code: Select all

print"<img src="error_fill_user_serial.gif">";

Posted: Sat Nov 08, 2003 7:14 pm
by duranike
anyhelp? i have some html tables too that are going to the right

Posted: Sat Nov 08, 2003 7:24 pm
by SBukoski
I recommend buying a good HTML book. There are plenty of ways to center an image.

You coulde use the <p> or <div> tags, for starters.

Code: Select all

<p align="center"><img src="my_image.gif"></p>
<div align="center"><img src="my_image.gif"></div>
If it's in a table, set the table cell to centered.

Code: Select all

<table>
  <tr>
    <td align="center"><img src="my_image.gif"></td>
  </tr>
</table>
And then there is always style sheets and other methods left that I didn't mention.

Posted: Sat Nov 08, 2003 7:25 pm
by d3ad1ysp0rk

Code: Select all

print "<center><img src="error_fill_user_serial.gif"></center>";
im not really sure what you meant.. but is that what you wanted?

Posted: Sat Nov 08, 2003 7:35 pm
by SBukoski
I recommend against using the <center> tag as it is deprecated as of HTML 4.0. Some of the examples I gave might even be deprecated. The recommend using style sheets now-a-days. But browsers still recgonize all the deprecated alignment tags, and they are still widely used, so it doesn't hurt.

Posted: Sat Nov 08, 2003 7:49 pm
by d3ad1ysp0rk
i use td align="center" when im aligning a list of things or just a whole cell, but most the time it's just one line of text, and <p align="center"> adds too much spacing..

oh, and ive never tried css for alignment :P

Posted: Sat Nov 08, 2003 8:11 pm
by Cruzado_Mainfrm
use sumthing like this: <span style="color:blue;font-weight:bold;"></span>

Posted: Sat Nov 08, 2003 8:20 pm
by d3ad1ysp0rk
i know how to use css, i just never used it for ALIGNMENT :D

Posted: Mon Nov 10, 2003 5:31 am
by JAM
Wouldn't that be

Code: Select all

print '<img style="text-align:center;" src="error_fill_user_serial.gif">';

Posted: Mon Nov 10, 2003 3:25 pm
by m3rajk
ok. as i read this i was thinking "why are they saying to use the deprecated align tag?" then "why the dprecated in html 4.01 and unsuported in xhtml center tag?"

use what jam said. in a year or so it'll be the only one that works...

Posted: Mon Nov 10, 2003 3:41 pm
by SBukoski
I doubt that'll it'll be the only one that works in a year. They are in such wide use that I think it'll be several years before we even start to see them go away and become unsupported. However, you are correct in that it should be done using the STYLE tags; just to be on the safe side.

Up until a few months ago I never used style tags. Now my entire site (or most of it) is all style tags. Makes it easier to read anyways.

Posted: Mon Nov 10, 2003 5:32 pm
by m3rajk
classes and a stylesheet that you import is easier to maintain when you have a bunch of things cross pages that are the same.

also allows one to use style as needed to tweak.


fyi on centering:

text-align:center
works for tables in M$IE because it's buggy. to center everything in a body,

Code: Select all

body &#123;
  text-align:center;
  margin:auto; /* this can be broken into right and left */
&#125;