如何让我得到一段文字在两个左右浮动的div之间居中?
我的代码在
下面<style type="text/css">
.left {
float:left;
padding-left:10px;
}
.right {
float: right;
padding-right:10px;
}
</style>
<div id="header">
<div class="left">
<p>Stuff on the left</p>
</div>
<span>Center Text or Image/Logo</span>
<div class="right">
<p>Stuff on the right</p>
</div>
</div>
答案 0 :(得分:1)
HTML
<div id="header">
<div class="left">
<p>Stuff on the left</p>
</div>
<div class="center">
<p>Stuff in the center</p>
</div>
<div class="right">
<p>Stuff on the right</p>
</div>
</div>
CSS:
.left {
float:left;
width:25%;
}
.right {
float:left;
width:25%;
}
.center {
float:left;
width:49%;
}