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
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Div padding issue

    I'm having a little problem with my new site.

    I have a Div element, which is explicitly set to 226px wide (inside the div is a load of text). To that i've applied a 10px padding all the way round, so the css is currently:

    .layout_style_left_panel { width: 226px; float: left; padding: 10px; }

    Now that looks just fine in IE, but firefox appears to add the 10px padding to each side of the div, making it in effect 246px wide, not 226!

    Could one of you good people please tell me why and how to fix it please?

  • #2
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My mistake chaps. I realise that FF is infact doing things correctly. I've specified a strict Doctype now and restyled accordingly.

    Thank you.

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello fm010994,
    Yes, padding counts. So does margin and border.
    Have a look at the box model.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

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