首页 > 其他分享 >仿新浪导航栏(固定定位练习)

仿新浪导航栏(固定定位练习)

时间:2022-11-20 16:09:23浏览次数:40  
标签:right margin top 练习 width 新浪 0px 导航 left


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.top{
position: fixed;
top: 0px;
height: 44px;
width: 100%;
text-align: center;
}
.box {
width: 1000px;
margin: 44px auto;
}
.left,
.right {
position: fixed;
/*当使用绝对够定位时,margin-top和top 同时使用时,选择最大的起作用*/
margin-top: 200px;
top: 1px;
width: 120px;
}
.left {
left: 0px;
}
.right {
right: 0px;
}
</style>
</head>
<body>
<div class="top">
<img src="images/top.png" alt="">
</div>
<div class="box">
<img src="images/box.png" alt="">
</div>
<img src="images/ad-l.png" alt="" class="left">
<img src="images/ad-r.png" alt="" class="right">

</body>
</html>

所用素材:



仿新浪导航栏(固定定位练习)_css


标签:right,margin,top,练习,width,新浪,0px,导航,left
From: https://blog.51cto.com/u_13796931/5871537

相关文章