View Full Version : Another problem with my website!


Silverphang17
07-28-2006, 01:48 AM
Well, lets get to the point; I have a problem with <div> tags. The problem is that I wanted to center the div in the middle of the page by using the <center> tags without the fustration of dealing with pixels. But when I centered the div box I also center the content that is within the box. Can this problem be solved or do I have to center it with pixels? Do anyone know the center point, if thats what I have to do? The width of the box is 500 pixels wide.

thezeppzone
07-28-2006, 02:03 AM
Just align the text in the div by doing this, so your code could look like this:


<center>
<div width="500" style="text-align: left;">Text</div>
</center>



If you do want to go pixel-wise, just do the math; Well, I'll do it for you:

1024x768 resolution has a 1003 pixel-wide viewable explorer screen

1003-500=503 empty pixels around the div
503/2=~502

So it would be:


<div width="500" style="position: absolute; margin-left: 502px;">Text</div



Hope that helps :)

..::Kira::..
07-28-2006, 03:33 AM
You could also do this. how ever I am not sure if it will work.
<center>
<div width="500"></center>Your text here</div>

thezeppzone
07-28-2006, 03:47 AM
Nope, the center is around nothing but the opening div tag which wouldn't have any effect.

pb&j
07-28-2006, 04:21 PM
You could also do this. how ever I am not sure if it will work.
<center>
<div width="500"></center>Your text here</div>
it would also be bad coding as your are not nesting the tags correctly.

..::Kira::..
07-28-2006, 08:35 PM
well. Like I said " I am not sure if it will work."
Im not perfect with coding. sorry.