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 3 of 3
  1. #1
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    626
    Thanks
    51
    Thanked 67 Times in 67 Posts

    A Few CSS Questions

    I have a header div (160px tall, 1024px wide), a header background image (same dimensions with 7px border on all sides and a 4px border going through the center at 114px to separate the top from navigation), and three internal divs (logo, ads, navigation). Logo and ads are on top, floating left and right against each other, with navigation below them. I need to position navigation so that it is perfectly aligned with the background image.
    1. Are margins counted in width? I have 7px top margins on logo and ads to account for the 7px background border, so when I define their height, should it be 114px or 107px?

    2. Does padding affect the width? I have logo and ad width in percentage, but to get them both on the same row I can only use 96%.

    3. Why isn't clear working? I have clear: both on the navigation but it seems like it's trying to clear header (the div that it is contained in).

    URL is http://stupidgamestuff.com/index2.php.
    Last edited by djh101; 08-30-2010 at 02:44 AM.
    "Yeah science!"
    Online Science Tools

  • #2
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    The CSS box model is rather counterintuitive and padding isn't included in width, e.g. an element with 200 pixels width and 50 pixels padding will be 300 pixels wide (200 + 50 + 50). Margins aren't counted either. Doing some experiments yourself would have made this clear, though.
    I can't access your site: I just get MySQL errors.

  • Users who have thanked Apostropartheid for this post:

    djh101 (08-30-2010)

  • #3
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    626
    Thanks
    51
    Thanked 67 Times in 67 Posts
    I'm setting up the database, sorry about that, it should be fixed in 5-10 minutes. But yeah, I got it to work, anyway, thanks for the clarification.
    "Yeah science!"
    Online Science Tools


  •  

    Posting Permissions

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