3个divs:一个居中,另两个在每一侧 [英] 3 divs: one centered and the two others one in each side
本文介绍了3个divs:一个居中,另两个在每一侧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个标记:
<body>
<div class="prevBtn"> <a> < </a> </div>
<div id="player"> some code </div>
<div class="nextBtn"> <a> > </a> </div>
</body>
我想要得到这个布局:
注意:上一页和下一页按钮关闭到#player
Note: The previos and the next button are close to the #player
我试着这样:
.nextBtn{
float:left;
width:15%;
margin-top:180px;
}
.nextBtn a{
float:right;
}
.player{
float:left;
width:70%;
margin-top:100px;
}
.prevBtn{
float:right;
width:15%;
margin-top:180px;
}
.rightBtn a{
float:left;
}
问题是它不会像布局如果分辨率太大或太小,
the problem is that it doesn't stay like the layout if the resolution is too big or too small,
如何解决这个问题?
推荐答案
用一个带有770px +左右按钮宽度的div(将宽度从百分比改为固定宽度)将其环绕。
surround it with a div with 770px + the left and right buttons width (change their widths from percent to a fixed width).
也可以使用 overflow:hidden
或者div clear:both
到底,这将确保一切都到位。
Also use a overflow: hidden
or a div with clear:both
at the end, this will make sure everything is in place.
这篇关于3个divs:一个居中,另两个在每一侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文