css实现自适应响应式悬浮多级横竖菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:css实现自适应响应式悬浮多级横竖菜单效果代码

代码标签: css 自适应 响应式 横竖 悬浮 多级 菜单

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">

<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
    <style>
        html, body, aside {
    	display: block;
    	margin: 0;
    	padding: 0;
    }
    body {
    	padding: 40px;
    	background-attachment: fixed;
    	background-position: 50% 0;
    	background-size: cover;	
    }
    aside {
    	width: 233px;
    	min-height: 500px;
    }
    aside.right {
    	margin-left: auto;
    }
    a {
    	text-decoration: underline;
    }
    a:hover {
    	text-decoration: none;
    }
    .bg-red {
    	background-image: url(//repo.bfw.wiki/bfwrepo/image/61dec27e73ccc.png);
    }
  
    .body {
    	max-width: 1200px;
    	margin: 0 auto;
    }
    @media screen and (max-width: 1000px) {
    	body {
    		padding: 20px;
    	}
    }
    @media screen and (max-width: 767px) {
    	body {
    		padding: 10px;
    	}
    	aside {
    		width: auto;
    	}
    }
    @import url(css.css);
    
    /**/
    /* defaults */
    /**/
    .sky-mega-menu,
    .sky-mega-menu * {
    	margin: 0;
    	padding: 0;
    	outline: none;
    	border: 0;
    	background: none;
    }
    .sky-mega-menu {
    	font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    }
    
    
    /**/
    /* level 1 */
    /**/
    .sky-mega-menu {
    	position: relative;
    	z-index: 999;
    	background: rgba(255,255,255,0.9);
    	box-shadow: 0 0 20px rgba(0,0,0,.3);
    	font-size: 0;
    	line-height: 0;
    	text-align: right;
    }
    .sky-mega-menu:after {
    	content: '';
    	display: table;
    	clear: both;
    }
    .sky-mega-menu li {
    	position: relative;
    	display: inline-block;
    	float: left;
    	padding: 5px;
    	border-style: solid;
    	border-color: rgba(0,0,0,.1);
    	border-right-width: 1px;
    	font-size: 13px;
    	line-height: 45px;
    	text-align: left;
    	white-space: nowrap;
    }
    .sky-mega-menu li a {
    	display: block;
    	padding: 0 20px;
    	text-decoration: none;
    	color: #666;
    	transition: background 0.4s, color 0.4s;
    	-o-transition: background 0.4s, color 0.4s;
    	-ms-transition: background 0.4s, color 0.4s;
    	-moz-transition: background 0.4s, color 0.4s;
    	-webkit-transition: background 0.4s, color 0.4s;
    }
    .sky-mega-menu li > div {
    	position: absolute;
    	z-index: 1000;
    	top: 100%;
    	left: -9999px;
    	margin-top: 8px;
    	background: rgba(255,255,255,0.9);
    	box-shadow: 0 0 8px rgba(0,0,0,.3);
    	opacity: 0;
    	-o-transform-origin: 0% 0%;
    	-ms-transform-origin: 0% 0%;
    	-moz-transform-origin: 0% 0%;
    	-webkit-transform-origin: 0% 0%;
    	-o-transition: -o-transform 0.4s, opacity 0.4s;
    	-ms-transition: -ms-transform 0.4s, opacity 0.4s;
    	-moz-transition: -moz-transform 0.4s, opacity 0.4s;
    	-webkit-transition: -webkit-transform 0.4s, opacity 0.4s;
    }
    .sky-mega-menu li > div:after {
    	content: '';
    	position: absolute;
    	bottom: 100%;
    	left: 0;
    	width: 100%;
    	height: 8px;
    	background: transparent;	
    }
    .sky-mega-menu li > div:before {
    	content: '';
    	position: absolute;
    	bottom: 100%;
    	left: 24px;
    	border-right: 5px solid transparent;
    	border-bottom: 5px solid rgba(255,255,255,0.9);
    	border-left: 5px solid transparent;
    }
    .sky-mega-menu li:hover > a,
    .sky-mega-menu li.current > a {
    	background: #2da5da;
    	color: #fff;
    }
    .sky-mega-menu li:hover > div {
    	left: 0;
    	opacity: 1;
    	-webkit-transform: translate(0, 0);
    }
    .sky-mega-menu .right {
    	float: none;
    	border-right-width: 0;
    	border-left-width: 1px;
    }
    .sky-mega-menu .right > div {
    	-o-transform-origin-x: 100%;
    	-ms-transform-origin-x: 100%;
    	-moz-transform-origin-x: 100%;
    	-webkit-transform-origin-x: 100%;
    }
    .sky-mega-menu .right:hover > div {
    	right: 0;
    	left: auto;
    }
    .sky-mega-menu .right:hover > div:before {
    	right: 24px;
    	left: auto;
    }
    .sky-mega-menu .switcher {
    	display: none;
    }
    
    
    /**/
    /* level 2+ */
    /**/
    .sky-mega-menu li li {
    	display: block;
    	float: none;
    	border-width: 0;
    	border-top-width: 1px;
    	line-height: 21px;
    	white-space: normal;
    }
    .sky-mega-menu li li:first-child {
    	border-top: 0;
    }
    .sky-mega-menu li li a {
    	padding-top: 12px;
    	padding-bottom: 12px;
    }
    .sky-mega-menu li li > div {
    	top: 0;
    	margin: 0 0 0 8px;
    }
    .sky-mega-menu li li > div:after {
    	top: 0;
    	right: 100%;
    	bottom: auto;
    	left: auto;
    	width: 8px;
    	height: 100%;
    }
    .sky-mega-menu li li > div:before {
    	top: 22px;
    	right: 100%;
    	bottom: auto;
    	left: auto;
    	border-top: 5px solid transparent;
    	border-right: 5px solid rgba(255,255,255,0.9);
    	border-bottom: 5px solid transparent;
    }
    .sky-mega-menu li li:hover > div {
    	left: 100%;
    }
    .sky-mega-menu .right li > div {
    	margin: 0 8px 0 0;
    	-o-transform-origin-x: 100%;
    	-ms-transform-origin-x: 100%;
    	-moz-transform-origin-x: 100%;
    	-webkit-transform-origin-x: 100%;
    }
    .sky-mega-menu .right li > div:after {
    	right: auto;
    	left: 100%;
    }
    .sky-mega-menu .right li > div:before {
    	right: auto;
    	left: 100%;
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0