我将此插入到html代码中,它适用于有序列表和h1,但不适用于p。 我知道这是一个初学者html,但通常p的css有效,但是现在我不知道为什么它不加载
h1 {
color: yellow;
}
p {
color: green;
text-decoration: underline;
}
ol {
list-style-type: none;
}
<!DOCTYPE html>
<html>
<head>
<title>My Profile Page</title>
</head>
<body>
<ul>
<li><strong>Home</strong></li>
<li><a href="about.html">About</a></li>
<li><a href="gallery.html">Gallery</a></li>
</ul>
<br>
<br>
<br>
<h1><center>WELCOME TO HOME PAGE</center></h1>
<p><center>Choose a page from the menu</p>
<ol>
<li><a href="/about.html" list-style-type="none"><img src="forest.jpg" alt=""></a></li>
<li><a href="/about.html"><img src="forest.jpg" alt=""></a></li>
<li><a href="/about.html"><img src="forest.jpg" alt=""></a></li>
</ol>
</body>
</html>
答案 0 :(得分:0)
从<center>
删除<p>
并将text-align: center;
添加到<p>
的css中
h1 {
color: yellow;
}
p {
color: green;
text-decoration: underline;
text-align: center;
}
ol {
list-style-type: none;
}
<!DOCTYPE html>
<html>
<head>
<title>My Profile Page</title>
</head>
<body>
<ul>
<li><strong>Home</strong></li>
<li><a href="about.html">About</a></li>
<li><a href="gallery.html">Gallery</a></li>
</ul>
<br>
<br>
<br>
<h1><center>WELCOME TO HOME PAGE</center></h1>
<p>Choose a page from the menu</p>
<ol>
<li><a href="/about.html" list-style-type="none"><img src="forest.jpg" alt=""></a></li>
<li><a href="/about.html"><img src="forest.jpg" alt=""></a></li>
<li><a href="/about.html"><img src="forest.jpg" alt=""></a></li>
</ol>
</body>
</html>