Whew! This was a trick!
This works in IE6. I didnt test in other browsers.
Your div is now centered on the page and the black box now expands and contracts with the size of the line/text.
You cant test by putting various lines of text in.
EDIT:
You can test
Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title>Untitled</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
border: 0;
max-width: 100%;
width: 100%;
}
#container {
margin: 0 auto;
width: 5em;
max-width: 100%; /* for compliant browsers to apply */
white-space: nowrap;
}
#content {
border: 1px solid black;
padding: 10px;
left-margin:10px;
float: left;
display: inline; /* to combat IE's double margin bug */
}
</style>
</head>
<body>
<div id="container">
<div id="content">
This is you test asdasd test a;skdjf;laskdjfa;s ldkfja;sdlkfjas;dkflsjadfk asdfsdfsdfsdf<br>
This is my test for lines
</div>
</div>
<!-- need this --><br style="clear: both;">
</body>
</html>
|