[英]Why is this not centering? it gets pushed down
It would center properly without "designbox" but it WOULD BE PUSHED DOWN if I added "designbox". 如果没有“ designbox”,它将正确居中,但是如果添加“ designbox”,它将被按下。 My goal is to center title beside designbox, but so far I got no luck.
我的目标是使标题在designbox旁边居中,但到目前为止我还没有运气。 I tried every single centering method and nothing works!
我尝试了每种居中方法,但没有任何效果!
Any ideas why is this happening and how should I fix this? 任何想法为什么会发生这种情况,我应该如何解决?
code: https://jsfiddle.net/bjsowaxj/8/ 代码: https : //jsfiddle.net/bjsowaxj/8/
html: 的HTML:
<div class = "content-headercontainer">
<div class = "designbox">
</div>
<div class = "title">
Hi
</div>
</div>
css: CSS:
.content-headercontainer{
position: relative;
font-weight: 700;
font-size: 25px;
width: 100%;
height: 56px;
background: yellow;
margin-bottom: 4px;
}
.designbox{
position: relative;
display: inline-block;
height:100%;
width: 14px;
background: orange;
}
.title{
position: relative;
line-height: 56px;
display: inline-block;
background: green;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.