答案 0 :(得分:1)
对于项目符号点,需要将list-style
而非list-style-type
设置为none
对于水平线,首先将<ul>
设置为display: flex;
,这样它将越过水平屏幕。然后,在该空间中将<li>
元素设为display: inline-block
。
这是一个包含这些更改和一些其他更改的jsfiddle: https://jsfiddle.net/p9mL2tnd/1/
这是代码:
html:
<div id="nav">
<h3>Page Navigation</h3>
<ul>
<li><a href="index.html">Welcome</a></li>
<li><a href="about.html">About</a></li>
<li><a href="Contact.html">Contact</a></li>
<li><a href="Gallery.html">Gallery</a>
<li><a target="_blank" href="https://www.facebook.com">Facebook</a></li>
</ul>
</div>
css:
a:link {
color: #fff;
}
a:visited {
color: #fff;
}
a:active {
color: #fff;
}
a:hover {
color: #fc0;
background-color: #006a9d;
}
a:focus {
color: #fc0;
}
div#nav {
margin: 0;
padding: 0;
display: block;
}
h3 {
background-color: beige;
display: block;
text-align: center;
margin: 0;
padding: 0;
}
ul {
display: flex;
margin: 0;
padding: 0;
}
li {
list-style: none;
background-color: #0080c0;
display: inline-block;
text-decoration: none;
width: 150px;
padding: 5px 20px;
font-family: 'Arial', 'sans-serif';
font-weight: 14px;
border-bottom: 1px #ccc solid;
}
答案 1 :(得分:0)
npm cache clear --force
a:link { color: #fff;}
a:visited { color: #fff;}
a:hover { color: #fff;}
a:active { color: #fc0; background: 006a9d;}
a:focus { color: #fc0;}
#nav h3 {
margin: 0;
}
h3 {
text-align: center;
color: #71e62a;
font-size: 24px;
font-weight: bold;
border-bottom: 1px solid #48e0e6;
padding-bottom: 15px;
}
ul {
display: flex;
justify-content: center;
align-items: center;
list-style: none;
padding: 0;
margin: 0;
background: #0080c0;
}
ul li a {
background-color: #0080c0;
display: inline-block;
text-decoration: none;
width: 150px;
padding: 5px 20px;
margin: 8px 0;
font-weight: bold;
font-size: 18px;
font-family: Arial,"sans serif";
}