CSS没有在Div中对齐文本

时间:2014-01-24 03:27:14

标签: html css

我在太空中获得了一个换行符。我不知道为什么会发生这种情况

请检查以下代码

<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

#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;
}

http://jsfiddle.net/d5Z6V/31/

2 个答案:

答案 0 :(得分:1)

您为sub_area_texttime div提供了40px的宽度和90px的填充权限。增加宽度或减少填充。由于容器太小,它正在缠绕线。

答案 1 :(得分:0)

white-space:nowrap;中尝试此#sub_area_texttime