【发布时间】:2021-10-20 23:12:26
【问题描述】:
我是编程新手,由于某种原因,CSS 不适用于 HTML。它以前有效,我不知道我做了什么使它停止应用。我希望文本在页面中间居中,但它一直保持在左侧。有人可以快速检查我的代码并告诉我我做错了什么吗?谢谢!
* {
margin: 0;
padding: 0;
font-family: 'Noto Sans', sans-serif;
overflow-x: hidden;
}
.sub-header {
height: 50vh;
width: 100%;
background-image: linear-gradient(rgba(4, 9, 30, 0.7), rgba(4, 9, 30, 0.7)), url(assets/contact-sub.jpg);
background-position: center;
background-size: cover;
text-align: center;
color: #fff;
}
.sub-header h1 {
margin-top: 50px;
}
.contact {
width: 80%;
margin: auto;
padding-top: 50px;
padding-bottom: 50px;
}
.reachme {
width: 80%;
margin: auto;
padding-top: 80px;
text-align: center;
}
.center {
padding-top: 25px;
}
.center {
margin-left: auto;
margin-right: auto;
}
table {
border-spacing: 10px;
}
td {
width: 110px;
text-align: center;
vertical-align: middle;
}
.hours {
color: #808080;
font-size: 14px;
text-align: center
}
.hours {
width: 80%;
margin: auto;
padding-top: 30px;
}
@media(max-width: 700px) {
.sub-header {
height: 35vh!important;
}
.reachme {
padding-top: 30px;
}
}
}
<section class="contact">
<div class="reachme">
<h4>Reach Me At</h4>
</div>
<table class="center">
<tr>
<td>Phone</td>
<td>(123)456-7890</td>
</tr>
<tr>
<td>Email</td>
<td>email@gmail.com
</td>
</tr>
</table>
</section>
<section class="hours">
<aside>
<p>Let's connect! ↓
</p>
</aside>
</section>
【问题讨论】:
-
在sn-p里好像没问题?
-
在浏览器中进行硬刷新
-
您的浏览器中可能缓存了一个文件 - 清除浏览器缓存或尝试使用其他浏览器查看是否有变化。