CSS实现平板菜单

效果如下:


HTML:

<!DOCTYPE html>
<html>
<head>
	<title>Mac menu</title>
	<meta charset="utf-8"></head>
	<style type="text/css">
	.box{text-align: center;margin: 200px 0;}
	.box ul{list-style-type: none;}
	.box ul li{
		width: 60px;
		height: 60px;
		float: left;
		position: relative;
		/*设置平滑过渡当:hover触发时相应*/
		-webkit-transition:.2s ease;
		-moz-transition:.2s ease;
		transition:.2s ease;
	}
	.box ul li:before{
		width: 0;
		padding: 2px 5px;
		position: absolute;
		left: 40px;
		content: attr(title);
		background: #000;
		color: #fff;
		opacity: 0;
		-moz-border-radius: 5px;
		-webkit-border-radius: 5px;
		border-radius: 5px;
		/*设置垂直方向平移*/
		transform:translateY(-40px);
		/*设置线性过渡当:hover触发时相应*/
		-moz-transition:.2s linear .2s;
		-webkit-transition:.2s linear .2s;
		transition:.2s linear .2s;
		font:12px/12px blod 'Microsoft YaHei';
		
	}
	.box ul li:hover:before{
		width: 80px;
		opacity: 1;
		left: -5px;
		display: block;
	}
	.box ul li:hover{
		width:80px;
		height:80px;
		margin-top:-20px;
	}
	.box ul li.pre,
    .box ul li:hover+li{width:70px;margin-top:-10px;}
	.box ul li img{width: 100%;}
	</style>

<body>
	<div class="box">
		<ul id="dock">
			<li title="Internet Explorer" class="">
				<img src="./Mac Dock_files/ie.png" alt=""></li>
			<li title="Mozilla FireFox" class="">
				<img src="./Mac Dock_files/firefox.png" alt=""></li>
			<li title="Chrome" class="">
				<img src="./Mac Dock_files/chrome.png" alt=""></li>
			<li title="Safari" class="">
				<img src="./Mac Dock_files/safari.png" alt=""></li>
			<li title="Opera" class="">
				<img src="./Mac Dock_files/opera.png" alt=""></li>
			<li title="Netscape" class="">
				<img src="./Mac Dock_files/netscape.png" alt=""></li>
			<li title="TheWorld" class="">
				<img src="./Mac Dock_files/theWorld.png" alt=""></li>
		</ul>
	</div>
</body>
</html>

原文地址: 点击打开链接

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值