Tuesday, August 20, 2013

CSS text box doctype

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
div.ex
{
width:220px;
padding:10px;
border:5px solid gray;
margin:0px;
}
</style>
</head>

<body>
<img src="250px.gif" width="250" height="1" /><br /><br />

<div class="ex">The line above is 250px wide.<br />
Now the total width of this element is also 250px.</div>

<p><b>Note:</b> In this example we have added a DOCTYPE declaration (above the html element), so it displays correctly in all browsers.</p>

</body>
</html>

Result


No comments: