HTML5标签
2022-10-24 本文已影响0人
山猪打不过家猪

-
例
image.png
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
header,footer{
height: 50px;
background: black;
text-align: center;
color: white;
line-height: 50px;
}
main{
overflow: auto;
}
nav,section,aside{
float: left;
}
main>nav{
width: 25%;
}
main>section{
width: 50%;
padding: 0 10px;
box-sizing: border-box;
}
main>aside{
width: 25%;
}
p{
height: 30px;
background: wheat;
text-align: center;
margin: 10px 0;
color: black;
}
main>aside>p{
background: blueviolet;
}
main>nav>p{
background:brown;
}
</style>
</head>
<body>
<header>
Header
</header>
<main>
<nav>Nav
<p>LInk</p>
<p>LInk</p>
<p>LInk</p>
<p>LInk</p>
<p>LInk</p>
<p>LInk</p>
<p>LInk</p>
</nav>
<section>
<article>
article1
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</article>
<article>
article2
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</article>
<article>
article3
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</article>
</section>
<aside>
ASIDE1
<p>ASIDE</p>
<p>ASIDE</p>
<p>ASIDE</p>
<p>ASIDE</p>
<p>ASIDE</p>
<p>ASIDE</p>
</aside>
</main>
<footer>
Footer
</footer>
</body>
</html>
-
box-sizing
解决了padding
会自动变大的问题
image.png