【发布时间】:2011-12-14 20:45:18
【问题描述】:
我正在尝试并排对齐三个 div。中心 div 包含一个带图像的 href,用于扩展链接以编辑文本。问题是我无法垂直对齐这些 div 的内容。左、右和中心 div 的内容都应该在中间垂直对齐,例如:
[右]
[左] [中] [右]
[右]
它也可能看起来像:
[左]
[左] [右]
[左] [中] [右]
[左] [右]
[左]
但现在看起来像:
[左] [中] [右]
[左] [右]
[左]
编辑内容 div 所在
这是目前为止的代码:
<div id="search-result" class="accordion">
<div class="search-result-left">
<p>CEPT, Conference Européenne des Adminidstra-</p>
<p>tion Despostes et des Télécommunications</p>
</div>
<div class="search-result-right">
<p>Evropsko združenje poštnih in telekomunikaci-</p>
<p>jskih organizacij</p>
</div>
<div class="search-result-center">
<a href="#" class="acc"><img src="CSS/images/arrow_wr.gif"/></a>
</div>
<div class="edit-content">
<p><a href="#">edit</a> -
<a href="#">comment</a> -
<a href="#">translate</a>
</p>
</div>
</div>
和css:
#all-search-results {
font-size: 14px;
color: #000000;
width: 730px;
margin: 0 auto;
line-height: 4px;
}
.search-result-left {
text-align: right;
float: left;
width: 335px;
}
.search-result-center {
text-align: center;
margin: 0 auto;
width: 60px;
}
.search-result-center img{
vertical-align: bottom;
}
.search-result-right {
text-align: left;
float: right;
width: 335px;
}
.edit-content{
color: #669900;
margin-top: 20px;
}
.edit-content a {
color: #669900;
}
【问题讨论】:
-
有很多关于垂直居中 div 的帖子。请使用本网站的搜索机制或参考jakpsatweb.cz/css/css-vertical-center-solution.html(我在谷歌上的第一次点击)。
-
有比这更好的方法。
-
我也在寻找那个确切的页面,但这不是我想要的。
标签: css html vertical-alignment