在导航栏,li和标签中填充

时间:2015-10-22 17:17:39

标签: html css

我正在学习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填充移动所有ul元素相对于边框,但我很困惑什么真正填充li和标签? 因为我理解填充是一个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;
	background-size: 100% 100%;
}
h1{
color:white;
test-align:center;
}
p {
color:white;
test-align:right;

}
img {
   
    float: center;
   
}
#menu {
 
    width: 550px;
    height: 45px;
	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>

1 个答案:

答案 0 :(得分:1)

填充是内容周围的空间。

Boxe Model Example