Set width to 12em in HTML and CSS

Description

The following code shows how to set width to 12em.

Example


<!-- w  w  w.jav  a  2 s . c o  m-->






<html>
<head>
<title>Em Measurement Comparison to Pixels</title>
<style type='text/css'>
body {
font: 1em sans-serif;
}
p {
background: rgb(234, 234, 234);
border: 1px solid rgb(200, 200, 200);
}
p#em-measurement {
width: 12em;
padding: 1em;
}
p#px-measurement {
width: 192px;
padding: 16px;
}
</style>
</head>
<body>
<p id='em-measurement'>
This paragraph is 12 em wide, with a 1em padding.
</p>
<p id='px-measurement'>
This paragraph is 192 pixels wide, with 16 pixels of
padding.
</p>
</body>
</html>

Click to view the demo

The code above generates the following result.

Set width to 12em in HTML and CSS