How can I force overflow: hidden to not use up my padding-right space
Posted
by AlfaTeK
on Stack Overflow
See other posts from Stack Overflow
or by AlfaTeK
Published on 2009-07-02T00:09:51Z
Indexed on
2010/04/21
14:03 UTC
Read the original article
Hit count: 420
I have the following code:
<div style="width: 100px;
overflow: hidden;
border: 1px solid red;
background-color: #c0c0c0;
padding-right: 20px;
">
2222222222222222222222111111111111111111111111113333333333333333333</div>
(XHTML 1.0 transitional)
What happens is that the padding-right doesn't appear, it's occupied by the content, which means the overflow uses up the padding right space and only "cuts off" after the padding.
Is there any way to force the browser to overflow before the padding-right, which means my div will show with the padding right?
What I get is the first div in the following image, what i want is something like the 2nd div:
© Stack Overflow or respective owner