I have a bunch of child <div>variable widths that I want to right-justify inside the parent. I also want the parent <div>not to be wider than it should have children. (I donβt know in advance how wide the children will be - they will contain dynamically created content.)
Here is an example that works correctly in IE 8.0, but not in Firefox 3.5 (child <div>does not align to the right):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#parentDiv{float:left; text-align:right; background-color: gray;}
.childDiv{clear:both; border: 1px solid black; background-color: white;}
</style>
</head>
<body>
<div id="parentDiv">
<div class="childDiv" style="width: 25px"> </div>
<div class="childDiv" style="width: 50px"> </div>
<div class="childDiv" style="width: 100px"> </div>
</div>
</body>
</html>
If I add float:rightCSS to childDiv, it works in Firefox 3.5, but not in IE 8.0 (the width of the parentDiv is no longer determined by the width of its children).
?
UPDATE: , float: divs IE, IIS. ( , .) , IIS? IIS 6.0
# 2: , , IIS 6 IE7. , ( float:right, divs) IE8 Firefox, , , IE7.
, : IE7? ( CSS IE7, .)