<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Dia 29</title>
</head>
<body>
<div class="nav">
<label for="toggle">☰</label>
<input type="checkbox" id="toggle"/>
<div class="menu">
<a href="#">Inicio</a>
<a href="#">Serviços</a>
<a href="#">Sobre</a>
<a href="#"><span>Teste gratis</span></a>
</div>
</div>
</body>
</html>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
body
{
width: 100%;
height: 100%;
margin: 0;
font-family: "helvetica neue", sans-serif;
}
.nav
{
border-bottom: 1px solid #EAEAEB;
text-align: right;
height: 70px;
line-height: 70px;
}
.menu
{
margin: 0 30px 0 0;
}
.menu a
{
clear: right;
text-decoration: none;
color: gray;
margin: 0 10px;
line-height: 70px;
}
span
{
color: #54D17A;
}
label
{
margin: 0 40px 0 0;
font-size: 26px;
line-height: 70px;
display: none;
width: 26px;
float: right;
}
#toggle
{
display: none;
}
@media only screen and (max-width: 500px) {
label {
display: block;
cursor: pointer;
}
.menu {
text-align: center;
width: 100%;
display: none;
}
.menu a {
display: block;
border-bottom: 1px solid #EAEAEB;
margin: 0;
}
#toggle:checked + .menu {
display: block;
}
}
预览
控制台