Как я могу получить правильные плавающие DIV, чтобы заполнить их доступное пространство?
альтернативный текст http://tanguay.info/web/external/cssRightSide.png
<html>
<head>
<style type="text/css">
.content{
background-color: #fff;
margin: 0px auto;
width: 760px;
border: 1px solid blue;
font-size: 10pt;
}
.content .leftSide {
background-color: yellow;
float: left;
padding: 5px;
}
.content .rightSide {
background-color: orange;
float: left;
width: *;
padding: 5px;
text-align: center;
}
</style>
</head>
<body>
<div class="content">
<div class="leftSide"><img src="test.jpg"/></div>
<div class="rightSide">Right side text should be centered.</div>
<div style="clear:both"></div>
</div>
<div class="content">
<div class="leftSide"><img src="test2.jpg"/></div>
<div class="rightSide">And the background should fill the DIV of course.</div>
<div style="clear:both"></div>
</div>
</body>
</html>
ПРОМЕЖУТОЧНЫЙ ОТВЕТ:
Спасибо, Гаффа и Рич, взяв поплавок: слева от правой стороны была возможность центрировать текст, но чтобы цвет фона расширялся, мне также пришлось сделать цвет фона родительского DIV.
Однако, Я все еще не могу заставить текст выравниваться по центру по вертикали, так как DIV на самом деле не проходит весь путь вниз , есть ли "авто" для этого тоже? например высота: * или плавание вниз: авто? Как упомянул Cletus ниже, все это будет тривиально в таблицах HTML, CSS-дизайнеры наверняка включили некоторое свойство, чтобы «сделать вертикальное пространство заполненным вниз».
альтернативный текст http://tanguay.info/web/external/cssRightFixed.png
<html>
<head>
<style type="text/css">
.content{
background-color: orange;
margin: 0px auto;
width: 760px;
border: 1px solid blue;
font-size: 10pt;
}
.content .leftSide {
background-color: yellow;
float: left;
padding: 5px;
}
.content .rightSide {
background-color: orange;
padding: 5px;
text-align: center;
vertical-align: middle; /* DOESN'T WORK SINCE THE DIV DOES NOT ACTUALLY GO ALL THE WAY DOWN */
}
</style>
</head>
<body>
<div class="content">
<div class="leftSide"><img src="test.jpg"/></div>
<div class="rightSide">Right side text should be centered.</div>
<div style="clear:both"></div>
</div>
<div class="content">
<div class="leftSide"><img src="test2.jpg"/></div>
<div class="rightSide">And the background should fill the DIV of course.</div>
<div style="clear:both"></div>
</div>
<div class="content">
<div class="leftSide"><img src="test3.jpg"/></div>
<div class="rightSide">And the background should fill the DIV of course.</div>
<div style="clear:both"></div>
</div>
<div class="content">
<div class="leftSide">this is a text on the left with no image</div>
<div class="rightSide">And the background should fill the DIV of course.</div>
<div style="clear:both"></div>
</div>
</body>
</html>