[英]CSS not aligning text inside the Div
I am getting a line break on space. 我在空间上换行了。 I don't why it is happening 我不知道为什么会这样
Please check below code 请检查下面的代码
<div id="postcode_phone">
<div id="sub_area_text1">02036MMM4</div>
<div id="sub_area_textgmt">GMT +1</div>
<div id="sub_area_texttime">Mon-Fri 8:00am - 5:00pm<br>Sat: 8:00am - 1:00pm </div>
</div>
CSS CSS
#postcode_phone{
position:relative;
background:url(images/phonebanner.png) no-repeat;
width:222px;
height:81px;
}
#sub_area_text1 {
font-size:1.2em;
font-family: 'Corbol';
color:#31ACFF;
text-align:center;
padding-top:10px;
padding-left:30px;
}
#sub_area_textgmt {
font-size:0.8em;
font-family: 'Corbol';
color:#999999;
text-align:right;
padding-top:10px;
padding-right:60px;
width:10px;
border:5px solid gray;
margin:0px;
float:left;
}
#sub_area_texttime {
font-size:0.8em;
font-family: 'Corbol';
color:#999999;
text-align:center;
padding-right:90px;
width:40px;
border:5px solid gray;
margin:0px;
float:right;
overflow: hidden;
}
You gave the sub_area_texttime div a width of 40px and a padding-right of 90px. 您为sub_area_texttime div设置了40px的宽度和90px的右填充。 Increase width or decrease the padding. 增加宽度或减少填充。 It's wrapping the line because the container is too small. 它包装线是因为容器太小。
Try this white-space:nowrap;
试试这个white-space:nowrap;
in your #sub_area_texttime
. 在您的#sub_area_texttime
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.