CSS
属性选择器
E[attr]:只使用属性名,但没有确定任何属性值
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>练习</title>
<style type="text/css">
a[href]{
background-color: #CC6600;
}
</style>
</head>
<body>
<p>
<a href="">存在属性href才可以</a>
</p>
<p>
<a name="">存在属性href才可以</a>
</p>
</body>
</html>
E[attr=‘vaule’]指定属性名,并且指定该属性的属性值
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>练习</title>
<style type="text/css">
input[type=text]{
background-color: #CC6600;
}
</style>
</head>
<body>
<form action="" method="">
<input type="text" name="" id="" value="" />
<input type="textara" name="" id="" value="" />
</form>
</body>
</html>
E[attr~=‘value’]:指定属性名,并且具有属性值.此属性是一个词列表,中间以空格隔开.其中词列表中包含一个value词,而且等号前面个的’ ~ '不能省略
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>练习</title>
<style type="text/css">
[class~='first']{
background-color: #CC6600;
}
</style>
</head>
<body>
<ul>
<li class="first">属性值中存在或者含有first,需要空格分隔</li>
<li class="second">属性值中存在或者含有first,需要空格分隔</li>
<li class="third">属性值中存在或者含有first,需要空格分隔</li>
<li class="first second">属性值中存在或者含有first,需要空格分隔</li>
<li class="first third">属性值中存在或者含有first,需要空格分隔</li>
<li class="second third">属性值中存在或者含有first,需要空格分隔</li>
<li class="first second third">属性值中存在或者含有first,需要空格分隔</li>
</ul>
</body>
</html>
E[attr^=‘value’]:指定属性名,并且有属性值,属性值是以value开头的
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>练习</title>
<style type="text/css">
p[title^=good]{
background-color: #CC6600;
}
</style>
</head>
<body>
<p title="hello">属性开头必须是good</p>
<p title='goodmor'>属性开头必须是good</p>
<p title='Tgoodmor'>属性开头必须是good</p>
</body>
</html>
E[attr^=‘value’]:指定属性名,并且有属性值,属性值是以value结尾的
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>练习</title>
<style type="text/css">
p[title$=good]{
background-color: #CC6600;
}
</style>
</head>
<body>
<p title="hello">属性开头必须是good</p>
<p title='goodmor'>属性开头必须是good</p>
<p title='Tgoodmorgood'>属性开头必须是good</p>
</body>
</html>
E[attr|=‘value’]:指定属性名,并且属性值是value或’value-‘开头的值’zh-ch’
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>练习</title>
<style type="text/css">
[class|='second']{
background-color: #CC6600;
}
</style>
</head>
<body>
<ul>
<li class="first">属性值中存在或者含有first,需要空格分隔</li>
<li class="second">属性值中存在或者含有first,需要空格分隔</li>
<li class="third">属性值中存在或者含有first,需要空格分隔</li>
<li class="first-second">属性值中存在或者含有first,需要空格分隔</li>
<li class="first-third">属性值中存在或者含有first,需要空格分隔</li>
<li class="second-third">属性值中存在或者含有first,需要空格分隔</li>
<li class="first-second-third">属性值中存在或者含有first,需要空格分隔</li>
</ul>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>练习</title>
<style type="text/css">
div{
display: none;
} /* 有错误 */
[class|="blue"]{
display: block;
}
[class~='blue']{
display: block;
}
[class^='Red']{
display: block;
}
[class$='Green']{
display: block;
}
[class*='gre']{
display: block;
}
</style>
</head>
<body>
<div class="red-blue-green">支持[|=](连字符匹配)属性选择器</div>
<div class="red blue green">支持[~=](空白符匹配)属性选择器</div>
<div class="Red-blue-green">支持[^=](前缀匹配)属性选择器</div>
<div class="red-blue-Green">支持[$=](后缀匹配)属性选择器</div>
<div class="red-blue-green">支持[*=](子字符串匹配)属性选择器</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>练习</title>
<style type="text/css">
ul{
list-style: none;
}
li{
height: 100px;
width: 100px;
/* border: 1px solid #000; */
float:left;
}
a.button{
display: block;
float:left;
position: relative;
height: 25px;
width: 80px;
margin: 0 10px 18px 0;
text-decoration: none;
font-size: 12px;
font-weight: bold;
line-height: 25px;
text-align: center;
}
a.gray:hover,a.gray,a.gray:visited{
color: #555;
border-bottom: 4px solid #b2b1b1;
background-color: #eee;
background-color: linear-gradient(to top,#eee,#e2e2e2);
box-shadow: 1px 1px 0 #f5f5f5 inset;
}
a.gray:hover{
background-color: #e2e2e2;
background-color: -webkit-linear-gradient(to top,#e2e2e2,#eee);
}
a.button:before,a.button:after{
content: "";
position: absolute;
left: -1px;
height: 25px;
width: 80px;
bottom: -2px;
border-radius: 3px;
border: 1px solid #CBCBCB;
}
a.button:before{
height: 23px;
bottom: -4px;
border-top:0px ;
border-radius: 0 0 3px 3px;
box-shadow:0 1px 1px 0px #bfbfbf;
}
a.button{
border-radius: 3px;
}
a.button:active{
border: none;
bottom: -4px;
margin-bottom: 22px;
box-shadow: 1px 1px 0 #fff ,inset 0px 1px 1px rgba(0,0,0,0.3);
}
a.button:active:before,a.button:active:after{
border: 0;
box-shadow:none;
}
</style>
</head>
<body>
<ul>
<li><a href="" class="button gray">Download</a></li>
<li><a href="" class="button pink">Download</a></li>
<li><a href="" class="button green">Download</a></li>
<li><a href="" class="button turquoise">Download</a></li>
<li><a href="" class="button black">Download</a></li>
<li><a href="" class="button darkgray">Download</a></li>
<li><a href="" class="button yellow">Download</a></li>
<li><a href="" class="button purple">Download</a></li>
<li><a href="" class="button drakblue">Download</a></li>
</ul>
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>立体字体</title>
<style type="text/css">
ol{
list-style: none;
}
li:before{color: #f00;}
li{
counter-increment:a 1;
}
li:before{
content:counter(a)'. ';
}
li li{
counter-increment:b 1;
}
li li:before{
content:counter(a)"."counter(b)'. ';
}
li li li{
counter-increment:c 1;
}
li li li::before{
content:counter(a)'.'counter(b)'.'counter(c)'.';
}
</style>
</head>
<body >
<ol>
<li>一级列表1
<ol>
<li>二级列表1<ol>
<li>三级列表1</li>
<li>三级列表2</li>
</ol></li>
<li>二级列表2
<ol>
<li>三级列表1</li>
<li>三级列表2</li>
</ol>
</li>
</ol>
</li>
<li>一级列表2</li>
</ol>
</body>
</html>
div{
width:0px;
height: 0px;
border-top:50px solid red;
border-left:50px solid blue;
border-bottom:50px solid black;
border-right:50px solid yellow;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>你好
</title>
<style>
</style>
</head>
<body>
<script type="text/javascript">
// GO{
// a:300;
// demo:function(){
// }
// }
a=300;
function demo(e){
// Ao{
// e:function()
// c:function();
// a10;
// b:123
// }
function e(){}
arguments[0]=2;
console.log(e); //2
if(a){
var b=123;
function c(){
//猪都ok
}
}
var c;
a=10;
var a;
console.log(b); //undefined
f=123;
console.log(c); //undefined
console.log(a); //10
}
var a;
demo(1);
console.log(a);//300
console.log(f);//123
</script>
</body>
</html>