纯css流畅侧滑

鼠标 hover 到侧边区域时,滑出广告
在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
        <meta name="author" content="TKB-nice" />
        <style>
        .side-menu {
		    width:14em;
		    height: auto;
		    margin:4em auto 0;
		    font-size: 1em;
		    line-height: 2em;
		    color: #fff;
		    font-weight:700;
		    text-transform:uppercase;
		    position:absolute;
		    top:0; 
		    bottom:0;
		    left: -10em;
		}
		.side-menu ul {
		    list-style: none;
		    margin: 0;
		    padding: 0;
		}
		.side-menu ul li {
		  	display:block;
		    background-color: pink;
		    height: 2em;
		    padding: 1em 1.5em;
		    position: relative;
		    -webkit-transition: -webkit-transform 0.5s,     
		    background-color .5s, color .5s;
		    transition: transform .5s, background-color .5s, color .5s;
		}
		/*the colors of the different columns*/
		.side-menu ul li:nth-child(1) { background-color: red;}
		.side-menu ul li:hover {
		    background-color: pink; /*you can make different colors depending on the nth-child like above*/
		    -webkit-transform: translateX(10em);
		    transform: translateX(10em);/*equal to left in the .side-menu*/
		}
		.side-menu ul li a {
		  display:block;
		    color: #FFF;
		    text-decoration: none;
		}
		.side-menu ul li span {
		    display:block;
		    position: absolute;
		    font-size:1em;
		    line-height: 2em;
		    height:2em;
		    top:0; 
		    bottom:0;
		    margin:0 auto;
		    padding:1em 1.5em;
		    right: 0.16666666666667em;
		    color: #F8F6FF;
		}
    </style>
    </head>
	<body>
	       <nav class="side-menu">
			    <ul>
			      <li><a href="#">测试 1<span><i class="fa fa-map-marker"></i></span></a></li>
			      <li><a href="#">测试 2<span><i class="fa fa-compass"></i></span></a></li>
			      <li><a href="#">测试 3<span><i class="fa fa-bicycle"></i></span></a></li>
			      <li><a href="#">测试 4<span><i class="fa fa-bed"></i></span></a></li>
			    </ul>
		  	</nav>
	</body>
</html>
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值