Common HTML tags
-
a
Usage of labels -
a
The Role of labels- Jump to the external page.
- Jump to internal anchor point
- Switch to email or phone
a
Common attributes of the taghref
— > hyperlink, a link to a web page.- The url
- https://google.com
- http://google.com
- //google.com
- The path
/a/b/c
As well asa/b/c
index.html
As well as./index.html
- Pseudo agreement
- Javascript: code;
- Mailto: email
- Tel: mobile phone number
target
— > specify which window to open the hyperlink in.- The built-in name
_blank
— > Open on a new blank page._top
— > Open on the top-level page._parent
— > Opens in the parent window page, i.e. when the layer page is on a layer._self
— > is actually the default and opens on the current page.- Programmer naming
windows
thename
iframe
thename
download
— > Download hyperlinked web pages in theory. (No longer supported, not recommended)- role
- The problem
rel=noopener
— > Prevent bugs. (There is a specific explanation in JS)
a
the
href
The value ofThe first two are protocol access
This is unlimited access, the highest level, will jump automatically
Can automatically jump to the specified label, automatically fill in the email or mobile phone number, the user only need to confirm.
a
the
target
The value ofThis is an example of multi-layer nesting
Often used in conjunction with subsequent JS, the functions are described below.
If you have a name
windows.name
>
xxx
While the,
xxx
The window opens the page. If I don’t name it
xxx
Page,
windows.name
new
xxx
Page, and then open in this page.Can be specified to
iframe
Named page opens (digression: can implement Goobai page ~!) .
Instead of opening the page, download the page.
Not all browsers support it, especially mobile browsers.
-
img
Usage of labels -
img
The Role of labels- Make a GE request to display an image.
img
Common attributes of the tagalt
— > Ifsrc
If the load fails, the system displaysalt
After connect withsrc
The same.height
— > Set the image height. (Only set height, width is adaptive)width
— > Set the image width. (Width only, height is adaptive)src
— >source: network address, relative path, absolute path
img
Two important events in the tag JS
Listen to whether the picture is loaded successfully.- If the load is successful
onload
- If the load fails
onerror
Function is: can be saved when the picture load failure.
img
The tag is reactive
max-width: 100%;
The old Iphone5 can also view the full image
img
The label is
Replaceable element
-
table
Usage of labels -
Related labels
table
— > Table tagthead
— > Head of the tabletbody
— > table drivetfoot
— > end of tabletr
— >table raw, a row of the tabletd
— >table datath
— >table head, the head of a column
table
Only the common ones in the label can be
thead
.
tbody
.
tfoot
These three tags.
T’s are short for table.Note: if the first three tags are not written in order, the browser’s powerful error correction ability will automatically complete the code in order. (Bad habits)
The sample<table> <thead> <tr> <th></th> <th>Xiao Ming</th> <th>The little red</th> </tr> </thead> <tbody> <tr> <th>Chinese language and literature</th> <td>98</td> <td>95</td> </tr> <tr> <th>mathematics</th> <td>94</td> <td>99</td> </tr> </tbody> <tfoot> <tr> <th>Total score</th> <td>192</td> <td>194</td> </tr> </tfoot> </table> Copy the code
Related styles
table-layout
— > Usually has two Settingstable-layout: auto;
Automatic table layout algorithm for table layout. The width of tables and cells depends on what they contain.table-layout: fixed;
Table and column widths are set by the width of the table, and the width of a column is determined only by the first row cell.border-collapse
— > Cell border merge Settings.border-spacing
— > Cell border distance Settings.
-
- Other thoughts
-
A few notes
- Use a tool such as HTTP-server or parcel to preview the HTML file. In this case, the file where the service port is enabled is the root directory.
- Pseudo agreement
javascript:;
Can satisfy the A label of doing nothing. The iframe label
Built-in Windows. It’s rarely used. Some of the older systems are still in use. (Hard to use)border-collapse
andborder-spacing
It is often written to reset.css.- There are several tags that are commonly used but understood with subsequent CSS and JS
form
The label formactoin
— > make a page request, control which page is used, and use it with subsequent JS.autocomplete
– > on/off. Enter the content as prompted by the name value, so that users can enter the user name.method
— > controls whether pages are requested using GET or Posttarget
— > Control which page to submit to.onsubmit
Trigger on submissioninput
The tag lets the user enter content- type
type
:button
/checkbox
/email
/file
/hidden
/color
/number
/password
/radio
/search
/submit
/tel
/text
name
/autofocus
/checked
/disabled
/maxlength
/pattern
/value
/placedholder
onchange
Rewrite /onfocus
Focus /onblur
Out of focus- HTML5 added built-in features.
- Other Input Labels
select
+option
textarea
label
- Other tags
video
audio
canvas
svg
-
attribute
The event
-
attribute
other
The event
Note: generally do not listen to the onclick event, not easy to use.
The validatorNote: Be sure to check the documentation for compatibility of these labels.
These will be specially studied in combination with other follow-up courses.
Learning to feel
HTML tags are boring, but also combined with subsequent courses to deepen understanding. To sum up, I need to write the code myself and copy the excellent test answers of teachers or classmates. After passing, whether you forget HTML or not, you will need to spend more time studying related lessons in the future. These lessons are not independent, but interrelated, and the time allocated is sufficient to deal with the forgetting curve.
Common labels:
MDN_HTML5