到目前为止,我已经试过了,如何让div浮动在另一个div的两端?
我试图把2周的div在另一个div的左右两端,我尝试使用浮动:左和float:正确的,但他们表现出了在新的生产线
我想是这样的,
[leftcap] ................. TITLE ......... ...... [右盖]]
我真的很抱歉,我不能代表比这更好。
HTML
<div id="shell">
<div id="title">
<div id='leftcap'>o</div>
TITLE HERE
<div id='rightcap'>x</div>
</div>
<div id="content">Content</div>
</div>
CSS
#shell {
width:500px;
height:300px;
background:lightGrey;
}
#title {
background:green;
padding:5px;
border-radius:25%;
text-align:center;
}
#content
{
text-align:center;
vertical-align:center;
}
#leftcap
{
width:10%;
}
#rightcap
{
width:10%;
}
#leftcap,#rightcap
{
height:100%;
width:10%;
background:red;
}
UPDATE:使用float属性的问题解决了,我还有一个问题,如何垂直居中对齐文本在一个容器div?
谢谢,这解决了这个问题。 – cyberpirate92
@cyberPheonix没问题,所有与你的'div's! :) –