Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    NEED HELP, divs, text-align, shyt

    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:
    Code:
    <!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:




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

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    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?
    Teed

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by teedoff View Post
    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.

  • #4
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    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.
    Teed


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •