-1
我想在“新增功能”和“用餐想法”之后删除额外的边框,我尝试在<ul>
而不是<li>
中选择第一个孩子,它甚至没有工作。删除CSS中的边框
html {
background-color: white ;
}
body {
background-color: white ;
margin: 0 auto;
width: 960px;
font-family: arial,helvetica,sans-serif;
}
a {
text-decoration: none;
color: #373535 ;
}
header {
background-color: #ede6e6;
height:150px;
padding-top: 20px;
}
ul {
padding: 0 ;
}
li{
display: inline;
padding: 10px;
font-size: 16px;
}
header li :first-child {
border-right: 1px solid #373535;
padding-right: 10px;
}
<!DOCTYPE html>
<html lang= "en" >
<head>
<title> My Recipe </title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="js/html5shiv.js"></script>
<!-- yolo this is my first project -->
</head>
<body>
<header>
<div class="Left">
<ul>
<li> <a href="">Popular recipes</a> </li>
<li><a href="">Whats New</a> </li>
</ul> \t
</div>
<div class="Right">
<ul>
<li> <a href="">Categories</a> </li>
<li><a href="">Meal Ideas</a> </li>
</ul> \t
</div>
<div id="logo">
<img src="images/chefs-hat.png"/>
<p>My recipes</p>
</div>
</header>
</body>
</html>
我试过这段代码,它在第二个列表项后仍然给了我一个边框,它应该在这个代码中的第一个孩子上只添加一个边框吗? – Riadh
是的,我确实在Chrome上运行了代码。请检查一下。 – Sazz