0
我正在學習CSS,並且我對導航欄中的填充有點困惑。填充導航欄,李和標籤
#menu ul {
height: auto;
padding: 15px 3px;
margin: 0px;
}
#menu li {
display: inline;
padding: 20px;
}
#menu a {
text-decoration: none;
color:white;
padding: 3px 3px 3px 3px;
}
我怎麼看到UL填充相對移動的邊界所有UI元素,但讀音字困惑什麼真的做填充李和標籤? 因爲我如何理解填充是一個href標籤之間的空間,但是在li中填充的是什麼?
HTML:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
</head
<title>J</title>
<style>
body {
background-image: url('http://androidwallpape.rs/content/02-wallpapers/73-rainynight/wallpaper-1968153.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
\t background-size: 100% 100%;
}
h1{
color:white;
test-align:center;
}
p {
color:white;
test-align:right;
}
img {
float: center;
}
#menu {
width: 550px;
height: 45px;
\t float:right;
font-size: 16px;
font-family: Tahoma, Geneva, sans-serif;
font-weight: bold;
text-align: center;
text-shadow: 3px 2px 3px #336666 ;
background-color: #505050 ;
border-radius: 10px;
}
#menu ul {
height: auto;
padding: 15px 3px;
margin: 0px;
}
#menu li {
display: inline;
padding: 20px;
}
#menu a {
text-decoration: none;
color:white;
padding: 3px 3px 3px 3px;
}
#menu a:hover {
color: black;
background-color: #FFF;
}
</style>
<body>
<div id="menu">
<ul>
<li><a href="sajt.html">Home</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="services.html">Services</a></li>
<li><a href="contact.html">Contact Us</a></li>
</ul>
</div>
<h1>JJc</h1>
<p>nesjxjxjjx</p>
<img src="me.jpg">
</body>
</html>
請發表你的HTML太 – Chris
'padding'是一個元素,它的邊框之間的差距。每個元素可以有一個「填充」。 – KittMedia
使用瀏覽器的inspector dev工具(firefox中的Cntl-Shift-C)並選擇你正在查看的元素,然後在右邊的框模型中查看它的功能。 – KimvdLinde