因为第一次做响应式的网站导航栏,而且也是第一次做这种下拉类型,导航栏在页面缩小时会根据页面进行收缩,但是想做成手机端就会缩进小图标那种
以下是HTML代码
```html
<div class="container-l">
<div class="sy-dhl">
<div class="main">
<nav id="cbp-hrmenu" class="cbp-hrmenu"> <img class="logo-qw2" src="assets/img/LOGO/logo-light1.png" width="180px" height="60px"> <img class="logo-qw" src="assets/img/LOGO/logoh2.png" width="180px" height="60px">
<ul>
<li onclick="window.location.href='index.html'"> <span onclick="window.location.href='index.html'">首页</span></li> <li> <a href="#">关于我们</a>
<div class="cbp-hrsub">
<div class="cbp-hrsub-inner">
<div> <a href="about.html">
<h3>公司简介</h3>
</a>
<ul>
</ul>
</div>
<div> <a href="fazhanlishi.html">
<h3>发展历史</h3>
</a> </div>
<div><a href="QYRY.html">
<h3>企业荣誉</h3>
</a></div>
</div>
<!-- /cbp-hrsub-inner -->
</div>
<!-- /cbp-hrsub -->
</li>
<li> <a href="#">服务</a>
<div class="cbp-hrsub">
<div class="cbp-hrsub-inner">
<div>
<h4>审计</h4>
<ul>
<li><a href="chanpin/cwbbsj.html">财务报表审计</a></li>
<li><a href="#">资本市场服务</a></li>
<li><a href="chanpin/jzfw.html">鉴证服务</a></li>
</ul>
<h4>金融服务</h4>
<ul>
<li><a href="#">普汇金融</a></li>
<li><a href="chanpin/rzzl.html">融资租赁</a></li>
</ul>
<h4>科技生产力咨询</h4>
<ul>
<li><a href="#">众创空间</a></li>
<li><a href="#">企业数字化</a></li>
</ul>
</div>
<div>
<h4>税务与商务咨询</h4>
<ul>
<li><a href="chanpin/qysfw.html">企业税服务</a></li>
<li><a href="#">间接税服务</a></li>
<li><a href="#">个税&灵活就业</a></li>
</ul>
<h4>财务咨询</h4>
<ul>
<li><a href="chanpin/qykjjjfa.html">企业会计解决方案</a></li>
<li><a href="#">价值服务</a></li>
</ul>
<h4>私人客户服务</h4>
<ul>
<li><a href="#">家族企业</a></li>
<li><a href="#">高科技高成长项目</a></li>
</ul>
</div>
<div>
<h4>风险管理咨询</h4>
<ul>
<li><a href="chanpin/kuaijifuwu.html">会计服务与内部控制</a></li>
<li><a href="#">网络安全与战略风险</a></li>
<li><a href="#">合规支持</a></li>
</ul>
<h4>跨境企业服务</h4>
<ul>
<li><a href="#">中国政策资讯</a></li>
<li><a href="#">生活在中国</a></li>
</ul>
<h4>热点服务</h4>
<ul>
<li><a href="#">政府服务</a></li>
<li><a href="#">国有企业服务</a></li>
<li><a href="#">民营企业与私人客户服务</a></li>
</ul>
</div>
<div> </div>
</div>
<!-- /cbp-hrsub-inner -->
</div>
<!-- /cbp-hrsub -->
</li>
<li> <a href="#">行业</a>
<div class="cbp-hrsub">
<div class="cbp-hrsub-inner">
<div>
<h4>消费行业</h4>
<ul>
<li><a href="hangyedalei/qc.html">汽车</a></li>
<li><a href="hangyedalei/xfp.html">消费品</a></li>
<li><a href="hangyedalei/jtjdfw.html">交通、酒店及服务</a></li>
<li> </li>
</ul>
<h4>金融服务行业</h4>
<ul>
<li><a href="hangyedalei/kuazihangye.html">跨子行业</a></li>
<li><a href="hangyedalei/yinhang.html">银行业及资本市场</a></li>
<li><a href="hangyedalei/baoxian.html">保险业</a></li>
<li><a href="hangyedalei/touzi.html">投资管理</a></li>
<li><a href="hangyedalei/fdc.html">房地产</a></li>
</ul>
</div>
<div>
<h4>能源、资源及工业行业</h4>
<ul>
<li><a href="hangyedalei/gongye.html">工业产品及建筑业</a></li>
<li><a href="hangyedalei/kyjjs.html">矿业及金属</a></li>
<li><a href="hangyedalei/shiyou.html">石油、天然气及化学品</a></li>
<li><a href="hangyedalei/dianlikezaisheng.html">电力、公共设施及可再生能源</a></li>
</ul>
<h4>生命科学与医疗行业</h4>
<ul>
<li><a href="hangyedalei/yiliao.html">医疗</a></li>
<li><a href="hangyedalei/shengmingkexue.html">生命科学</a></li>
</ul>
</div>
<div>
<h4>公共服务</h4>
<ul>
<li><a href="hangyedalei/gonggweisheng.html">公共卫生及社会服务</a></li>
<li><a href="hangyedalei/cishanjigou.html">国际非营利性机构/慈善机构</a></li>
<li><a href="hangyedalei/gonggongjiaotong.html">公共交通</a></li>
</ul>
</div>
</div>
<!-- /cbp-hrsub-inner -->
</div>
<!-- /cbp-hrsub -->
</li>
<li> <a href="#">伙伴</a>
<div class="cbp-hrsub">
<div class="cbp-hrsub-inner">
<div> <a href="rencaizp.html">
<h3>人才招聘</h3>
</a>
<ul>
</ul>
</div>
<div> <a href="shehuizp.html">
<h3>社会招聘</h3>
</a> </div>
<div> <a href="xiaoyuanzp.html">
<h3>校园招聘</h3>
</a> </div>
</div>
<!-- /cbp-hrsub-inner -->
</div>
<!-- /cbp-hrsub -->
</li>
<li> <a href="caishuizhishi.html">新闻</a>
<div class="cbp-hrsub">
<div class="cbp-hrsub-inner">
<div> <a href="xinwenzixun.html">
<h3>新闻资讯</h3>
</a> </div>
<div> <a href="caishuizhishi.html">
<h3>财税知识</h3>
</a> </div>
<!-- /cbp-hrsub-inner -->
</div>
</li>
<!-- /cbp-hrsub -->
<!-- /cbp-hrsub-inner -->
<!-- /cbp-hrsub -->
<!-- /cbp-hrsub-inner -->
<!-- /cbp-hrsub -->
<li> <a href="caishuizhishi.html">社区</a>
<div class="cbp-hrsub">
<div class="cbp-hrsub-inner">
<div> <a href="lianxiwomen.html">
<h3>联系我们</h3>
</a> </div>
<div> <a href="hongyuansh.html">
<h3>泓远生活</h3>
</a> </div>
<!-- /cbp-hrsub-inner -->
</div>
</li>
</ul>
</nav>
</div>
<select class="yyqh-xl">
<option>ZH-CN</option>
<option>EN-GB</option></select>
</div>
</div>
<div class="mb_bar"></div>
<!-- End Header --> a
以下是CSS代码
```css
.sy-dhl{
background-color: rgba(0,0,0,0.3);
width: 100%;
height: 7%;
position: fixed;
z-index: 999999;
margin-top: 0;
transition: 0.8s;
}
.cbp-hrmenu {
width: 120%;
margin-top: 0em;
float: left;
}
/* general ul style */
.cbp-hrmenu ul {
margin: 0;
padding: 0;
list-style-type: none;
}
/* first level ul style */
.cbp-hrmenu > ul,
.cbp-hrmenu .cbp-hrsub-inner {
width: 90%;
max-width: 70em;
margin: 0 auto;
padding: 0 1.875em;
float: left;
}
.cbp-hrmenu > ul > li {
display: inline-block;
}
.cbp-hrmenu > ul > li > a {
font-weight: 700;
padding: 1em 2em;
color: #555555;
display: inline-block;
}
.cbp-hrmenu > ul > li > a:hover {
color: #FF2326;
transition: 0.5s;
}
.cbp-hrmenu ul li span{
font-weight: 700;
padding: 1em 2em;
color: #555555;
display: inline-block;
cursor: pointer;
}
.cbp-hrmenu ul li span:hover{
color: #FF2326;
transition: 0.5s;
}
/* sub-menu */
.cbp-hrmenu .cbp-hrsub {
display: none;
position: absolute;
background-color: rgba(0,0,0,0.3);
width: 100%;
left: 0;
flex-direction: column;
}
.cbp-hrmenu .cbp-hrsub:hover{
color: #170B0C;
}
.cbp-hropen .cbp-hrsub {
display: block;
padding-bottom: 3em;
}
.cbp-hrmenu .cbp-hrsub-inner > div {
width: 33%;
float: left;
padding: 0 2em 0;
}
.cbp-hrmenu .cbp-hrsub-inner:before,
.cbp-hrmenu .cbp-hrsub-inner:after {
content: " ";
display: table;
}
.cbp-hrmenu .cbp-hrsub-inner:after {
clear: both;
}
.cbp-hrmenu .cbp-hrsub-inner > div a {
line-height: 2em;
}
.cbp-hrsub h4 {
color: #FFFFFF;
padding: 0.6em 0 0.6em;
margin: 0;
font-size: 160%;
font-weight: 600;
}
.cbp-hrsub h3 {
color: #FFFFFF;
padding: 1.5em 0 0.6em;
margin: 0;
font-size: 120%;
font-weight: 600;
}
.cbp-hrsub a h3:hover{
color: #FF2326;
transition: 0.5s;
}
.cbp-hrsub ul li a{
color: #EDEDED;
font-size: 100%;
font-weight: 500;
}
.cbp-hrsub ul li a:hover{
color: #FF2326;
transition: 0.5s;
}
/* Examples for media queries */
@media screen and (max-width: 52.75em) {
.cbp-hrmenu {
font-size: 80%;
transition: 0.9s;
}
}
@media screen and (max-width: 52.75em) {
.sy-dhl{
display:flex;display: -webkit-flex;height:100%;flex-direction:column;
}
}
@media screen and (max-width: 43em) {
.cbp-hrmenu {
font-size: 120%;
border: none;
transition: 0.9s;
background-color: #FFFFFF;
}
.cbp-hrmenu > ul,
.cbp-hrmenu .cbp-hrsub-inner {
width: 100%;
padding: 0;
}
.cbp-hrmenu .cbp-hrsub-inner {
padding: 0 2em;
font-size: 75%;
}
.cbp-hrmenu > ul > li {
display: block;
border-bottom: 1px solid #FF2D2D;
}
.cbp-hrmenu > ul > li > a {
display: block;
padding: 1em 3em;
}
.cbp-hrmenu .cbp-hrsub {
position: relative;
}
.cbp-hrsub h4 {
padding-top: 0.6em;
color: #000000;
}
.cbp-hrsub h3 {
padding-top: 0.6em;
color: #000000;
}
.cbp-hrsub ul li a{
color: #282828;
font-size: 100%;
font-weight: 500;
}
}
@media screen and (max-width: 36em) {
.cbp-hrmenu .cbp-hrsub-inner > div {
width: 100%;
float: none;
padding: 0 2em;
background-color: #FFFFFF;
}
}
现在是这样
想做成这样
求指点一二