我的headerDiv有两个对象,一个标题和一个图像。我希望标题显示在左侧,图像显示在右侧。标题将动态更改为不同的长度。 headerDiv的宽度应该保持不变。如何隐藏h1标签中的溢出并显示浮动在标题div右侧的img标签?跨度标记在填充时将图像推送到下一行。当你的内容比父母的内容宽时,如何隐藏图像右侧溢出的图像?
.headerDiv{
width: 120px
}
h1 {
overflow: hidden;
white-space: nowrap;
width: 100px;
}
img{
width: 20px;
float: right;
}
<div class="headerDiv>
<h1>
<span title="text">
<spring:message code="${title}" text="${title}" />
<span style="font-weight: normal;">Text</span>
</span>
</h1>
<img src="image.gif"/>
</div>
希望有帮助...我没有完全理解你的问题。 – danijar 2012-01-02 18:55:47