我正在一个小项目上工作,细节其实并不重要:Ptext-align:center;给我和文本对齐:正确;为什么?
但是我为多个“类别”创建了多个div。喜欢服务,联系等。
但我想对齐我的<h1 class="h1-contact">
。但它不适用于某些原因..
我已经尝试查找与此问题的其他主题,但不知何故这些答案不适用于我。
CSS
.h1-contact {
font-size: 30px;
line-height: 1.8;
text-transform: uppercase;
font-family: "Montserrat", sans-serif;
text-align: center;
}
HTML
<hr />
<br>
<div id="02">
<h1 class="h1-contact">Contact</h1>
<p>Hi</p>
我已经想看看在元检查看,如果别的东西是在我的H1-接触类的方法,但它不是
任何人都可以帮我吗?非常感谢你!
〜贾斯汀范栋勤
编辑
元检查在Chrome '风格' h1标签的:
.h1-contact {
font-size: 30px;
line-height: 1.8;
text-transform: uppercase;
font-family: "Montserrat", sans-serif;
text-align: center;
}
*ALL THIS IS STRIKED IN CHROME*
.h1, h1 {
font-size: 36px;
}
.h1, .h2, .h3, h1, h2, h3 {
margin-top: 20px;
margin-bottom: 10px;
}
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
font-family: inherit;
font-weight: 500;
line-height: 1.1;
color: inherit;
}
h1 {
margin: .67em 0;
font-size: 2em;
}
h1 {
font-size: 30px;
line-height: 1.8;
text-transform: uppercase;
font-family: "Montserrat", sans-serif;
}
ANOTHER编辑
这里有一些链接可能会派上用场:
的jsfiddle:https://jsfiddle.net/justinvandongen/8Lyowreo/ 项目:http://justthinq.justinvandongen.nl
你是什么意思“对齐?”你能提供一个你希望达到的更好的例子吗? –
你的代码应该可以工作。有一些东西会覆盖你的财产。 – Vcasso
@KhrisRoberts我想中心文字,我做错了什么? –