编辑:添加 jsFiddle:http: //jsfiddle.net/gdHuh/
在我的页面上有一个带有底部边框的标题。标题和边框之间有填充。浮动在标题区域的右侧,触摸底部边框,是一个搜索框。这是它的样子:
但是,当标题和搜索框文本过长时,部分标题文本会被搜索框隐藏:
这就是我希望它在这种情况下的样子:
这是我的 HTML:
<div class="row">
<div class="column column8">
<h1>Internship Reviews & Rankings</h1>
</div>
<div class="findTop column column8">
<div class="greyShaded findTab">
<img class="verticalBottom" src="images/blueMagnify.png"/>
<a>Find an Internship Program</a>
<img class="verticalTextTop" src="images/greyArrowheadRight.png"/>
</div>
</div>
</div>
和 CSS:
/* More Specific CSS */
.findTab{
float: right;
margin: 0px 5px;
padding: 5px 10px;
font-weight: bold;
line-height: 24px;
border-left: 1px solid #ddd;
border-top: 1px solid #ddd;
border-right: 1px solid #ddd;
background-color: #f5f5f5;
font-family: "Helvetica Neue", arial, helvetica, sans-serif;
font-size: 13px;
}
.findTop{
border-bottom: 1px solid #ddd;
margin-top: -23px;
}
/* More general CSS */
.row {
clear: both;
width: 100%;
position: relative;
}
.column {
margin: 0 15px;
float: left;
border: 0;
padding: 0;
position: relative;
}
.column8 {
width: 610px;
}
h1{
font-size: 28px;
line-height: 32px;
margin: 0px;
padding: 0px;
font-family: "Helvetica Neue", arial, helvetica, sans-serif;
font-weight: bold;
}
如何更改 HTML 和 CSS 以便正确布局元素?