MindMap Gallery HTML5 mind map
Details of HTML5, including form validation, multimedia audio processing, Canvas, Svg, Web storage, drag-and-drop API, CSS3, etc.
Edited at 2020-12-26 23:31:37This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
HTML5
new features
Who is developing HTML5
IETF
W3C
WHATWG
More important HTML version
HTML4.01, HTML1.0, HTML5
HTML5 design goals
Is the next major version of the HTML standard: replacing HTML1.01, XHTML1.0 and HTML1.1
Designed to be as backwards compatible with existing browsers as possible
Designed to support multimedia on mobile devices
HTML5 role
Solve the problem of low compatibility between browsers
Solved the problem of unclear document structure
Solved the problem of limited functions of WEB applications
HTML5 minimal template
New Features - Semantic Elements
New Features - Enhanced form elements and attributes
New features - multimedia audio and video processing
New feature-Canvas canvas
New Features - SVG
New Feature-Geolocation
New feature - localized storage
Semantic elements
The concept of semantic elements
Structured according to content
Choose the right label
and developers can write better code
semantic meaning
Good for search engine optimization
Convenient device analysis
Follow unified standards
content structure separation
Good user experience
Semantic structural tags
header
The header element represents the head title (header) of the page or content block
Usually contains h1-h6 elements or hgrounp
There is no limit to the number of header elements on the page, you can have multiple
You can add a header element to each content block
hgroup
The hgroup element represents a grouping of titles for a page or block of content.
When an element has multiple levels, the element can put h1 to h6 elements into it
For example, the combination of the main title and subtitle of the article
If you only need one h1-h6 tag, don't use hgroup
footer
The footer element represents the bottom part of the page or content (footer)
Usually contains some basic information about the section (for example: author, related documents, copyright information, etc.)
If footer elements contain entire sections, they represent appendices, indexing similar information.
There is no limit on the number of footers. Except for the different content of the package, the rest is similar to the header.
nav
The nav element represents the navigation link area of the page and is used to define the main navigation part of the page.
Generally, it is only used in the main navigation part of the entire page. If it is not suitable, do not use the nav element.
section
The section element represents a section in the article or a block of the page
A paragraph refers to a topic-based division of an article, and a block refers to a grouping on a page.
Sections usually have titles
Although section in HTML5 will automatically downgrade h1-h6, it is best to downgrade them manually.
article, nav, and aside can be understood as special sections
So if you can use article, nav, and aside, don’t use section. If it has no practical meaning, use div.
article
article represents a self-contained piece of content within a document, page, or website
Its purpose is to allow developers to independently develop or reuse
For example, a forum post, a blog article, a user comment, an interactive widget
The article will have a title (usually in the header) and a footer.
If you nest an article inside an article, it means that the embedded article is related to the content outside it.
aside
The aside element is used to place ancillary information part of the main content
The content in aside is relevant information, tags, noun explanations, etc. related to the current article or as ancillary information part of the page or site, such as advertisements, other log links or other category navigation.
Notice:
Search engines attach great importance to h1, but the authority of title is higher than h1
form elements
datalist
Element specifies the output list of the selection field
This element can use the list attribute to create a set of list items as output box prompts
The list attribute specifies that the form or input field should have auto-complete functionality. For example:
output
The <output> element is used for different types of output, such as calculation or script output
meter
The <meter> element is similar to the <progress> element and can be used to display ticks instead of progress
Commonly used properties
min and max
value: Determine the measured value
low, high, optimal: optimal value
form properties
autocomplete
The autocomplete attribute specifies the autocomplete functionality that a form or input field should have.
When the browser starts typing in an autocomplete field, the browser should display the filled-in options in that field
The autocomplete attribute may be turned on in the form element and turned off in the input element.
novalidate
Attribute: boolean attribute
Form or input fields should not be validated when submitting form properties
Adding the novalidate attribute to the form element will not validate the output elements within the form.
autofocus
Input elements can be automatically gathered and are also a boolean attribute.
Elements with the autofocus attribute automatically gain focus when the page loads.
Note: When the page has multiple controls, the first element with this attribute will be focused.
Form related
form: Which form the element belongs to
formaction: the submission target address of the form
Specifies the URL of the file that handles the input control when the current form is submitted.
Note: Only valid for type="submit" and type="image"
formenctype: form encoding method
Specifies how form data is encoded when submitted to the server and the submission method is post.
Note: Only valid for type="submit" and type="image"
The formenctype attribute of the input element will override the formenctype attribute of the form.
value of formenctype
application, x-www-form-urlencodeed (default)
multipart/form-data
text/plain
formmethod: form submission method
formnovalidate: whether to activate form validation
The formmovalidate attribute overrides the novalidate attribute of the <form> element.
Note: The formnovalidate attribute can be used with type="submit".
input type
Basic usage of color:
for selecting colors
The color value selected by the user can be obtained through the value attribute of the color element.
Basic usage of number
Numeric types can only accept numeric types
The number type is used for well-known input fields and can also set character limit
Common properties
max
min
step: Specifies the legal number interval of the input field, the step size of increment or decrement
value: Specifies the default value of the output field
Basic usage of range
Used for input fields that should contain numeric values within a certain range, displayed as a slider bar
Common properties
max
min
value: default value
step: number interval
Basic usage of search
Used for search domains such as site search or Google search
Usually used to display more friendly on mobile devices
Basic usage of tel
Used to enter phone number
Usually more friendly when displayed on mobile devices
Basic usage of url
Input field containing URL address
When submitting the form, the value of the url field will be automatically verified.
How to use date input type
form validation
ValidateState object
ValidityState can be accessed through form controls
Verify constraints
valueMissing
Purpose: Ensure that the values in the form controls are filled in
Usage: Set the required attribute to true in the form control
typeMismatch
Make sure the control value matches the expected type
Specify the type attribute value of the form type
patternMismatch
Purpose: Verify whether the input is in a valid format according to the format rules set on the form control
Set the pattern attribute on the form control and assign appropriate matching rules
tooLong
Purpose: Avoid input values containing too many characters
Usage: Set the maxLength attribute on the form control
rangeUnderflow
Purpose: Limit the minimum value of numeric controls
Usage: Set the min attribute for the form control and give it the minimum allowed value
rangeOverFLOW
Purpose: Limit the maximum value of numeric space
Usage: Set the max attribute for the form control and give it the maximum allowed value
stepMismatch
Purpose: To ensure that the input value conforms to min, max and step settings
Usage: Set the step attribute for the form control and specify the increment of the value
customError
Purpose: Handle errors caused by explicit settings and calculations in application code
Usage: Call setCustomValidity(message) to put the form control into customError state
Example:
input.setCustomValidity("Custom Error")
To clear the error, call setCustomValidity("") on the control
Multimedia audio processing
Audioaudio
Three formats supported
MP3
Ogg
Wav
Grammatical structures
Common properties
src: URL of the playback file, which can be passed <source>
controls: Activate the default controls provided by each browser
autoplay: automatic play
loop: loop music after setting
preload: cache settings
duration: total duration
currentTimeCurrent play time
play>play
pause>pause
currentTime = 10; fast forward
currentTime-= 10; rewind
muted>mute
oncanplay: prompts that the video is ready to start playing
Case 1
Case 2
videovideo
Supported video formats and files
OGG: Contains Therora video and Vorbis audio codecs
MP4: Contains H.264 video and AAC audio codecs
Webm contains VP8 video and Ogg Vorbis audio codecs
Element properties:
src: used to read media files
autoplay: Set whether the video plays automatically
width and height attributes: set the width and height of the video
loop: loop playback
poster: used to set the video cover
preload: cache settings
Video common events:
progress: used to update the download progress of the media, which will be triggered periodically
canplaythrough: event that will be triggered when the media plays successfully
canplay: Regardless of the overall status, an event will be triggered as long as a certain playable frame is downloaded.
ended: triggered when the media reaches the end position
pause is called when the media is paused
Triggered when play media is playing
error: triggered when an error occurs during media playback
Example:
Canvas
Create Canvas
The canvas element creates a blank rectangular area on a web page
This area can be operated through API (JavaScript)
By default, canvas elements are created without borders or content.
getContext() method:
Purpose: Get the drawing context of the canvas. Through this shadow, you can use other APIs for drawing operations
Canvas drawing
Draw a rectangle
method:
fillRect(x,y,width,height)
Draw a solid rectangle
x, y specify the position of the upper left corner of the rectangle
width, height indicates the size of its dimensions
strokeRect(x,y,width,height)
Draw a hollow rectangle
clearRect(x,y,width,height)
Clears the elements in the area specified by the attribute, similar to an eraser
draw color
strokeStyle: declares the color of the shape line
fillStyle: declares the properties of the inner area of the shape
Gradient
Supported gradient effects include linear gradients and radial gradients
Gradient supports setting color turning points
grammar:
createLinearGradient(x1,y1,x2,y2): Create a linear gradient
createRadialGradient(x1,y1,r1,x2,y2,r2): Create ray gradient radial gradient
addColorStop(position,color):Specify gradient color
Draw text
Attributes:
font: similar to the font attribute of css
textAlign: text alignment method, the value can be left, right, center
textBaseline: text baseline, the value can be top, hanging, middle, alphabetic, bottom
method:
strokeText(text,x,y): Draw the outline of the specified text at position (x,y)
fillText(text,x,y): Similar to the previous method, the difference is that this method draws entity text
measureText(): Returns the size information of the pinned text
Draw shadow
Attributes:
shadowColor: the color of the shadow
shadowOffsetX: Determines the horizontal casting distance of the shadow
shadowOffsetY: Determines the vertical casting distance of the shadow
shadowBlur: blur effect
draw path
beginPath(); this method must be called before creating a path
closePath() closes the path and connects the last point to the origin with a straight line. If you want to keep the open path, you do not need to call this method.
stroke() draws a path as an outline shape
fill() draws the path as a solid shape
clip() sets the clipping area in the context
moveTo() moves the stroke to the specified position
lineTo(x,y): Draw a straight line connecting the current stroke position to the specified new position
rect(x,y,width,height) generates a rectangular path
arc(x,y,radius,startAngle,endAngle,direction):
Generate an arc or circle at the specified position, and the radius and arc are specified by attributes;
direction is a Boolean type, indicating clockwise or counterclockwise
linear path
Attributes:
lineWidth: Specifies the thickness of the line, the default value is 1.0
lineCap: Specifies the line endpoint shape
butt (default) adds a straight edge to each end of the line
round: Adds a rounded line pop to each endpoint of the line
squard: Adds a square line pop to each end of the line
lineJoin: Specify the shape of the intersection of two lines
round: Create rounded corners
bevel: Create a bevel
miter (default): creates sharp corners
miterLimit:
Used with lineJoin
When lineJoin is set to miter, it can be used to determine the extension range of the junction point you want to jump.
draw image
method:
drawImage(image,x,y);
drawImage(image,x,y,w,h);
Tile image:
Syntax: canvas.createPattern(image,type)
-image: image to be tiled
-type: tiling method
-no-repeat: No tiling
-repeat-x: Tile horizontally
-repeat-y: Tile vertically
Tiling in all directions
Cut element
clip();
This method is used to cut the path using
chart.js
Introduce chart.jswenjian
Create canvas element
Get canvas element
Create a chart
SVG
Two-dimensional graphics can be described in three ways:
Vector graphics, such as paths made of straight lines or curves
picture
text
Advantage:
Can be created and modified via a text editor
Can be searched, indexed, scripted or compressed
Can be printed with high quality at any resolution
Can be enlarged without loss of image quality
The difference between SVG and Canvas
SVG:
Not dependent on resolution
Support event handling
Best for applications with large rendering areas (such as maps)
Not suitable for games
Canvas
resolution dependent
Event handlers are not supported
Ability to save result images in phg or jpg format
Best for graphics-intensive games
Attributes:
Draw a rectangle with black edges and blue background
svg tag: used to embed svg images
x and y attributes; represent the coordinate values of the upper left point of the rectangle
stroke attribute: Indicates the border color of the rectangle
stroke-width: attribute indicates the border width of the rectangle
Element type:
rectangular element
Use the <rect> tag to create a rectangle
round element
Use the <circle> tag to create a circle
cx and cy define the x and y coordinates of the origin (if omitted, the circle center will be set to 0,0,)
The r attribute defines the radius of the circle
Ellipse element
Use the <ellipse> tag to create an ellipse
cx and cy define the x and y coordinates of the origin (if omitted, the circle center will be set to 0,0,)
The rx attribute defines the horizontal radius
The ry attribute defines the vertical radius
line elements
Use <line> to create lines
The x1 attribute defines the start of the line on the x-axis
The y1 attribute defines the start of the line on the y-axis
The x2 attribute defines the end of the line on the x-axis
The y2 attribute defines the end of the line on the y-axis
polyline element
Use <polyline> to create polylines
The points attribute is used to store the x- and y-axis coordinates of the starting point, vertex, and end point of the polyline.
polygonal element
Use the <polygon> tag to create polygons with at least three sides
The points attribute defines the x, y coordinates of each corner of the polygon.
text
Use the <text> tag to create text
Text in SVG can be selected, but text filled using the fillText() method in canvas cannot.
svgimage
Use the <image> tag to draw pictures
xlink:href=""Link image address
SVG Gaussian blur filter element
Use the <filter> tag to create filters
The id attribute of the filter tag can define a unique name for the filter
Filter effects are defined through the <feGaussianBlur> tag
<feGaussianBlur> tag stdDeviation attribute defines the degree of ambiguity
in="SourceGraphic" This part defines the creation effect of the entire image
Gradient element
linear gradient
Use the <linearGradient> tag to define a linear gradient
radial gradient
Use the <radialGradient> tag to define a radial gradient
WEB storage
Information must be used only during the session -sessionStorage
grammar:
setltem(key, value): Create an item with key-value pairs, and update the value if the primary key exists
getltm(key): Get the corresponding value based on the primary key
sessionStorage.setltem("uname","derek");
var uname =sessionStorage.getlten("uname);
delete data
removeItem(key); delete the specified item based on the primary key
clear(): Clear the entire storage space and delete all items
Information is stored for a long period of time and is determined by the user - localStorage
limitation:
Only IE8 and above versions support the localStorage attribute.
All browsers will convert the value of localStorage to string type
localStorage is not advisable in browser privacy mode
LocalStorage essentially reads strings. If too much content is stored, neicun will be consumed.
localStorage cannot be crawled by crawlers
Store JSON data:
Read JSON data
JSON.stringify(): Converts a JavaScript value (object or array) to a JSON string. If replacer is specified to be a function, the value can be replaced, or if replacer is specified to be an array, optionally only the specified properties.
parse(): used to parse JSON strings and construct JavaScript values or objects described by strings.
Drag and drop API
source element event
dragstart: triggered when the drag operation starts
drag: similar to mouseover, it is triggered when the element is dragged
dragend: triggered when dragging ends
draggable: Boolean type, determines whether it can be dragged
The target element triggers the event:
dragenter: triggered when the mouse enters the target element area for the first time
dragover: triggered when the object is dragged to the target object (repeated)
drog: Triggered when the source element is placed on the target object
dragleave: triggered when the source element leaves the target object
The above method needs to prevent the default behavior of the page through the e.preventDefault() function
CSS3
multiple columns
The column-count attribute specifies the number of columns by which the element should be separated
The column-gap attribute specifies the gap between columns
The column-rule attribute specifies the style between columns
Browser compatibility:
IE10 and Opera support multi-column attributes
Firefox requires the prefix -moz-
Chrome and Safair require the prefix -webkit-
Convert
The transform property applies a 2d or 3d transform to an element
Specify a set of transformation functions, the value is transform: none/transform-function
--transform-function: represents one or more transformation functions, separated by spaces.
--none: Default value, indicating that the element will not be converted
Transformation origin: The transform-origin attribute specifies the location of the element's transformation origin.
By default, the transformation origin is at the center of the element - or 50% of the X and Y axes
transform-origin: value/percentage/keyword
--One value: represents the position of all axes
--Two values: represents X axis Y axis
--Three values: represents the X-axis, Y-axis, and Z-axis
2D displacement
The translate() method moves the element from the current position to the x or y axis coordinates
translate(x) or translate(x, y)
Possible values
--numeric percentage
--Can also be a negative value
You can also use a single displacement function
--translateX(x)
--translateY(y)
2D zoom
The scale() method is used to change the size of the element
given width and height
scale(x) or scale(x,y)
When one parameter is used, the second parameter defaults to the first value.
Possible values
Default is 1
Zoom out: Numeric value from 0 to 1
Amplify; a value greater than 1
One-way scaling function
scaleX(x)
scaleY(y)
2D rotation
The rotate(xx deg) method is used to rotate the element angle size
2D Tilt
The skew() method is used to tilt the element
Based on the origin position, tilt at a certain angle around the X-axis and Y-axis
May change the shape of the element
skew(x) or skew(x,y), the value is the angle
You can also use the one-way slope function
skewX(x)
skewY(y)
3D conversion
perspective property
The perspective attribute defines the distance of the 3D element from the view, in pixels
When defining the perspective attribute for an element, the child elements get the perspective effect, not the element itself
Only affects 3D elements
3D displacement
3D displacement can change the position of the element on the Z axis
3D displacement mainly includes
translateZ(z)
translate3d(x,y,z)
3D properties
transform-style
value
flat: Default value, place child elements at the position of 2d elements, the current element is still a 2d element
preserve-3d: Turn the current element into a 3d element
3D zoom
scaleZ(z)
scale3d(x,y,z)
transition
Specify four elements
Specify transition attributes, such as background, color, etc.
Specify the time required for the transition
Specify the transition function, which is the speed at which it passes. methods etc.
Specify the transition delay time, indicating the time to start execution
transition-property
Subtopic 1
transition-
transition-timing-function
Syntax: transition-duration:function
Transition function:
ease: Default value, starts slow, becomes fast, then ends slow
linear: starts and ends at the same speed
ease-in: Start at a slow speed and accelerate the effect
ease-out: ends at a slow speed, deceleration effect
ease-in-out: Start and end at a slow speed, first accelerate and then decelerate
cubic-bezie
transition-delay:
Specifies when the transition effect begins
Syntax: transition-delay:s/ms;
animation
The animation property can create Falsh-like animations
Control every step of the animation with keyframes
Gradually change an element from one style to another
Implement complex animation effects
Animation sub-properties:
animation-name: Call animation, specifying the name of the keyframe that needs to be bound to the selector
animation-duration: The time required for the animation to complete a cycle, the value is seconds or milliseconds
animation-timing-function: Specifies the speed curve of animation
ease: Default value, starts slow, becomes fast, then ends slow
linear: starts and ends at the same speed
ease-in: Start at a slow speed and accelerate the effect
ease-out: ends at a slow speed, deceleration effect
ease-in-out: Start and end at a slow speed, first accelerate and then decelerate
animation-delay: Delay time before playback, the value is a numerical value, seconds or milliseconds
animation-iteration-count:play count
The value is a numeric value or infinite
infinite, means unlimited playback
animation-direction: animation playback direction
normal is the default playback, indicating normal playback
alternate means playing in turn, that is, the animation plays normally at 123 and plays backward at the even number 246
Audio/Video
Audio
mp3, ogg, wav
controls, loop, autoplay, src, preload
play(), pause(), timeupdate(), canplaythrough(), load(), error(), ended()
Dynamic attributes: paused(), play(), muted()
video
mp4, ogg, webM
controls, loop, autoplay, src, preload, width, height, poster
play(), pause(), timeupdate(), canplaythrough(), load(), error(), ended()
Dynamic attributes: paused(), play(), muted()
free theme