https://fast-fortress-5770.herokuapp.com/
只需要一些手把手就可以得到h1 element Yo!我是贾斯汀。还有h3元素,我在网络上的所有东西都是为了响应,但也是居中的。但是,正在努力解决这个问题,所以如果有人能伸出援手,我将不胜感激。非常感谢。
.section {
text-align: center;
margin:0!important;
padding:0!important;
}
#floater {
margin-top: 23% 0;
margin-left: 39% 0;
}
<div class="section" id="floater">
<h1><strong>Yo! Justin here.</strong></h1>
<h3>I'm all over this web thing.</h3>
</div>
发布于 2014-11-12 06:52:15
#floater
{
width: 800px;
display: block;
margin-left: auto;
margin-right: auto;
}
将这段css添加到#floter的代码中。这应该适用于大多数浏览器。
发布于 2014-11-12 06:53:19
您可以将文本对齐: center分配给h1和h3,也可以添加
.section {
margin: 0 auto;
}
div不是文本,所以它不能使用文本对齐。
发布于 2014-11-12 06:53:21
当你有这么小的代码时,一个快速的调试方法是逐行删除css (如果你不想删除一行,你可以非常快地注释掉它)。
.section { text-align: center;
margin:0!important;
padding:0!important; }
#floater { margin-top: 23% 0;
margin-left: 39% 0; }
例如:
.section { text-align: center;
/* margin:0!important; */
padding:0!important; }
#floater { margin-top: 23% 0;
margin-left: 39% 0; }
https://stackoverflow.com/questions/26875808
复制相似问题