Forum Moderators: not2easy

Message Too Old, No Replies

Add padding-left and div extends to right

         

John_Caius

8:40 pm on Jan 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've got a div in IE6 where, if I add padding-left: 5px to the content, the right-hand edge div extends 5px to the right (though the content padding itself works fine). I'm sure this must be either a display: block/inline thing or a position: absolute/relative thing, but I'm not enough of an expert to spot what's causing this. The code for the div itself is simple so it's inheriting something from somewhere.

Anybody recognise this behaviour and know of the quick solution? Otherwise I'll deconstruct the page layout, but it's complex so I want to avoid having to do that if possible.

:)

John_Caius

11:55 pm on Jan 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Solved the problem - wasn't anything to do with padding at all. If you set position: absolute, left: 50px and width: 100% then the div overruns the right edge of the screen by 50px. In this instance I've been able to set a fixed width that is narrower than the screen.

Is it possible to set an absolutely positioned div like this that will take up the rest of the width of the screen but no more?

SuzyUK

12:04 am on Jan 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think right: 0; should do it but doesn't in IE

so try margin-right: 50px; instead
not sure if you still actually need width: 100%; then so either specify width: auto; or let it default (leave out)

Suzy

John_Caius

11:18 pm on Jan 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



right: 0 is a good idea - hadn't thought of that. I've got some right: 0 positioned stuff in IE and it works fine.