day01 css way of introducing basic selectors Advanced selectors reset.css file
A performance standard:. CSS
css: cascading style sheet: cascading style sheets
Role: modification of the structure of the page
1.css introduction of three ways:
1) inline style <p style = "color: red ; font-size: 30px"> Text </ p>
2).内接样式 <style type="text/css"> </style>
3). External style <link rel = "stylesheet" href = "./ index.css">
Priority three ways: the highest priority in the style of the line, and then inscribed and external, who maybe has written on the back of high priority who
外接js:<script type="text/javascript" src="./index.js"></script>
color: color of the font
font-size: font size
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="./index.css">
<style type="text/css">
span{
color: green;
font-size: 50px;
}
</style>
<script type="text/javascript" src="./index.js"></script>
</head>
<body>
<p style="color: red; font-size: 30px">bajieaishuishui</p> <span>八戒</span>
</body>
</html>
2.css substantially selector
1) The tag selector: direct tag name, chose all have in common
2) class selector: class name , chose all have in common, class write when you can have multiple separated by spaces
3) .id selector: #id name , there is a selection of properties
4). Wildcard selectors: with an asterisk: Select the page with all the tags do not work: Check that all is consumed with what? Reset.css reset styles
Li dots in front of the kill, plus attribute to the parent tag ul
list-style: none;
Remove a hyperlink fell below the line (Note: Other labels do not have to default without the underscore)
Decoration-text: none; ( Decoration decoration )
With a span fake hyperlinks, add color, underline, add a little hand
span{
color: blue;
text-decoration: underline;
cursor: pointer; # (Cursor: pointer)
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="./reset.css">
<style>
p{
color: red;
}
the {
list-style: none;
}
.active{
color: blueviolet;
}
.large{
font-size: 40px;
}
#p1{
color: yellow;
}
#p2{
color: green;
}
/**{*/
/*padding: 0;*/
/*margin: 0;*/
/*}*/
a{
text-decoration: none;
}
.baidu{
color: blue;
text-decoration: underline;
cursor: pointer;
}
</style>
</head>
<body>
<p id="p1">八戒爱谁谁</p>
<p>八戒爱谁谁1</p>
<p id="p2">八戒爱谁谁2</p>
<p>八戒爱谁谁3</p>
<p>八戒爱谁谁4</p>
<ul>
<li class="active large">
bajie
</li>
<li>
大唐
</li>
</ul>
<ul>
<li class="active">
wukong
</li>
</ul>
<a href="http://www.baidu.com/">百度一下</a>
<span class="baidu">百度一下</span>
</body>
</html>
3.css的高级选择器
1).组合选择器: ul,ol 多个选择器,逗号分隔
2).重置input样式,先隐藏边框,再设置边框 (外边距: margin, 内边距: padding, 边框: border)
input{
border: none; /*隐藏边框 nono换成 0 也可以 */
/*width: 100px;*/ /*如果不设置宽高, 就自适应前面字体的宽高*/
/*height: 30px;*/
border: 1px solid red; /*自定义边框, 宽度,样式,颜色三要素*/
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
ul,ol{
list-style-type: none;
}
input{
border: none;
/*width: 100px;*/
/*height: 30px;*/
font-size: 40px;
border: 1px solid red;
}
</style>
</head>
<body>
<ul>
<li class="active">
wukong
</li>
</ul>
<span class="baidu">百度一下</span>
<input type="text">
<ol>
<li>
one
</li>
<li>
two
</li>
</ol>
</body>
</html>
二.reset.css 文件
https://www.w3school.com.cn/ w3c标准的各种协议
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
内容总结
1.css
三种引入方式
行内样式> 内接样式, 外接样式
@import url()
link
基本选择器:
作用: 选中标签,设置属性
标签选择器
类名选择器
id选择器:未来与js有很大关联
通配符选择器
高级选择器:
组合选择器