Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting minimum width of div

Tags:

html

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?

like image 531
user517406 Avatar asked May 18 '11 09:05

user517406


People also ask

How do I make a div less wide?

You can simply use the CSS display property with the value inline-block to make a <div> not larger than its contents (i.e. only expand to as wide as its contents).

Can you set a minimum width CSS?

The min-width CSS property sets the minimum width of an element. It prevents the used value of the width property from becoming smaller than the value specified for min-width .

How do you set maximum width and minimum width?

Using Min Width and Max WidthIf min-width value is larger than max-width , then the min-width value will be taken as the width for the element. Consider the following example. The initial width value is 100px , and adding on that, there is min-width and max-width values.


1 Answers

It is very possible. Just use CSS min-width. The MDN page has details.

like image 106
Marwelln Avatar answered Oct 20 '22 00:10

Marwelln