CSS引入方式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<!--css的引入方式2-->
<!--<style>-->
<!--div {-->
<!--color: lightslategrey;-->
<!---->
<!--}-->
<!--</style>-->
<!--css的引入方式3-->
<link rel="stylesheet" href="03%20yuan.css">
</head>
<body>
<!--css的引入方式1-->
<!--<p style="color: red">一个p标签</p>-->
<p>一个p标签1</p>
<p>一个p标签2</p>
<p>一个p标签3</p>
<div>DIV</div>
<a href="">click</a>
<div>DIV</div>
</body>
</html>
基本选择器
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style>
/* 1 标签选择器*/
/*p{*/
/*color: red;*/
/*}*/
/* 2 id选择器*/
/*#p3 {*/
/**/
/*}*/
/* 3 class选择器*/
/*.c1{*/
/**/
/*}*/
/*4 通配选择器*/
/**{*/
/*background-color: red;*/
/*}*/
</style>
</head>
<body>
<p >p1</p>
<p>p2</p>
<p >p3</p>
<p >p4</p>
</body>
</html>
层级选择器
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style>
/*后代选择器*/
/*.c1 .c3{*/
/*color: red;*/
/*}*/
/*子代选择器*/
/*.c1>.c3{*/
/**/
/*}*/
/*毗邻选择器*/
/*.c1+p{*/
/*color: palevioletred;*/
/*}*/
/*兄弟选择器*/
/*.c1~p{*/
/*color: goldenrod;*/
/*}*/
/* 与条件选择器 */
/*span.d1{*/
/*background-color: palevioletred;*/
/*}*/
/*class可以拥有多个值,每个值通过空格隔开*/
/*.c1{*/
/*color: rebeccapurple;*/
/*}*/
/*.c2{*/
/*background-color: lightslategrey;*/
/*}*/
div,span{
color: red;
background-color: lightslategrey;
font-weight: 300;
}
</style>
</head>
<body>
<!--<div >-->
<!--<p >P1</p>-->
<!--<p>P3</p>-->
<!--<div>-->
<!--<span >span</span>-->
<!--</div>-->
<!--</div>-->
<!--<span>span</span>-->
<!--<p >P2</p>-->
<!--<p >P3</p>-->
<hr>
<!--<span>span2</span>-->
<!--<div >DIV</div>-->
<!--<span >span</span>-->
<hr>
<!--<div >DIV</div>-->
<hr>
<!--<div>DIV</div>-->
<!--<span>span</span>-->
</body>
</html>
属性选择器
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style>
[egon=‘e‘]{
color: red;
}
</style>
</head>
<body>
<div egon="egg">egg</div>
<span egon="egg">egg</span>
<div egon="alex">egg2</div>
<div alex="32">alex</div>
</body>
</html>
伪类选择器
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style>
span{
color: royalblue;
width: 300px;
height: 300px;
background-color: lightslategrey;
}
span:hover{
color: red;
}
.s1,.s2{
width: 100px;
height: 100px;
}
.s1{
background-color: grey;
}
.s2{
background-color: rosybrown;
}
.outer{
border: 1px solid red;
}
.outer:hover .s1{
background-color: royalblue;
}
.outer:before{
content: "hello world";
color: red;
}
</style>
</head>
<body>
<span>hello world</span>
<hr>
<div >
<div ></div>
<div ></div>
</div>
</body>
</html>
选择器的优先级
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style>
/*.p1{*/
/*color: lightslategrey;*/
/*}*/
/*#p1{*/
/*color: darkblue;*/
/*}*/
/*p{*/
/*color: goldenrod;*/
/*}*/
/*##########优先级#############*/
/*.c2 p{*/
/*color: red;*/
/*}*/
/*.c1 .c2 .c3 p{*/
/*color: goldenrod;*/
/*}*/
/*.c1 .c2 .c3 .c4{*/
/*color: palevioletred;*/
/*}*/
/*.c4{*/
/*color: saddlebrown!important;*/
/*}*/
/*###############与字体相关的样式:继承##################*/
.outer {
color: green;
}
body{
color: red;
}
</style>
</head>
<body>
<p >this is P</p>
<div >
<div >
<div >
<p style="color: green">P2</p>
</div>
</div>
<p>P1</p>
</div>
<hr>
<div >
<p>PPP</p>
<span>span</span>
</div>
</body>
</html>
文本属性操作
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style>
p{
color: #EE4000;
background-color: lightslategrey;
text-align: justify;
font-weight: 100;
font-style: italic;
}
a{
text-decoration: none;
}
div{
color: green;
}
.c1{
width: 200px;
height: 200px;
background-color: lightslategrey;
text-align: center;
}
.btn{
width: 50px;
height: 100px;
background-color: darkgray;
text-align: center;
line-height: 100px;
}
</style>
</head>
<body>
<p>hello world</p>
<div><a href="">click</a></div>
<div >DIV</div>
<div > > </div>
</body>
</html>
文本操作之verticle-align
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style>
img{
vertical-align: -200px;
}
</style>
</head>
<body>
<div><img src="qq.png" alt=""><b>egon</b></div>
</body>
</html>
背景属性操作
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style>
.c1{
border:1px solid red;
width: 100%;
height: 500px;
/**/
/*background-image: url("a.png");*/
/*background-repeat:no-repeat;*/
/*background-position: center center;*/
/*简写方式*/
background: no-repeat url("a.png") center ;
}
.c2{
border:1px solid green;
width: 40px;
height: 40px;
background: no-repeat url("egon.jpg") -198px -82px ;
}
</style>
</head>
<body>
<!--<div ></div>-->
<div ></div>
</body>
</html>
边框属性
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style>
.c1{
width: 300px;
height: 200px;
background-color:
知识推荐
- threejs学习笔记04---物体动
- HttpClient4.X发送Get请求的url参数拼接
- linux学习记录-----vsftpd文件上传(550 create directory operation failed)
- .1-浅析webpack源码之webpack.cmd
- 0基础手把手教你搭建webpack运行打包项目(未完待续)
- 修改PHP上传文件大小限制
- PHP密码的六种加密方式
- 认识HTML5的WebSocket
- CGI FASTCGI ??php-fpm
- Netscaler GSLB的主备数据中心解决方案
- 好久不见webmin
- PHP curl请求https遇到的坑
- NETGEAR 系列路由器命令执行漏洞简析
- 11.21 CSS学习-下午
- 树莓派.Raspberry Pi 3碰到"Unable to determine hardware version. I see: Hardware : BCM2835"错误的解决过程
- 计算机网络(NETWORK 部分二) 第5-6天
- js中的filter
- 千锋武汉HTML5培训学员一周内轻松收获13K高薪