我不想使用浮动属性。将导航项右对齐
我想使用这些属性(链接):https://css-tricks.com/snippets/css/a-guide-to-flexbox/
我也有评论的背景图像CSS3?这也是我想申请
我的代码:
*{
margin:0;
padding: 0;
box-sizing: border-box;
}
html,
body {
background-color: #fff;
color: #555;
font-family: "Lato", "Arial", "sans-serif";
font-weight: 300;
font-size: 20px;
text-rendering: optimizeLegibility;
}
.wrapper{
\t display: flex;
display: -webkit-flex;
display: -ms-flexbox;
margin: 0 auto;
flex-direction:column;
width: 100%;
max-width: 80%;
border: solid 1px #000;
}
.header{
/*background-image: -webkit-linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url("logo.png");
background-size: cover;
background-position: center;
height: 100vh;
background-attachment:fixed; */
background-color: rgba(0, 0, 0, 0.8);
color: rgba(0, 0, 0, 0.7);
}
.logo{
height: 100px;
width:auto;
border-radius: 50%;
margin: 10px;
align-items: center;
}
.main-nav {
display: flex;
list-style: none;
}
.main-nav a{
text-decoration: none;
color:rgba(255, 255, 255, 0.8);
}
\t
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>FlexBox: HTML5 and CSS3 Fundamentals</title>
<link rel="stylesheet" type="text/css" href="styles.css" media="screen" />
<link href="http://fonts.googleapis.com/css?family=Lato:100,300,400,300italic" rel="stylesheet" type="text/css">
</head>
<body>
<div class="wrapper">
<header>
<div class="header">
<img src="logo1.png" alt="Logo" class="logo">
<nav>
<ul class="main-nav">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</div>
</header>
</div>
</body>
</html>
后你有这么远 – LGSon