【网站制作】二、实战 - B站首页导航栏

<!DOCTYPE html>

<html>
	<head>
	<meta charset="utf-8">
		<title>bilibili</title>
		<style> /*盒子模型的样式*/
			*{margin: 0; padding: 0;} /*外边距;内边距*/
			/*背景除了使用颜色,当然也可以使用图片,不过要注意,图片引用要使用url*/
			.top {width: 100%; height: 180px; /*background: red;*/background: url(images/1.png);}
			/*背景想要透明效果可以使用rgba,最后一个参数为1表示不透明,为0表示全透明*/
			.top .a {width: 100%; height: 38px; /*background: blue;*/background: rgba(255, 255, 255, 0.5);}
			/*margin 外边距  margin: 0 0 0 0;上右下左    margin:0 auto;上下 左右     margin:0;上下左右*/
			.top .a .b {width: 1000px; height: 38px; /*background: green;*/ margin: 0 auto;}
			/*border: 1px solid #000; 边框:边框粗细 边框类型 颜色*/
			/*float: left; 使li标签横着排,左浮动*/
			/*list-style: none; 取消无序列表li小圆点*/
			/*line-height: 38px; 上下居中 38px表示行高   text-align: center;*/
			/*font-size: 16px; 设置字体大小 font-family: 微软雅黑; 设置字体类型 font-weight: 100px;设置字体粗细*/
			.top .a .b ul li{width: 50px; height: 38px;/*border: 1px solid #000;*/ 			   
							float: left; list-style: none;line-height: 38px;text-align: center;font-size: 16px; font-family: 微软雅黑;font-weight: 100px;}
			/*li:hover实现鼠标悬停时操作*/
			.top .a .b ul li:hover{background: blue;}

			/*text-decoration: none;去除超链接下的横线*/
			/*display: block; 设置a标签为块级元素*/
			.top .a .b ul li a {text-decoration: none;width: 50px; height: 38px; display: block;color:#000;}
			/*border-radius:0 0 15px 15px; 设置圆角 对应位置依旧是 上 右 下 左*/ 
			.top .a .b ul li.tougao{height: 55px;background: pink; border-radius:0 0 15px 15px; }
			.top .a .b ul li.tougao a {height: 55px;}
		</style>
	</head>

	<body>
		<div class="top">
			<div class="a">
				<div class="b">
					<a style="float: left;line-height: 38px;" href="#"><img src="images/1.png"></a>
					<ul style="float: left;"><!-- 样式也可以写在具体的标签中 -->
						<li><a href="#">1</a></li>
						<li><a href="#">2</a></li>
						<li><a href="#">3</a></li>
						<li><a href="#">4</a></li>
					</ul>

					<ul style="float: right;">
						<li><a href="#">5</a></li>
						<li><a href="#">6</a></li>
						<li><a href="#">7</a></li>
						<li class="tougao"><a href="#">8</a></li>
					</ul>
				</div>
			</div>
		</div>
	</body>
</html>
发布了691 篇原创文章 · 获赞 1108 · 访问量 78万+

猜你喜欢

转载自blog.csdn.net/ReCclay/article/details/104374516
今日推荐