Firefox ignoring padding-left

This is a discussion on "Firefox ignoring padding-left" within the Web Page Design section. This forum, and the thread "Firefox ignoring padding-left are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jul 11th, 2007, 16:43
Junior Member
Join Date: Jul 2007
Location: UK
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Firefox ignoring padding-left

OK, this is really annoying me.
I've been duplicating a tables-layout using CSS, working in IE, and have just started viewing it in FF (probably the wrong way 'round, but anyway).

Many of the pages have an image or two in a column down the left side of the page, always the same width, and then the text on the rest of the page - so there is always a gap between the text and the left hand side of the page, width enough to accomodate the images, whether or not there are any there.

I implemented this by having the images floated to the left at the appropriate point, and text in a div with padding-left: 160px. In IE this works fine.

Firefox ignores the padding completely.

Quirks or Standards mode.

No margin set, no width set, on the padded div. It has padding, and it ignores it. Just wraps around the floated images as if no padding was set.

Am I missing something about the box model here? I really can't see what's going wrong.

Code: Select all
    <img class=leftmargin src="ims/image.jpg">
    <div class=leftmarginimages>
      <p>
        Lots of text goes here
      </p>
    </div>
Code: Select all
img.leftmargin
  { margin-top: 2px;
    margin-bottom: 13px;
    margin-left: 5 px;
    clear: left;
    float: left;
    width: 140px}
  }
div.leftmarginimages
  { padding-left: 160px;
  }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jul 11th, 2007, 16:48
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox ignoring padding-left

You've got an extra }

See below in red.
Code: Select all
img.leftmargin
  { margin-top: 2px;
    margin-bottom: 13px;
    margin-left: 5 px;
    clear: left;
    float: left;
    width: 140px}
  }
div.leftmarginimages
  { padding-left: 160px;
  }
See if that does it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jul 11th, 2007, 16:51
Junior Member
Join Date: Jul 2007
Location: UK
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox ignoring padding-left

Wow, sharp eyes. And that made all the difference? I would've expected that to be handled a little more gracefully...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jul 11th, 2007, 16:53
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox ignoring padding-left

GREAT!!
And as you have figured out, designing for FF first is easier .. then fix things for IE.

I also think it might be better instead of using padding-left to use margin-left.

But maybe that doesn't matter???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jul 11th, 2007, 16:54
Junior Member
Join Date: Jul 2007
Location: UK
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox ignoring padding-left

I'm thinking my whole overhaul needs an overhaul
But if that div had a border... I guess I'd want the image on the inside.
Or would I?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Jul 11th, 2007, 17:04
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox ignoring padding-left

Yes in that case you'd do this:
HTML
Code: Select all
<div class=leftmarginimages>
     
        <img class=leftmargin src="ims/image.jpg" /> <p>Lots of text goes here      </p>
</div>
css
Code: Select all
img.leftmargin
  {
    margin-top: 2px;
    margin-bottom: 13px;
    margin-left: 5 px;
    float: left;
    width: 140px;
    margin-right: 13px;
}

div.leftmarginimages
  {
    width: 500px;
    border: 1px solid #999999;
    padding: 5px;
}
SWEET!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Jul 11th, 2007, 17:17
Reputable Member
Join Date: Apr 2007
Location: Ireland
Age: 15
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox ignoring padding-left

Leaving an unclosed { } in your CSS can have a huge effect on your website! I did it once and my whole site disappeared!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Jul 11th, 2007, 17:43
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox ignoring padding-left

Its so stupid. I remember one time when I forgot to close a html tag and nothing would show up. It was very strange. That said I could have made other mistakes too (make that 'probably' rather than 'could have').

Glad you got it sorted now
.
Pete.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Jul 11th, 2007, 22:44
Most Reputable Member
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox ignoring padding-left

I recommend validating your CSS/HTML as the first step in debugging code. Even small code mistakes often cause unpredictable errors.

This applies even when you think your code is valid. I've often failed to notice that changes made my (formerly valid) code invalid.

Last edited by MikeHopley; Jul 11th, 2007 at 22:46.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Jul 11th, 2007, 23:03
Up'n'Coming Member
Join Date: Jul 2007
Location: France
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox ignoring padding-left

Two lessons here:

always design in standards-compliant browsers, THEN afterwards for the likes of IE;
validate your code. The error may be staring you in the face.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
ff ie padding

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem setting the left/right/top/bottom padding of a table to different values tonyb Web Page Design 2 May 2nd, 2008 21:30
Have Microsoft left it too late? IE7 is out and firefox still gaining big ground Rob Webforumz Cafe 25 Oct 28th, 2007 16:29
CSS padding Firefox vs IE WL1207 Web Page Design 5 Oct 18th, 2007 14:56
Float: Left with firefox magnetica Web Page Design 2 Aug 24th, 2007 17:55
Padding on #header background image.. IE6/Firefox. rooraaahcrumbs Web Page Design 1 Apr 26th, 2006 21:49


All times are GMT. The time now is 01:42.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved