This is the 8th day of my participation in the August More text Challenge. For details, see: August More Text Challenge
HTML Interview Manual
HTML 5 new features
- Video and Audio elements for media playback
- Local offline storage localStorage stores data for a long time without data loss after the browser is closed
- The data in sessionStorage is automatically deleted after the browser is closed
- Semantically better tags such as article, footer, header, nav, section, etc
- Device compatibility HTML5 provides an unprecedented open interface for data and application access
- New technologies Web Worker, WebSocket, Geolocation, add drag and drop API, drawing Canvas
Inline elements, block-level elements, and empty elements
- Inline elements:
span
.img
.input
.select
.a
.strong
Etc. - Block-level elements:
div
.ul
.li
.h1-5
.p
.dl
.dt
.dd
Etc. - Empty elements:
br
.hr
.link
.meta
Etc.
Site files and resources optimized
- File merge (reduced HTTP requests)
- File compression (reduce file download size)
- Use the cache
- Backlink, website outside the chain optimization
- Use CDN to manage resources
- Gzip compresses the required JS and CSS files
- Meta Tag optimization (
title
.description
.keywords
),heading
Tag optimization,alt
To optimize the
Page import CSS, use the difference between link and @import
link
Is an HTML tag, and@import
Is the CSS@import
There are compatibility issues, only available in IE5 and above, whilelink
No compatibility problem- When the page loads,
link
Will be loaded at the same time, and@import
The referenced CSS waits until the page is loaded link
Is heavier than@import
The weight of
The role of the label
The label defines the relationship between form controls. When the user selects the label, the browser automatically shifts the focus to the form controls associated with the label.
<label for="Name">Number:</label>
<input type="Text" name="Name" id="Name"/>
Copy the code
The difference between the title and Alt attributes of the tag
alt
To give text when the picture does not display properly.title
Property provides advisory information for the element on which it is set.
Benefits of semantic tags
- The removal or loss of style can give a clear structure to the page
- Convenient equipment parsing rendering web pages
- Is conducive to
SEO
, establish good communication with search engines, help crawlers to crawl more effective information: crawlers rely on tags to determine the context and the weight of each keyword
- Easy to team development and maintenance, semantic more readable
Multiple tabs within the browser communicate
Use localStorage methods, such as localStorage and cookies.
Pros and cons of iframe
Advantages:
- Can communicate across domains
- You can upload files without refreshing
- Solve the loading problem of third-party content
Disadvantages:
- Is not conducive to SEO
- The page will add server requests
- Blocks the Onload event on the main page
SRC is different from href
src
Replaces the current element; Href is used to establish a connection between the current document and the referenced resourcesrc
The location of an external resource that will be embedded in the document where the current tag is located. whilehref
Points to the location of a network resource and establishes a link between the current element (anchor) or the current document (link).
Why is it more efficient to have multiple domain names to store web resources
- save
cookie
Broadband; CDN
Caching is more convenient;- Breaking browser concurrency limits;
- Save the number of connections of the primary domain name, optimize the response speed under the page;
- Prevent unnecessary safety problems;
HTML5 Local Storage
HTML5 Web storage storage methods are: sessionStorage and localStorage.
sessionStorage
Used to store data locally in a session and is destroyed when the session ends.
localStorage
Local storage for persistence, where data never expires unless the user proactively deletes it;
cookie
Data stored locally by a web site to identify a user.
The difference between:
- In terms of the transfer between the browser and the server:
cookie
Data is always carried in the same source HTTP request, i.ecookie
Back and forth between the browser and the server; whilesessionStorage
andlocalStorage
It is stored locally and does not automatically send data to the server.
- Look from the size: Storage size limits are different,
cookie
Data cannot exceed4k
, only suitable for storing very small data; whilesessionStorage
andlocalStorage
There is also a storage size limit, but less thancookie
Much larger, up to 5M or more.
- From the data validity period:
sessionStorage
The session is closed immediately, so it does not last long.cookie
The cookie is valid until the set expiration time, even if the window or browser is closed. whilelocalStorage
It always works.
- In terms of scope:
sessionStorage
Not shared across different browser Windows, even the same page; whilelocalStorage
andcookie
Are shared across all the same origin Windows.
Common browser kernel
Browser/RunTime | Kernel (rendering engine) | JavaScript engine |
---|---|---|
Chrome | webkit->blink | V8 |
FireFox | Gecko | SpiderMonkey |
Safari | Webkit | JavaScriptCore |
Edge | EdgeHTML | Chakra(for JavaScript) |
IE | Trident | JScript (IE3.0 – IE8.0) |
Opera | Persto->blink | Linear A (4.0-6.1)/Linear B (7.0-9.2)/Futhark (9.5-10.2)/Carakan (10.5-) |
Node.js | – | V8 |
If this article helped you, please give it a like