开发者

CSS min-width property issue with percentage

开发者 https://www.devze.com 2023-03-27 23:16 出处:网络
I\'ve put it up in a fiddle: http://jsfiddle.net/6kq2r/ I\'m trying to set a min-width on a child wi开发者_如何学Goth a percentage value (and I\'ve tried to set the parent\'s width with a % or a px a

I've put it up in a fiddle: http://jsfiddle.net/6kq2r/

I'm trying to set a min-width on a child wi开发者_如何学Goth a percentage value (and I've tried to set the parent's width with a % or a px and it doesn't make a difference).

<div style="width:60%;border:1px solid red;">
    <div style="border-bottom:1px solid blue;min-width:60%;">
        TEXT GOES HERE
    </div>
</div>

Is it possible to do what I intend?


It is possible to achieve that with a DIV if you set the display to inline (or inline-block perhaps). The difference is that SPANs have inline display by default and DIVs have block display by default.


Use width on the inner DIV, not min-width.

0

精彩评论

暂无评论...
验证码 换一张
取 消