HTML+css问题! 一条线如何在hover上去时候 线的宽度从2边延长???
1个回答
展开全部
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.line{font-size: 12px; border-bottom: red 1px solid; width: 100px; margin: 100px auto; text-align: center; cursor: pointer; color: #999; line-height: 40px;}
</style>
<link rel="stylesheet" href="css.css">
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div class="line">我是一根细线。</div>
<script>
$(".line").hover(function(){
$(this).stop().animate({"width":1000}, 300);
},function(){
$(this).stop().animate({"width":100}, 300);
})
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.line{font-size: 12px; border-bottom: red 1px solid; width: 100px; margin: 100px auto; text-align: center; cursor: pointer; color: #999; line-height: 40px;}
</style>
<link rel="stylesheet" href="css.css">
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div class="line">我是一根细线。</div>
<script>
$(".line").hover(function(){
$(this).stop().animate({"width":1000}, 300);
},function(){
$(this).stop().animate({"width":100}, 300);
})
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询