[Web前端技术教学]背景翻转菜单CSS测试.读XHTML及CSS源代码,回答问题

源代码

<!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 type="text/css">
<!--
ul {
list-style: none;
}
li {

	width: 160px;
	height: 58px;
	padding: 0 1px 0 2px;
	float: left;
 	background-image: url(BgPic/nobg01.gif); 
	background-repeat: no-repeat;
	background-position: 0 0;
}
a{
	display: block;
	height: 100%;
	width: 100%;
	overflow: hidden;
	line-height: 500px;
	background-image: url(BgPic/bg_menu.gif);
	background-repeat: no-repeat;
}
a.bg1 {
background-position: 0px 0;
}
a.bg2 {
background-position:0px -70px;
}
a.bg3 {
background-position: 0px -140px;
}
a.bg4 {
background-position: 0px -210px;
}
a:hover.bg1 {
background-position: -170px 0;
}
a:hover.bg2 {
background-position: -170px -70px;
}
a:hover.bg3 {
background-position: -170px -140px;
}
a:hover.bg4 {
background-position: -170px -210px;
}
-->
</style>
</head>
<body>
    <ul>
        <li><a class="bg1" href="#" target="_blank">美容健康</a></li>
        <li><a class="bg2" href="#" target="_blank">乐活情爱</a></li>
        <li><a class="bg3" href="#" target="_blank">原创专题</a></li>
        <li><a class="bg4" href="#" target="_blank">自媒体</a></li>
    </ul>
</body>
</html>

素材图片

上述 代码中访问的两个图片如下:

第一张图片:bg_menu.gif

第二个图片:nobg01.gif

浏览器最终预览效果:

动态页面测试

点击此处  http://www.cnblogs.com/exesoft/p/6158554.html  密码为:exesoft 

请回答以下问题:

1. a选择器中,display: block这个声明的目的是什么?如果没有这个声明,会发生什么?
2. a选择器中,height: 100%及width: 100%这两个声明有何目的?
3. a选择器中,overflow: hidden及line-height: 500px这两个声明有何目的?
4. ul选择器中,list-style: none 这个声明有何目的?
5. li选择器中,float: left 这个声明目的是什么?
6. 既然使用图片作为翻转菜单,为何还要在xHtml中a标签中承载:美容健康,乐活情爱等文字?
7. 请解释一下下方代码含义:
a:hover.bg2 {
background-position: -170px -70px;

8. 本CSS代码,在书写顺序上有何规律?

9.请解释css sprite技术的含义.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

gCodeTop 格码拓普 老师

您的鼓励.我的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值