61,129
社区成员




#mainBox #topBanner #menu
{
display:table;
width:auto;
height:100%;
float:left;
}
CSS:
#mainBox{
display:block;
margin-left:auto;
margin-right:auto;
width:940px;
}
#mainBox #topBanner{
display:none;
width:100%;
height:30px;
background:url("res/bannerBg.png") repeat-x;
}
#mainBox #topBanner #logo{
width:230px;
height:100%;
float:left;
background:url("res/logo.png") no-repeat;
}
#mainBox #topBanner #menu{
width:auto;
height:100%;
float:left;
}
#mainBox #topBanner #menu a{
display:block;
padding:8px;
width:115px;
background:url("res/bigbtn.png") repeat-x;
color:#C6C5C8;
line-height:100%;
text-decoration:none;
float:left;
}
HTML:
<div id="mainBox">
<div id="topBanner">
<div id="logo"></div>
<div id="menu">
<a id="liveBtn" href="javascript:;" title="LIVE SHOW">LIVE</a>
<a id="playbackBtn" href="javascript:;" title="PLAY BACK">PLAY BACK</a>
<a id="setupBtn" title="SET UP" href="javascript:;">SETTINGS</a>
<a id="logoutBtn" title="LOG OUT" href="javascript:;">LOG OUT</a>
</div>
</div>
</div>
IE7:/*logo*//*btn1*//*btn2*//*btn3*//*btn4*/ <=====正常效果
IE8:/*logo*/
/*btn1*//*btn2*//*btn3*//*btn4*/ <=====下沉了30px
IE9:/*logo*/
#mainBox #topBanner{
display:none;
width:100%;
height:30px;
background:url("res/bannerBg.png") repeat-x;
}
display属性是通过JS来动态改变成block的。
#mainBox{
display:block;
margin-left:auto;
margin-right:auto;
width:940px;
}
#mainBox #topBanner{
display:none;
width:100%;
height:30px;
background:url("res/bannerBg.png") repeat-x;
}
#mainBox #topBanner #logo{
width:230px;
height:100%;
float:left;
background:url("res/logo.png") no-repeat;
}
#mainBox #topBanner #menu{
width:auto;
height:100%;
float:left;
}
那像这几个
mainBox ,topBanner ,menu,logo分别都是哪些属性呢?[/quote]
你贴的这些全部都是以 CSS ID 选择器 命名的样式名.
CSS ID 选择器 有以下属性
1.在一个 HTML文档中,ID 选择器仅仅会使用一次;
2.ID 选择器不能结合使用;
至于你的问题
那像这几个
mainBox ,topBanner ,menu,logo分别都是哪些属性呢?
这个是后代选择器的写法.所以是选择作为某元素后代的元素.比如logo,把他定义到DIV/SPAN上面,SPAN/DIV就用上了他
但后代选择器用ID来定义 又没有任何意义.
所以我说他这套命名是不太规范的(个人意见)
[/quote]
<!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=gb2312" />
<title>无标题文档</title>
<style type="text/css">
div{margin:5px;}
.t{background-color:#eee;width:200px;}
.t .y{background-color:#ccc;}
.t .y .o{background-color:#333;}
.t .i{background-color:#999;}
.t .i .o{background-color:#666;}
.t #z{background-color:#FF5151;}
.t #z #y{background-color:#000079;}
.t #m{background-color:#8600FF;}
.t #m #y{background-color:#642100;}
</style>
</head>
<body>
<div class="t">t
<div class="i">i
<div class="o">o</div>
</div>
<div class="y">y
<div class="o">o</div>
</div>
<div id="z">z
<div id="y">y</div>
</div>
<div id="m">m
<div id="y">y</div><!--个人感觉不规范的-->
</div>
</div>
</body>
</html>
个人感觉不规范原因
1.与W3C CSSID选择器标准冲突;
2.CSS选择器也有权重的.
#mainBox{
display:block;
margin-left:auto;
margin-right:auto;
width:940px;
}
#mainBox #topBanner{
display:none;
width:100%;
height:30px;
background:url("res/bannerBg.png") repeat-x;
}
#mainBox #topBanner #logo{
width:230px;
height:100%;
float:left;
background:url("res/logo.png") no-repeat;
}
#mainBox #topBanner #menu{
width:auto;
height:100%;
float:left;
}
那像这几个
mainBox ,topBanner ,menu,logo分别都是哪些属性呢?[/quote]
你贴的这些全部都是以 CSS ID 选择器 命名的样式名.
CSS ID 选择器 有以下属性
1.在一个 HTML文档中,ID 选择器仅仅会使用一次;
2.ID 选择器不能结合使用;
至于你的问题
那像这几个
mainBox ,topBanner ,menu,logo分别都是哪些属性呢?
这个是后代选择器的写法.所以是选择作为某元素后代的元素.比如logo,把他定义到DIV/SPAN上面,SPAN/DIV就用上了他
但后代选择器用ID来定义 又没有任何意义.
所以我说他这套命名是不太规范的(个人意见)
#mainBox{
display:block;
margin-left:auto;
margin-right:auto;
width:940px;
}
#mainBox #topBanner{
display:none;
width:100%;
height:30px;
background:url("res/bannerBg.png") repeat-x;
}
#mainBox #topBanner #logo{
width:230px;
height:100%;
float:left;
background:url("res/logo.png") no-repeat;
}
#mainBox #topBanner #menu{
width:auto;
height:100%;
float:left;
}
那像这几个
mainBox ,topBanner ,menu,logo分别都是哪些属性呢?