Table of contents
1. HTML:
1.1 Web standards:
First of all, why do we have web standards? The rendering engines of different browsers are different, resulting in different display effects for the same code we write in different browsers, and even typesetting problems. At this time, we make different browsers display the results according to the same standard, so that the display effect can be unified. This is the web standard.
Three components of web standards:
- HTML (structure)
- CSS (beautification)
- JavaScript ( action )
HTML is the hyperlink language used to display the elements and content of the page.
CSS controls page styles such as the appearance (color, size) and position of page elements.
Javascript controls the behavior of web pages.
1.2 Introduction to HTML:
HTML is a hypertext markup language, which is mainly used to implement static pages. The text, pictures, videos, sounds, tables, links, etc. we see on the page are all described by HTML language, and the hypertext in hypertext is beyond 'Text', you can set styles, display pictures, and play videos. HTML is composed of tags, giving different attributes to different tags can achieve colorful effects on web pages.
1.3 HTML tags:
1.3 HTML basic structure tags:
A web page is similar to an article: each page of an article has a fixed structure, such as: beginning, body, signature, etc... There is also a fixed structure in the web page, such as: whole, head, title, and body. The fixed structure in the webpage is to be described by the characteristic HTML tags
code:
<!-- 文档声明:使用的是HTML5 -->
<!DOCTYPE html>
<html lang="en">
<!-- 页面头部区域 -->
<head>
<!-- 字符集编码格式设置--uft-8(万国码)防止页面中文乱码 -->
<meta charset="UTF-8">
<title>Document</title>
</head>
<!-- 页面显示区域 -->
<body>
</body>
</html>
1.3.1 HTML common tags:
Tags are composed of < , > , / , English words or letters. And the English words or letters included in <> in the label are called the label name. Common labels are composed of two parts, which we call: double labels . The first part is called the start tag , the second part is called the end tag , and the content is wrapped between the two parts. A minority label consists of a part, which we call: a single label . Self-contained, unable to wrap content.
h series labelh1: level 1 headingh2: level 2 headingh3: Level 3 headingh4: Level 4 headingh5: Level 5 headingh6: Heading level 6Features:1. The text of the label is bold2. The text of the label has become larger, and the text from h1 to h6 has gradually decreased3. Each title occupies its own line
important point;
Generally, we only need one h1 tag for a page, because some search keywords are our h1 tags.
Paragraph tags:
Paragraph tags: p tag double tag <p>Features:1. There are gaps between paragraphs2. Each paragraph is on its own line
Newline label: br single labelFunction: force line break
Horizontal line labels:
Horizontal line label: hr label single labelFunction: divide the horizontal lines of different themes
Text formatting tags:
Text formatting tab: make the text have the formatting effects of bold, underline, italic, strikethrough text--><!-- First group --><b> Bold </b><u> Underline </u><i> 倾斜 </i><s> Strikethrough </s><br><!-- Second group: recommended, with stronger semantics --><strong> Bold </strong><ins> underline </ins><em> Tilt </em><del> Strikethrough </del>
image tag
Image tags: img single tagFunction: display a picture on a web pageAttributes:1. src : tell the browser which picture to displayAttribute value: path (if the picture and the current page are in the same level directory, just write the name of the picture directly at this time), in other directories of the picture, use the relative path relative to the file at this time, not the absolute path2 , alt : replace textThe text displayed when the image fails to load (for example: the path is wrongly written)3. title : Prompt textThe text displayed when the mouse hovers over the image4. width : the width of the picture5. height : the height of the picture
- Same-level directory: directly write: the name of the target file!
- Subdirectory: Write directly: folder name / target file name!
- Upper-level directory: directly under: ../target file name!
Audio label: audioAttributes:1. src: path2. controls: Playback controls3. autoplay: autoplay (some browsers do not support it)4. loop: loop playbackVideo label: videoAttributes:1. src: path2. controls: Playback controls3. autoplay: autoplay (not supported by some browsers) —— "write muted in Google Chrome to complete staticautoplay4. loop: loop playback
<audio src="./music.mp3" controls autoplay loop></audio>
<video src="./video.mp4" controls autoplay muted loop></video>
Link tags:
Hyperlink: a tag double tagFunction: Jump to the webpage after clickingAttributes:1. href: tell the browser which page to jump to after clickingValue: path1. External link: absolute path on the Internet2. Internal links: relative paths are recommended2. target: the opening method of the target web pageValue:1. _self: (default value) Jump in the current window, the original web page will be overwritten2. _blank: jump in a new window, and keep the original page
In addition to the above tags, we also have layout tags for the layout of the entire web page:
div tag: only one display per line (exclusive line, block-level element)span tag: one line can display multiple
unordered list <ul><!-- ul represents the whole of the unordered list --><!-- li represents each item in the unordered list -->ordered list <ol><!-- ol means the whole of the ordered list --><!-- li represents each item of the ordered list -->
sheet:
Display and data neatly in the form of row + column cells in the web page ,<!-- table means the whole table --><!-- tr represents each row of the table --><!-- td represents the cell of the table -->Other tags:
code:
<table>
<tr>
<td>姓名</td>
<td>成绩</td>
<td>评语</td>
</tr>
Notice:
Sometimes the table we create is very ugly and has two horizontal lines, you can use
border="1" style="border-collapse: collapse;"
modify
Merge tables:
Set for reserved cells: merge across rows ( rowspan ) or merge across columns ( colspan )
For the specific practice code of merging tables, you can see the production of personal resume
form:
The form effect of collecting user information is displayed on the webpage, such as: login page, registration pageTag name: input• The input tag can display different effects through different values of the type attributebutton button label:The button that the user clicks is displayed on the page
button type attribute value:
Notice:
1. The field name of the database to be submitted in the form, so that the database data can be obtained.
<!-- 2、密码框:password -->
密码:<input type="password" placeholder="请输入您的密码">
<!-- 3、单选框:radio -->
性别:
<input type="radio" name="sex" checked>男
<input type="radio" name="sex">女
2. We generally rarely use forms to submit data in this way because it is very unsafe and user data is easy to obtain.
select:
A drop-down menu form control that provides multiple options in a web pageLabel composition:select tag: the overall drop-down menuoption tag: each item of the drop-down menuCommon properties:selected : The default selection of the drop-down menu
Provides form controls that can enter multiple lines of textcols : Specifies the visible width of the text fieldrows : Specifies the number of visible rows in the text field