Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2570844
  • 博文数量: 315
  • 博客积分: 3901
  • 博客等级: 少校
  • 技术积分: 3640
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-08 15:32
个人简介

知乎:https://www.zhihu.com/people/monkey.d.luffy Android高级开发交流群2: 752871516

文章分类

全部博文(315)

文章存档

2019年(2)

2018年(1)

2016年(7)

2015年(32)

2014年(39)

2013年(109)

2012年(81)

2011年(44)

分类: Web开发

2015-07-10 11:19:55

/////////////////////////////////////////////file...../start/////////////////////////


/**css第二课*selector2.css*/


/***
测试部分代码:
selector_span.html:
<!-- 外部css -->
<link rel="stylesheet" type="text/css" href="selector.css">
<link rel="stylesheet" type="text/css" href="selector2.css">
    
<span class="style1" id="scale_font">不能吃<span>辛辣</span>食物</span> </br> <!-- 内部css -->
<span class="style0 stylesecond">不能吃热性水果</span> </br> <!-- 外部css -->
*/


/**id选择器**/
#scale_font
{
 font-size: 50px; 
 color : red;
}
/**父子选择器**/
#scale_font span
{
 font-style : italic;
}


/**和scale_font有共同属性*/
#to_scale_font
{
 font-style : italic;
}


/**共同的属性可以一起设置**/
#to_scale_font, #scale_font span
{
 color : orange;
}


/****顺序问题**其实很好理解: 就像开发android一样,setText("xxx"),然后再setText("yyy")
一次,当然是最后一次生效啦!*


问题:  如果还有一个.style0在另一个css文件中,使用时同时:
<span class="style0 stylesecond">不能吃热性水果</span>;
那么到底选择谁?  这个主要是看你导入css的顺序决定的!
答案:【导入先后顺序决定】: <!-- 外部css -->
    <link rel="stylesheet" type="text/css" href="selector.css">
    <link rel="stylesheet" type="text/css" href="selector2.css">*/
.stylefirst
{
 color : red;
}


.stylesecond
{
 color : blue;
}


/////////////////////////////////////////////file...../end/////////////////////////






阅读(1295) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~