Reputation: 13773
I have a page with many different objects of different widths. I am not setting the width of the div that the objects are within as I want it to be able to expand to include whatever items are within it. But I do want the div to have a minimum width. Is it possible to do this?
Upvotes: 18
Views: 51462
Reputation: 29413
It is very possible. Just use CSS min-width
. The MDN page has details.
Upvotes: 17
Reputation: 42562
Checkout some real documentation regarding this, Mozilla Developer Network.
Upvotes: 1
Reputation: 10722
Use CSS:
min-width
Definition and Usage
The min-width property sets the minimum width of an element. Note: The min-width property does not include padding, borders, or margins!
like
#example {
width: 150px;
min-width: 100px;
max-width: 200px;
}
Upvotes: 11