点击放大导航栏菜单

在上一个圆角导航栏的基础上,我们可以设置其他样式

比如这个,hover之后放大,主要的改变就是背景高度提了20个px,再设置一下margin-top :-20px,这里用了负数,是向上移动20px,最后设置一下行高让文字居中。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导航栏</title>
<style>
*{margin:0;padding:0;font-size:20px}
ul{list-style:none;height:50px;border-bottom:#000000 solid;padding-left:30px} 
li{float:left;margin-top:20px;margin-left:30px}
a{text-decoration:none;display:block;height:30px;line-height:30px;width:120px;margin-bottom:1px;text-indent:20px;background:#FFFFFF;color:#000000}
<!--li{height:30px;line-height:30px;width:100px;background:#999999;margin-bottom:1px;text-indent:10px;}-->
.on,a:hover{background:#000000;color:#FFFFFF;height:50px;margin-top:-20px;line-height:50px}
</style>
</head>
<ul>
<li>
  <div align="center"><a class="on" href="#">首  页  </a></div>
</li>
<li> <a href="#">今日新闻</a></li>
<li><a href="#">周边故事</a></li>
<li><a href="#">天气预报</a></li>
<li><a href="#">好书推荐</a></li>
</ul>
</html>


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值