【发布时间】:2019-04-21 16:49:18
【问题描述】:
我需要我的标志和导航在同一行,当使用 div 容器时,黑色背景也因某种原因消失了。我有显示:inline-block 属性和值集,我是不是把它放在错误的选择器下?
body div.container {
display: inline-block;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li{
display: inline-block;
margin: 1px;
padding: 0;
}
h1 {
font: #c00
}
body{
font: normal normal normal 75%/1.3em verdana,geneva,lucida,arial,sans-
serif; background-color: #fff;
}
<link rel="stylesheet" type="text/css" href="hw7style.css">
</head>
<background>
<body>
<div id="container">
<img src="hw7-images/logo.png" alt="logo" class="logo">
<nav>
<ul class="menu">
<li><a href="about.html"><img alt="About Us" src="hw7-
images/about.png" ></a></li>
<li><a href="events.html"><img alt="Events" src="hw7-
images/events.png" ></a></li>
<li><a href="outreach.html"><img alt="Community Outreach" src="hw7-
images/outreach.png" ></a></li>
<li><a href="resources.html"><img alt="Resources & Info" src="hw7-
images/resources.png" ></a></li>
<li><a href="contact.html"><img alt="Contact Us" src="hw7-
images/contact.png" ></a></li>
</ul>
</nav>
</div>
【问题讨论】: