Adam Strudwick
Adam Strudwick

Reputation: 13129

CSS min-width property issue with percentage

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

I'm trying to set a min-width on a child with 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?

Upvotes: 4

Views: 14359

Answers (2)

taz
taz

Reputation: 1526

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.

Upvotes: 1

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114367

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

Upvotes: 0

Related Questions