我有以下 html 和 css 代码,我希望标签使用 css<a>
环绕标签。<li>
这是jsfiddle
html
<section class="row header">
<ul class="nav">
<li class="navfirst"><a href="#">Contact</a></li>
<li><a href="#">Home</a></li>
<li><a href="#">Resume</a></li>
<li><a href="#">Interests</a></li>
<li><a href="#">Work</a></li>
<li class="navlast"><a href="#">Comments</a></li>
</ul>
</section>
css
.header .nav {
margin: 0;
padding: 0; }
.header .nav li {
list-style-type: none;
display: inline-block;
padding: 0.5% 1%;
border: 1px solid green; }
.header .nav li.navfirst {
margin-right: 4%; }
.header .nav li.navlast {
margin-left: 4%; }
.header .nav li a {
display: block;
text-decoration: none;
border: 1px solid red;
width: 100%;
height: 100%; }
这是scss。上面的css是从scss文件转换而来的
.nav {
margin: 0;
padding: 0;
li {
list-style-type: none;
display: inline-block;
padding: 0.5% 1%;
border: 1px solid green;
&.navfirst {
margin-right: 4%;
}
&.navlast {
margin-left: 4%;
}
a {
display: block;
text-decoration: none;
border: 1px solid red;
width: 100%;
height: 100%;
}
}
}