html设置顶部对齐,HTML / CSS文本从div顶部对齐
首先,你需要修復你的CSS選擇器 .
你可以通過這種方式't write all those id' .
#content #main #services
只需選擇1個元素和他的孩子 .
例如,如果你測試它,它將適用于你:
#services .langelis .txt {
width: 440px;
height: auto;
float: left;
border: 1px #000 solid;
text-align:center;
}
如果你想讓它垂直對齊 .txt div的中心,你可以這樣做:
#services {
width: 1010px;
height: auto;
min-height: 320px;
margin: 50px auto;
}
#content #main #services .langelis {
width: 510px;
height: auto;
min-height: 140px;
position: relative;
border: 1px #000 solid;
}
#content #main #services .langelis .icon {
width: 65px;
min-height: 140px;
height: auto;
float: left;
border: 1px #000 solid;
}
#services .txt {
width: 440px;
height: 500px;
border: 1px #000 solid;
display:table;
text-align:center;
}
.sub{
display:table-cell;
vertical-align:middle;
text-align:center;
}
Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s..
總結
以上是默认站点為你收集整理的html设置顶部对齐,HTML / CSS文本从div顶部对齐的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html ul左侧浮动,UL里的LI元素
- 下一篇: chrome 固定缩放比例_您如何调整G