开发者

setting minimum width of div

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. I开发者_如何转开发s it possible to do this?


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


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;
}


Checkout some real documentation regarding this, Mozilla Developer Network.


this is achievable via css;

element
{
    min-width:100px;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜