www.webdeveloper.com
Results 1 to 6 of 6

Thread: Messed up Div tag?

  1. #1
    Join Date
    Jun 2011
    Posts
    64

    Unhappy Messed up Div tag?

    Hi,

    I have this code on my page

    <div id="titlediv">
    <div id="title">
    <h1> Welcome...</h1>
    </div>
    </div>

    and this CSS to go with it


    #titlediv { background-color:#000;
    width:800px;
    margin-left:auto;
    margin-right:auto;
    margin-bottom:0px;
    margin-top:0px;
    padding:0px;

    }

    #title { background-color:#000;
    width:760px;
    margin-left:auto;
    margin-right:auto;
    color:#FFF;
    font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;


    but when I preview in a browser there is a white space between #titlediv and the div above it. Is there any way to remove this or fix it?

    Using Adobe Dreamweaver CS5


    Thanks
    Thomas

  2. #2
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,458
    Hi there TomTom100,

    and a warm welcome to these forums.

    Your code appears to be an excellent example of 'Divitis'
    Check out the symptoms here...


    This will suffice...
    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    
    <title>keep it simple</title>
    
    <style type="text/css">
    h1 {
        width:760px;
        padding:0 20px;
        margin:0 auto;
        font-family:'trebuchet ms',arial,helvetica,sans-serif;
        color:#fff;
        background-color:#000;
     }
    </style>
    
    </head>
    <body>
    
    <h1>Welcome...</h1>
    
    </body>
    </html>
    
    coothead

  3. #3
    Join Date
    Jun 2011
    Posts
    64

    Smile Thanks

    So just take out the #titlediv then

    Thanks for your help!

  4. #4
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,458
    No, take out both the divs, they serve no purpose.

    coothead

  5. #5
    Join Date
    Jun 2011
    Posts
    64

    Thumbs up Thanks

    Ok, everything is sorted now

    Thanks for your help!

    Regards
    Thomas

  6. #6
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,458
    No problem, you're very welcome.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles