DAY1
案例1 01.CSS的语法.html
<!DOCTYPE html>
<html>
<head>
<meta charset ="utf-8">
<title>Doucment</title>
<style>
p{
color:red;
}
h2{
color:blue;
}
</style>
</head>
<p>CSS从入门到精通</p >
<h2>主讲:hector</h2>
<body>
</body>
</html>
案例2 02.CSS应用样式.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
/* 1.内部样式 */
p{
color:red;
}
</style>
<!-- 外部样式 link标签链接样式文件 -->
<link rel="stylesheet" type="text/css" href="hello.css">
<!-- 外部样式 @import导入样式文件 -->
<style>
@import "hello.css";
/* @import url(style/hello.css); */
</style>
</head>
<body>
<p>welcome to css!</p>
<p>欢迎来到css课堂!</p>
<!-- 2.行内样式 -->
<h2 style="color:blue">WEB前端工程师</h2>
<h2>JAVA开发工程师</h2>
<div>嘿嘿</div>
<div>哈哈</div>
</body>
</html>
案例3 03.CSS基础选择器.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
/* 1.标签选择器 */
p{
color:red;
font-size:20px;
}
h2{
color:yellow;
}
/* 2.类选择器 */
.hello{
background:#cccccc;
}
.world{
font-weight:bold;
}
#heihei{
color:blue;
}
</style>
</head>
<body>
<!-- 给p标签中的内容设置样式 -->
<p>welcome to css!</p>
<p>hello world!</p>
<h2>WEB前端开发</h2>
<h3>JAVA开发</h3>
<hr>
<!-- 我只想修改第一个p标签 -->
<p class="hello">welcome to css!</p>
<p>hello world!</p>
<h2>WEB前端开发</h2>
<h3>JAVA开发</h3>
<!-- 只要应用了hello这个类选择器就生效 -->
<div class="hello">主讲</div>
<!-- div既要有背景颜色,也要加粗 -->
<div class="hello world">主讲</div>
<span>CSS从入门到精通!</span>
<hr>
<h1 id="heihei">嘿嘿</h1>
</body>
</html>
案例4 04.复杂选择器.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
/* 1.标签选择器与类选择器结合起来---复合选择器 */
h1.aaa{
color:red;
}
/* 2.标签选择器和ID选择器结合起来---复合选择器*/
p#bbb{
color:blue;
}
/* 2.组合选择器 */
/* 分开书写 */
h1,p,div,span,.ccc{
font-size:30px;
}
div{
background:#cccccc;
}
span{
font-size:30px;
}
.ccc{
font-weight:bold;
}
/* 3.嵌套选择器 */
div>p{
color:green;
text-decoration: underline;
}
/* 对div内部的类选择器进行修饰 */
div h3.ddd{
color:pink;
}
</style>
</head>
<body>
<!-- -->
<h1 class="aaa">welcome</h1>
<h4 class="aaa">css</h4>
<h1>hello</h1>
<hr>
<!-- 1.需求,修改ID为bbb的p标签 -->
<p id="bbb">world</p>
<p>html</p>
<h2 id="bbb">WEB开发</h2>
<hr>
<!-- 2.需求,将h1,pdiv,span中内容的字号设置为30像素 -->
<h1>hello</h1>
<p>html</p>
<div>WEB开发</div>
<span class="ccc">JAVA开发</span>
<hr>
<!-- 3.需求,设置div内部的p标签样式-->
<div>
<p>div内部的p标签</p>
<h3>div内部的h3标签</h3>
</div>
<hr>
<div>
<h2>
<p>div内部的h2标签内部的p标签</p>
</h2>
</div>
<hr>
<!--需求修饰div内部的h3 -->
<div>
<p>div内部的p标签</p>
<h3 class="ddd">div内部的h3</h3>
<p class="ddd">ppp</p>
</div>
</body>
</html>
案例5 05.伪选择器.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
/* a:link{
font-size:12px;
color:black;
text-decoration: none;
}
a:visited{
font-size:15px;
color:red;
}
a:hover{
font-size:20px;
color:red;
}
a:active{
font-size:40px;
color:green;
} */
a:link,a:visited{
font-size:13px;
color:#666666;
text-decoration: underline;
}
a:hover,a:active{
color:#ff7300;
text-decoration: underline;
}
/* 普通标签,也可以使用伪类选择器 */
p:hover{
cloor:red;
}
p:zctive{
color:blue;
}
</style>
</head>
<body>
<a href="02.CSS应用样式.html">IT教育,高教培训</a>
<p>CSS从入门到精通</p>
</body>
</html>
案例6 06.伪元素选择器.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
p:first-letter{
color:red;
font-size:30px;
}
p:first-line{
background:yellow;
}
p:before{
content:"嘿嘿";
}
p:after{
content:"哈哈";
}
</style>
</head>
<body>
<p>hello world</p>
<hr>
<p>
hello world <br>
welcome to css!
</p>
</body>
</html>
案例7 07.选择器的优先级.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<!-- <link rel="stylesheet" href="world.css"> -->
<style>
div{
font-size:20px;
color:red;
}
.hello{
font-weight:bold;
color:blue!important;
}
#world{
text-decoration: underline;
color:green;
}
p{
color:red!important;
}
</style>
<link rel="stylesheet" href="world.css">
</head>
<body>
<div class="hello" id="world" style="color:pink;">CSS从入门到精通</div>
<p>主讲:hector</p>
</body>
</html>
案例8 08.字体相关的属性.html
<!DOCTYPE html>
<html>
<head>
<meta charset ="utf-8">
<title>Doucment</title>
<style>
div{
font-size:39px;
}
p{
/* font-size:20px; */
/* font-size:80%; */
font-size:2em;
}
span{
font-size:1em;
}
span.hello{
/* font-size:80%; */
font-size:2em;
}
body{
font-size:62.5%;
}
#ddd{
font-size:3em;
}
ul li{
/* font-size:30px;
font-weight:500;
font-family:华文行楷,黑体,宋体;
font-style:normal; */
font:normal normal 20px 黑体,楷体,宋体;
}
</style>
</head>
<body>
<p>
CSS从入门到精通!
<span>主讲:高教培训</span>
</p>
<span id="ddd">主讲:hector</span>
<hr>
<div>
我的DIV
<p>
CSS从入门到精通!
<span>主讲:高教培训</span>
</p>
</div>
<hr>
<span class="hello">主讲:高教培训</span>
<hr>
<ul>
<li>嘿嘿</li>
</ul>
</body>
</html>
案例9 09.文本相关的属性.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
p{
color:red;
/* background-color:#0F0; */
/* background-color:rgb(0,255, 0); */
/* background-color:rgba(0, 255, 0, 0.5); */
background-color:#54d2c9;
line-height:50px;
text-align:center;
}
img{
vertical-align:middle;
}
div{
text-indent:30px;
}
span{
text-decoration: underline;
text-transform:capitalize;
letter-spacing:3px;
word-spacing:8px;
}
h3{
width:300px;
height:200px;
background-color:#CCCCCC;
white-space:nowrap;
overflow:hidden;
}
</style>
</head>
<body>
<p>welcome to CSS!</p>
<p>welcome to CSS!</p>
<p>welcome to CSS!</p>
<p>welcome to CSS!</p>
<hr>
<img src="../images/qq.jpg" alt="">
HTML和CSS很简单
<hr>
<div>&npsp; &npsp; welcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to css</div>
<div>welcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to css</div>
<hr>
<span>hello word!</span>
<hr>
<h3>welcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to csswelcome to css</h3>
</body>
</html>
DAY2
案例1 01.背景属性.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
/* div{
color:red;
background-color:#cccccc
background-color:transparent;
background-image:url(../images/heihei.gif);
background-repeat:no-repeat;
background-position:right top;
height:1000px;
background-attachment:fixed;
background:red url(../../images/heihei.gif)repeat-x 50px 100px;
} */
/* .cart{
width:30px;
height:30px;
background-color:CCC;
background-image:url(../../images/icon.gif);
background-color:transparent;
background-position:-160px -30px;
} */
</style>
<link rel="stylesheet" herf="css/style.css">
</head>
<body>
<div>
<p>welcome to CSSwelcome to CSSwelcome to CSS</p>
<p>welcome to CSSwelcome to CSSwelcome to CSS</p>
<p>welcome to CSSwelcome to CSSwelcome to CSS</p>
<p>welcome to: CSSwelcome to CSSwelcome to CSS</p>
</div>
<hr>
<p class="cart"></p>
购物车
</body>
</html>
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-i2LMUjWM-1586255360835)(.\images\day2\案例1.png)]
div{
color:red;
/* background-color:#cccccc */
/* background-color:transparent; */
/*background-image:url(../../images/heihei.gif);
background-repeat:no-repeat;
background-position:center;*/
background:red url(../../images/qq.jpg) repeat-x 30px 100px;
}
.cart{
width:30px;
height:30px;
background-color:#CCC;
background-image:url(../../images/icon.gif);
background-color:transparent;
background-position:-160px -30px;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pAwkOalt-1586255360836)(.\images\day2\案例1.1.png)]
案例2 02.列表属性.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
/* li{
list-style-type:disc;
} */
.first{
list-style-type:decimal;
}
.second{
/* list-style-type:square; */
list-style-image:url(../../images/male.gif);
}
.third{
list-style-type:circle;
list-style-position:inside;
}
.forth{
list-style:square url(../../images/female.gif) inside;
list-style:none;
}
.nav{
list-style:none;
/* float:left; */
}
.nav li{
list-style:none;
float:left;
width:50px;
}
</style>
</head>
<body>
<ul>
<li class="first">hello</li>
<li class="second">hello</li>
<li class="third">hello</li>
<li class="forth">hello</li>
</ul>
<hr>
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-HYK1EcTu-1586255360836)(.\images\day2\案例2.png)]
案例3 03.表格属性.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
table{
width:500px;
border:1px solid red;
border-collapse:separate;
}
td{
border:1px solid red;
}
</style>
</head>
<body>
<!-- table>(tr>td{td$}*4)*5 -->
<table cellpadding="0" cellspacing="0" >
<tr>
<td>td1</td>
<td>td2</td>
<td>td3</td>
<td>td4</td>
</tr>
<tr>
<td>td1</td>
<td>td2</td>
<td>td3</td>
<td>td4</td>
</tr>
<tr>
<td>td1</td>
<td>td2</td>
<td>td3</td>
<td>td4</td>
</tr>
<tr>
<td>td1</td>
<td>td2</td>
<td>td3</td>
<td>td4</td>
</tr>
<tr>
<td>td1</td>
<td>td2</td>
<td>td3</td>
<td>td4</td>
</tr>
</table>
</body>
</html>
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-TFoG6CPv-1586255360837)(.\images\day2\案例3.png)]
案例4 04.盒子模型.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
p{
width:250px;
background:#ccc;
}
.first{
/* border-top-color:red;
border-top-width:1px;
border-top-style:solid;
border-right-color:blue;
border-right-width:2px;
border-right-style: dashed;
border-bottom-color:green;
border-bottom-width:4px; */
/* border-top:1px solid red ;
border-bottom:2px dashed blue; */
/* border-color:red yellow blue green;
border-width:1px 2px 4px 6px;
border-style:solid dashed dotted double; */
border:1px dotted red ;
}
.second{
/* padding-top:15px;
padding-left:10px;
padding-bottom:20px;
padding-right:30px; */
/* padding:1px 2px 6px 4px; */
padding:5px;
}
</style>
</head>
<body>
<p class="first">welcome to html</p>
<p class="second">welcome to css</p>
<p class="third">welcome to java</p>
</body>
</html>
right-width:2px;
border-right-style: dashed;
border-bottom-color:green;
border-bottom-width:4px; /
/ border-top:1px solid red ;
border-bottom:2px dashed blue; /
/ border-color:red yellow blue green;
border-width:1px 2px 4px 6px;
border-style:solid dashed dotted double; /
border:1px dotted red ;
}
.second{
/ padding-top:15px;
padding-left:10px;
padding-bottom:20px;
padding-right:30px; /
/ padding:1px 2px 6px 4px; */
padding:5px;
}
</style>
welcome to html
welcome to css
welcome to java
```[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rytlCQeI-1586255360837)(.\images\day2\案例4.png)]