Set min-width in HTML and CSS

Description

The following code shows how to set min-width.

Example


<html>
<head>
<style type="text/css">
div#body {<!--  w  w w  . j av a  2 s  . co  m-->
margin: auto;
max-width: 50em;
min-width: 30em;
max-height: 30em;
overflow: auto;
background: #ccc;
}
</style>
</head>
<body>
<div id='body'>
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.            <BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.            <BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.
<BR/>This is a test.

</div>
</body>
</html>

Click to view the demo

The code above generates the following result.

Set min-width in HTML and CSS