day37 css
Performance Standards: CSS
css: cascading style sheet: cascading style sheets
Role: modification of the structure of the page
css introduction of three ways:
1. inline style
2. connected style within
3. External Style
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<! - add style ->
<link rel="stylesheet" href="./index.css">
<-! Inscribed style ->
<style type="text/css">
/*Selector*/
span{
color: green;
font-size: 50px;
}
</style>
<-! Connection js file ->
<script type="text/javascript" src="./index.js"></script>
</head>
<body>
<-! Inline style ->
<p style="color: red; font-size: 30px">bajieaishuishui</p>
<span>八戒</span>
</body>
</html>
css substantially selector
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="./reset.css">
<style>
/ * A tag selector: Select all there is' commonality * /
p{
color: red;
}
/ * Reset style: the front of a small dot kill * /
the {
list-style-type: none;
}
/ * Class selector 2: a class name: There are selected 'in common' * /
.active{
color: blueviolet;
}
.large{
font-size: 40px;
}
/*3.id选择器: id是唯一的不能重复: 选中的是""特性: 用#号来表示*/
#p1{
color: yellow;
}
#p2{
color: green;
}
/*4.通配符选择器: 用*号: 选中页面中所有标签. 在工作中不要用: 选中所有是有消耗的*/
/*一开始布局页面如果写css, 一定要重置, 不用这个, 用别人写好的重置库, 写到reset.css文件里, 用link链接进来*/
/**{*/
/*padding: 0;*/
/*margin: 0;*/
/*}*/
/*去掉a 超链接下面的下滑线(注:其他标签默认没有下划线不用去)*/
a{
text-decoration: none;
}
/*用span伪造一个超链接,加颜色, 加下划线, 加小手*/
.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>
<!-- class 可以用多个名字, 用空格隔开 -->
<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>
css的高级选择器
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
/*组合选择器: */
ul,ol{
list-style-type: none;
}
input{
/*border none隐藏边框*/
border: none;
/*如果不设置宽高, 就自适应前面字体的宽高*/
/*width: 100px;*/
/*height: 30px;*/
/*自定义边框, 高, 宽, 样式三要素*/
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>
(外边距: margin, 内边距: padding, 边框: border)
https://www.w3school.com.cn/ w3c标准的各种协议
reset.css
/* 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;
}