...

View Full Version : NEED HELP, divs, text-align, shyt



Rasly
01-30-2012, 04:47 PM
I am out of freaking ideas, im trying to do something VERY SIMPLE, but looks like i am a freaking idiot after all, so i ask you for help!!!!Q!!!!!


i have html code like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<body>

<div style="text-align:center;">
<div style="border:solid 1px #333; width:100px;">dsfgd</div>
</div>

</body>
</html>

BUT WHAT I GET IS THIS:

http://img213.imageshack.us/img213/2491/sfgsgsdgsd.jpg


SOMEONE please tell me why it dosnt work!!!!! ????? thanks is advance

teedoff
01-30-2012, 05:16 PM
umm What are you TRYING to achieve? What isn't working about it?

You have a solid 1px border around your text which is aligned center and 100px wide.

That longer dotted border is what you see in dreamweaver yes?

Rasly
01-30-2012, 06:42 PM
umm What are you TRYING to achieve? What isn't working about it?

You have a solid 1px border around your text which is aligned center and 100px wide.

That longer dotted border is what you see in dreamweaver yes?
It should have been in the middle, not on left, well i got it fixed now, by writing "margin: 0 auto;" in second div, now im tryng to understand how margin effects text align.

teedoff
01-30-2012, 07:20 PM
The margin you used didn't affect the text-align. You used the text-align: center; on the containng div, therefore the second div inherited that style. To see that, remove the first div completely, and the text will then by default be aligned left.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum