Set width to auto in HTML and CSS

Description

The following code shows how to set width to auto.

Example


<html>
<head>
<style type='text/css'>
p {<!--from   w  w  w .  j a  v  a  2 s  .co m-->
padding: 10px;
margin: 10px;
border: thin solid black;
width: auto;
min-width: 200px;
}
</style>
</head>
<body>
<p>
This is a test. This is a test.
</p>
</body>
</html>

Click to view the demo

The code above generates the following result.

Set width to auto in HTML and CSS