HTML
整体结构
声明 <!DOCTYPE html>
、head<head></head>
、body<body></body>
HTML的标签
开始标签、结束标签
<h1></h1>
<p></p>
……
标签的属性:
属性名、属性值
属性名一般有:style、id、name、class
例;<h1 style="color: red"></h1>
style="color: red"为标签的属性
其中style为属性名,color: red为属性值
由于我之前<h2 id=“233”>
,但在css样式设计时发现不可用这个id(233),猜测可能是命名有限制,果然:
官方给出的HTML中的ID的命名规范:
1、必须以字母 A-Z 或 a-z 开头
2、其后的字符:字母(A-Za-z)、数字(0-9)、连字符("-")、下划线("_")、冒号(“:”) 以及点号(".")
3、值对大小写敏感
CSS
3种层叠样式
- 内嵌样式
<h1 style="color: #c9394a">
- 内联样式
<style> h6{color: grey;} </style>
- 外联样式
<link rel="stylesheet" type="text/css" href="h3.css">
内联和外联都在head中
五种基本选择器
- 元素选择器 标签{}
- id选择器 #id{}(井号id)
- 类选择器 .类名{}(点类名)
- 属性选择器 [name=“属性名”]{}
- 通配符选择器 *{} 这个样式对all全体有效
案例代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>practice</title>
<style>
h6{
color: grey;
}
#box{
color: blue;
}
.cls{
color: orange;
}
[name="laoli"]{
color: green;
}
</style>
<link rel="stylesheet" type="text/css" href="h3.css">
</head>
<body>
<h1 style="color: #c9394a">This is a simple Practice!</h1>
<h2 id="box">This is a simple Practice!</h2>
<h3 >This is a simple Practice!</h3>
<h4 class="cls">This is a simple Practice!</h4>
<h5 name="laoli">This is a simple Practice!</h5>
<h6>This is a simple Practice!</h6>
</body>
</html>
h3.css
h3{
color:yellow
}
前后景
前景:color
后景:background-color
注意:即使背景为黑色,前景为白色,前景白色依旧会覆盖背景,因为不透明度为100%
宽度与高度
width:300px;
hight:100px;
px为像素
字体
- font-family(字体风格)
- font-size(大小)
- font-weight(粗细,值一般为100-900)
font-family:"微软雅黑",sans-serif;
font-size:48px;
font-weight:900;
阴影
text-shadow: #ff00de -1px 3px 0
-1px是水平偏移,负向左,正向右
-3px是垂直偏移,负向下,正向上
0是模糊度
案例代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
body{
background:url("1.jpg");
}
h1{
font-size:68px;
color:white;
text-shadow:-1px -3px #ff00de,0 0 20px #ff00de;
}
</style>
</head>
<body>
<h1>imooc</h1>
</body>
</html>
今日份前端学习笔记-2019.08.05虽然内容不是很多,但是好歹打了一遍算是又巩固了一遍,准备哪天累了就去混前端或测试。本部分理论学习来源于慕课网网,侵权删。代码和慕课有所不同,为个人练习时手打。
今天在KFC看了很久的小说的后果就是我现在熬夜把笔记打下来,flag还是要立,明天一定先搞点每日份笔记。还有就是求求自己做个人吧,快点把区块链的代码构思一下,任务还是要完成的。peace♥good night