<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool导航条(弹性盒)</title>
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<style type="text/css">
.nav {
/* 将导航栏设置为弹性容器 */
display: flex;
width: 1210px;
height: 48px;
line-height: 48px;
margin: 50px auto;
background-color: #e8e7e3;
}
/* 设置子元素根据内容多少自动占比父元素 */
.nav li {
flex-grow: 1;
}
.nav a {
display: block;
color: #808080;
font-size: 16px;
text-align: center;
text-decoration: none;
}
.nav a:hover {
color: #FFF;
background-color: #636363;
}
</style>
</head>
<body>
<ul class="nav">
<li><a href="javascript:void(0);">HTML/CSS</a></li>
<li><a href="javascript:void(0);">Browser Side</a></
HTML弹性盒速成导航条
最新推荐文章于 2024-07-10 16:57:46 发布