Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1796 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

Firefox padding + width problems

Thread title: Firefox padding + width problems
Closed Thread    
    Thread tools Search this thread Display Modes  
09-14-2005, 05:43 PM
#1
Xaxen is offline Xaxen
Status: I'm new around here
Join date: Sep 2005
Location: Calgary, AB
Expertise:
Software:
 
Posts: 24
iTrader: 0 / 0%
 

Xaxen is on a distinguished road

Send a message via MSN to Xaxen

  Old  Firefox padding + width problems

Hopefully someone knows what I'm talking about here.

Lets say I have a div...pretty background color and some text inside. I'd like the box 20px away from the left side of the window, 500px wide, and all text inside to be 20px away from the edge of the div. This isn't complex...however, when I put padding on the inside of a div in Firefox it adds that padding amount to the width of the box. So in essence the div gets sized to 520px because of the padding. This seems to happen only in Firefox as IE just stresses the width of the box, and the padding is secondary.

Thoughts?

09-14-2005, 11:40 PM
#2
Jonny is offline Jonny
Status: Member
Join date: Feb 2005
Location: UK
Expertise:
Software:
 
Posts: 335
iTrader: 0 / 0%
 

Jonny is on a distinguished road

  Old

This is because of IE's incorrect rendering of the "Box Model".

There are plenty of Box Model Hacks which you can use to bypass this, however, the best way to do it to give the padding to a div that is inside the one with a width.

So like:

Code:
<div style="width:500px;">
  <div style="padding: 20px;">

	   Hello World :)

  </div>
</div>

09-15-2005, 08:43 AM
#3
Xaxen is offline Xaxen
Status: I'm new around here
Join date: Sep 2005
Location: Calgary, AB
Expertise:
Software:
 
Posts: 24
iTrader: 0 / 0%
 

Xaxen is on a distinguished road

Send a message via MSN to Xaxen

  Old

I had heard of the box model hack before, but never really knew what it pertained to. Thank you for clearing this up for me.

Stupid browsers...

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed