web前端开发基础知识
1.html
html是超文本标记语言,是构成网页的基本语言。
html标签
<html>
<head>
<title>网页标题</title>
</head>
<body>
<h1>标题</h1>
<p>段落</p>
</body>
</html>
2.css
css是层叠样式表,是用于描述HTML文档外观和格式的样式表。
css选择器
<style>
h1 {
color: red;
}
</style>
HTML5基础
文本标记
1.实现段落与段内换行
<p>段落</p>
<p>段落<br>段落</p>
2.实现标题
<h1>标题</h1>
<h2>标题</h2>
<h3>标题</h3>
3.文字居中
<center>文字</center>
4.文字加粗
<b>文字</b>
5.文字倾斜
<i>文字</i>
6.文字下划线
<u>文字</u>
7.文字删除线
<del>文字</del>
8.文字上标
<sup>文字</sup>
9.文字下标
<sub>文字</sub>
10.设置文字段落的缩进
<blockquote>文字</blockquote>
HTML标记与HTLM属性
align属性
<p align="center">文字</p>
bgcolor属性
<p bgcolor="red">文字</p>
字体大小颜色 <font size="5" color="red">文字</font>
网页中使用图片<img src="image.jpg" alt="图片">
网页中使用超链接<a href="https://www.baidu.com">链接</a>
CSS3基础
基本的CSS选择器
标记选择器
<style>
p {
color: red;
}
</style>
类别选择器
<style>
.red {
color: red;
}
</style>
ID选择器
<style>
#red {
color: red;
}
</style>
后代选择器
<style>
.red p {
color: red;
}
</style>
在HTML中使用CSS的方法
行内样式
<p style="color: red;">文字</p>
内嵌式
<style>
p {
color: red;
}
</style>
链接式
<link rel="stylesheet" href="style.css">
导入样式
<style>
@import "style.css";
</style>
各种方式的优先级问题
行内样式>内嵌样式>链接样式>导入样式