div float

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sassy2009
    New Member
    • Oct 2009
    • 15

    div float

    Hello,

    iam new to website building and i was planning to learn from scratch.
    So i downloaded a free web template to work with and started cropping the .psd file and saved the images for the navigation menu. This is my actual website where i have hosted my practise files. www.datadynamix .com.au
    as you can see the nav menu doesnt go to the left or top. it looks as if its got some padding or margins but i checked my css file and i dont have any paddings.

    Please have a look at my source code and css from your browser and give me any suggestions.
    Please help
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Couple things to change. First, no one should ever use, or learn with, the transitional doctype. That's for older pages using deprecated elements. Always use strict:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">

    From that you'll notice I gave you the HTML doctype rather than XHTML. Almost everyone who tries to use the XHTML doctype does so because they think it's better in some way yet almost no one serves their web pages as XHTML. Inept browsers, specifically IE, can't even handle XHTML served that way so why bother?

    Along that point, closing tags, />, are xhtml only and I recommend removing the slashes since they'll be treated as html.

    In your CSS file, remove the <style type="text/css"> and </style>. Those are only for the HTML file should you be including style properties in your HTML file.

    All elements have margin and padding by default. Some people use a "reset" to set all elements to zero margin and padding and then set everything to what they want but this is controversial.

    The reason the nav doesn't stay on one line is because the enclosing div is set to 775px which isn't wide enough to contain the nav so it wraps and drops down.

    Comment

    Working...