css - 文本溢出问题和文本非换行

标签 css xhtml html xhtml-1.0-strict

场景: 一个标题 DIV 和三个 DIV 并排向左浮动。

问题: 来自 HEADER_A div 的“文本”溢出到 HEADER_B DIV 等等。

屏幕截图/CSS:

alt text http://thumb0.webshots.net/t/74/174/8/92/12/2239892120105349420zNlkOc_th.jpg

#header{
height:127px;
width: 718px;
}

#header_a {
    width:181px;
    height: 127px;
    color:#FFFFFF;
    float:left; 
}

#header_b{
width: 363px;
float:left;
height: 127px;
/*background-image:url(../images/logo.jpg);*/
background-position:bottom;
background-repeat:no-repeat;
background-color:#006600;
}

#header_c{
width: 174px;
float:left;
height: 127px;
}

<div id="header">
      <div id="header_a">ddddddddddddddddddddddddddddddddddddddddddddddddddddddd</div>
        <div id="header_b"></div>
        <div id="header_c"><img src="images/nuevo.png" /></div>
    </div>

最佳答案

dddddddddddddddddddddddddddddddddddddddddddddddddddd 大于 181 像素。

它显然会溢出,因为它被视为一个单词并且单词没有被分解。尝试使用一些适当的文本或提供一些空间,例如“dddddddddddddd dddddddddddddddddd dddddddddddddddd”

编辑:

另一方面,图像也会发生同样的情况。因此,div 中任何大于其父级的内容都会溢出。你可以尝试使用 'overflow:hidden'

关于css - 文本溢出问题和文本非换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1113828/

相关文章:

jquery - 在 wordpress 移动设备上隐藏特定帖子

CSS : Background image not rescaling on mobile

html - CSS HTML 从屏幕右侧隐藏一个字段

javascript - 如何在 FullCalendar 中设置当天的颜色?

php - 您如何自定义/设置 codeigniter 错误的样式?

c# - Razor View 中 int 的 mvc 下拉绑定(bind)

html - 如何使带有注释的 HTML 代码处于非事件状态

html - 在绝对定位的 Div 上居中对齐

javascript - 如何避免 Highcharts 中的水平滚动条

html - CSS - 在另一个 div 中居中一个 div(非嵌套)