<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <link rel="stylesheet" type="text/css" href="boke.css"/> </head> <body> <header class="header"> <a href="#" class="header-logo"><img src="img/index/logo.svg"/></a> <div class="container header-nav"> <div class="header-subnav-btn"> 分类 <ul class="header-subnav"> <li><a href="#">NET技术</a></li> <li><a href="#">编程语言</a></li> <li><a href="#">软件设计</a></li> <li><a href="#">Web前端</a></li> <li><a href="#">手机开发</a></li> <li><a href="#">数据库技术</a></li> <li><a href="#">操作系统</a></li> <li><a href="#">其他</a></li> </ul> </div> <ul class="header-navbar"> <li class="active"><a href="#">首页</a></li> <li> <a href="#">新闻</a> <ul class="header-subnavbar"> <li><a href="#">a</a></li> <li><a href="#">b</a></li> <li><a href="#">c</a></li> <li><a href="#">d</a></li> <li><a href="#">e</a></li> <li><a href="#">f</a></li> <li><a href="#">g</a></li> <li><a href="#">h</a></li> </ul> </li> <li> <a href="#">博问</a> <ul class="header-subnavbar"> <li><a href="#">a</a></li> <li><a href="#">b</a></li> <li><a href="#">c</a></li> <li><a href="#">d</a></li> </ul> </li> <li> <a href="#">闪存</a> <ul class="header-subnavbar"> <li><a href="#">a</a></li> <li><a href="#">b</a></li> <li><a href="#">c</a></li> <li><a href="#">d</a></li> </ul> </li> <li> <a href="#">小组</a> <ul class="header-subnavbar"> <li><a href="#">a</a></li> <li><a href="#">b</a></li> <li><a href="#">c</a></li> <li><a href="#">d</a></li> <li><a href="#">e</a></li> </ul> </li> <li><a href="#">收藏</a></li> <li><a href="#">招聘</a></li> <li><a href="#">精华</a></li> </ul> <div class="header-search"> <input type="text" name="keywords" id="Search-input" placeholder="搜索" autocomplete="off"/> </div> <div class="login-hds"> <div id="zxc"> <a class="login-btn-hd" href="#" id="link">Ben涧の芽衣子</a> <a class="register-btn-hd" href="#" id="re">我的博客</a> <a class="register-btn-hd" href="#" id="re">退出</a> </div> </div> </div> </header> </body> </html>
* { margin: 0; padding: 0; } body { width: 100%; font-size: 12px; position: absolute; } .container { width: 1180px; margin: 0 auto; max-width: 1920px; } ul { list-style: none; margin: 0; padding: 0; box-sizing: border-box; } a { text-decoration: none; color: #212b34; background-color: transparent; box-sizing: border-box; } /*头部*/ .header { position: absolute; z-index: 1; box-shadow: 0 1px 5px 0 rgba(33,43,52,.1); width: 100%; top: 0; background-color: #FFFFFF; } .header .header-logo { position: relative; display: block; width: 245px; height: 80px; margin: 0 auto; overflow: hidden; text-align: center; } .header-logo>img { margin: 20px auto; } .header-nav { position: relative; height: 50px; } .iconfont { font-family: 'icomoon'; font-size: 16px; font-style: normal; margin-left: 5px; } .header-subnav-btn { position: absolute; left: 0; top: 0; display: block; width: 170px; height: 50px; line-height: 50px; text-align: center; color: #fff; font-size: 20px; background-color: #027cdb; opacity: 1; } .header-subnav { z-index: 2; position: absolute; width: 170px; top: 50px; visibility: hidden; } .header-subnav>li { display: block; height: 50px; line-height: 50px; text-align: center; font-size: 14px; background-color: #025fa8; border-bottom: 1px solid hsla(0,0%,100%,.2); } .header-subnav>li>a { /*display: block;*/ color: #fff; } .header-subnav>li:hover{ background-color: #01518f; } .header-subnav-btn:hover .header-subnav{ opacity: 1; visibility: inherit } .header-navbar { margin-left: 200px; } .header-navbar>li { display: inline-block; padding: 0 15px; line-height: 50px; font-size: 14px; position: relative; vertical-align: top; } .header-navbar>li a:hover{ color: #0097e6; } .header .active>a{ color: #73b2fc; padding-bottom: 4px; border-bottom: 2px solid #73b2fc } .header-navbar>li>a { color: #212b34; } .header-navbar>li .header-subnavbar{ position: absolute; box-shadow: 0 0 10px rgba(0,0,0,.08); background-color: #fff; text-align: left; border-radius: 0 0 4px 4px; width: 100px; transition: all .2s ease-in-out; top: 100%; opacity: 0; padding: 6px 0; visibility: hidden; } .header-navbar>li .header-subnavbar a { padding: 0 20px; font-size: 12px; line-height: 40px; display: block; color: #525a67; white-space: nowrap; transition: all .2s ease-in-out; } .header-navbar>li:hover .header-subnavbar{ opacity: 1; visibility: inherit; } .header-subnavbar>li>a:hover{ color: white; background-color: #025fa8; } .header-search { position: absolute; right: 0; bottom: 14px; padding-right: 18px; width: 250px; height: 25px; border-bottom: 1px solid #73b2fc; } #Search-input { border: none; width: 100%; line-height: 2.5; font-size: 12px; color: #212b34; outline: none; background-color: inherit; } input::-webkit-input-placeholder { color: #0097E6; } .login-hds { position: absolute; right: 0; top: 0; /* 300px;*/ margin-top: -67px; }