这是我的HTML:
<div class="fourcol" align="center" ;="" style="float:;">
<h2 class="center" style="text-align: center;">More Mentors Announced Soon</h2>
文本本身居中对齐,但我希望它在页面内水平居中。我该怎么做呢?
这是我一直在使用的CSS
.fourcol, {
position: relative;
float: left;
margin-right: 2.762430939%;
margin-bottom: 20px;
margin-top: 20px;
}
h2.center {
width: 50%;
margin: 0 auto;发布于 2014-01-11 12:24:29
尝试此one.change类fourcol to more
.more {
float: left;
width: 100%;
}
<div align="center" class="more">
<h2 style="text-align: center;" class="center">More Mentors Announced Soon</h2>
</div>发布于 2014-01-11 09:09:47
去掉宽度为50%的线条
h2.center {
width: 50%; //remove this line
margin: 0 auto;
}编辑
h2.center {
margin-top: 34%;
}https://stackoverflow.com/questions/21057229
复制相似问题