前端鼠标触碰实现遮罩方法

前端_鼠标触碰事件

纯css编写,无js控件,鼠标触碰,下拉出新的界面。

<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>

		<style type="text/css">
			/*定义大的div*/
			.demo1 {
				width: 995px;
				height: 130px;
				text-align: center;
				overflow: hidden;/*隐藏多出来的部分*/
				background-color: #005E5E;/*背景定义为墨绿色*/
				position: relative;/*相对定位*/
			}
			
			.demo1 h1 {
				display: inline-block;/*把行内元素变为块类元素*/
				letter-spacing: 0.5em;/*字间距*/
				color: #F0F8FF;
				margin-top: 35px;/*内边距*/
			}
			/*定义第二个div*/
			.demo1 .demo2{
				color: #fff;
				display: block;/*同理变为块级元素*/
				position: absolute;/*绝对定位*/
				top: -130px;/*第二个div在第一个div的上面130px*/
				width: 100%;
				left: 0;
				padding: 42px 0;/*第二个div内字的上下边距为42px,注意这里会改变第二个div的大小*/
				background-color: burlywood;
				transition: all 0.3s ease;/*定义过渡的属性,下面是适用于的浏览器*/
				-webkit-transition: all 0.3s ease;
				-moz-transition: all 0.3s ease;
				-o-transition: all 0.3s ease;
				-ms-transition: all 0.3s ease;
				font-size: 40px;
				font-family: arial;
				text-shadow: 2px 2px 2px grey;
			}
			.demo2 a{
				text-decoration: none;
				color: #005e5e;
			}
			.demo2 a:hover{
				text-shadow: 6px 6px 6px grey;
			}
			.demo1:hover .demo2{
				top: 0;
			}
		</style>
	</head>

	<body>
		<div class="demo1">
			<div class="demo2">
				<a href="http://www.hvhipot.cn"><strong>www.hvhipot.cn</strong></a>
			</div>
			<h1>"创新+制造"20载国电西高</h1>
		</div>
		
		
	</body>

</html>

触碰前的效果:
触碰前
触碰后的效果:
触碰后

希望各路大神指教,给出更简便的方法。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值