Reputation: 3128
Here is a code:
<!DOCTYPE html>
<html>
<head>
<style>
li div {
border: 1px solid #FF0000;
width: 100px;
position:relative;
white-space: nowrap;
overflow: hidden;
}
</style>
</head>
<body>
<ol>
<li>
<div>111111111111111111111</div>
</li>
<li>
<div>222222222222222222222</div>
</li>
</ol>
</body>
</html>
The page is displayed not as expected in IE8.
Firefox: (OK)
IE8: (wrong)
Could somebody explain why?
If remove <!DOCTYPE html>
everything will be ok, but I want to find the reason and fix it via CSS.
Upvotes: 4
Views: 2397
Reputation: 8030
You could also style the div to display as an inline element:
li div {
display:inline;
}
Upvotes: 2
Reputation: 397
You can add position relative to 'li' tag and change position relative to absolute for 'div' tag and add 'top: 0; left: 0;' to div tag.this will work fine.
Try this css:
li {
position:relative;
}
li div {
border: 1px solid #FF0000;
width: 100px;
white-space: nowrap;
overflow:hidden;
position:absolute;
top:0;
left:0
}
Upvotes: 0