Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

a collection of html5-css3 interview questions


May 30, 2021 Article blog


Table of contents


New features of CSS3

1.css3 implements fillets (border-radius), shadows (box-shadow), border-image

2. Add special effects (text-shadow), linear gradient, rotation (transform) to the text

3 Pairs of background map size modifications (background-size)

4. Added more CSS selectors multi-background rgba

5. The only pseudo-elements introduced in CSS3 are ::select, which is used to change the color of the text and the background color of the text when selecting the Chinese book

6. Media inquiries, multi-column layout

What are the new features of html5 and what elements have been removed?

New features:

1. Drag and drop API
2. Better semantic content tags (header, nav, footer, aside, article, section)

3. Audio and video API (audio, video)

4. Canvas API

5. Geolocation API

6. Local offline storage of localStorage long-term storage data, browser closed data is not lost

7. SessionStorage's data is automatically deleted after the browser is closed

8. Form controls, calendar, date, time, email, url, search

9. New technology webworker, websocket, geolocation

Removed elements:

1. Pure performance elements: basefont, big, center, font, s, strike, tt, u;

2. Elements that negatively affect availability: frame, frameset, noframes;
What is the difference between local storage and cookies (data stored on a user's local terminal)?

Cookies: both the server and the client can access;

Local storage: Only the local browser side has access to the data, and the server cannot access the local storage until it is sent to the server through a POST or GET channel;

How do I communicate between multiple tabs in my browser?

Call localstorge, cookies, and other local storage methods

How do you optimize your site's files and resources?

File Merge File minimization/file compression Use CDN to host the use of caches


What is responsive design?

It's about making web pages that allow different devices to have different sizes and different functions. A responsive design is designed so that everyone can make the site work on these devices


What is the use of HTML5 Canvas elements?

Canvas elements are used to draw graphics on Web pages, and the powerful thing about this element tag is that they can be graphically manipulated directly on HTML.


Please use CSS to implement: a rectangular content, there is projection, there are fillets, hover state slowly become transparent

<!DOCTYPE html>
<html >
<head>
  <meta charset="UTF-8">
  <title>CSS实现:一个矩形内容,有投影,有圆角,hover状态慢慢变透明</title>
  <style>
      body {
          margin: 0;
          padding: 0;
      }

      .a {
          width: 200px;
          height: 100px;
          border-radius: 10px;
          box-shadow: 10px 10px 5px #888888;
          background-color: aqua;
          transition: 2s;
      }

      .a:hover {
          opacity: 0;
      }
  </style>
</head>
<body>
<div class="a">
</div>

</body>
</html>

How do you achieve the page design, how do you think the front end should be high-quality work? How is a full-screen "product" word layout designed?

First divided into head, body, foot... Implementing an effect map is the most basic work, accurate to 2px; Communication with designers, product managers and project participation Do a good job of page structure, page refactoring and user experience Process hacks, compatible, and write beautiful code formats

Describe the difference between progressive enhancement and elegant degradation

Progressive enhancement enhancement: Build pages for lower-version browsers to ensure the most basic features, and then improve and append features for advanced browsers for a better user experience.

Elegant downgrade graceful degradation: Build the full functionality from the start and then make it compatible with lower-end browsers.

Difference: Elegant degradation begins with a complex status quo and attempts to reduce the availability of user experience, while incremental enhancements start with a very basic, functional version and are constantly expanding to meet the needs of the future environment. Degradation (functional attenuation) means looking back, while incremental enhancement means looking forward while keeping its roots safe.

Why is it more efficient to use multiple domain names to store site resources?

CDN caching is more convenient

Break through browser concurring limits

Save cookie bandwidth

Save the number of connections to the primary domain name and optimize page responsiveness

Prevent unnecessary security issues

Would you please describe the difference between cookies, sessionStorage and localStorage?

SessionStorage is used to store data from a session locally that can only be accessed by pages in the same session and destroyed when the session ends. T herefore, sessionStorage is not a persistent local store, but only session-level storage. LocalStorage is used for persistent local storage, and data never expires unless it is actively deleted

The difference between a web storage and a cookie

Web Storage has a similar concept to cookies, except that it is designed for larger storage capacity. The size of the cookie is limited, and every time you request a new page, the cookie is sent in the past, which is an invisible waste of bandwidth, and the cookie also needs to specify a scope that cannot be called across domains.

In addition, Web Storage has setItem, getItem, removeItem, clear and other methods, unlike cookies that require front-end developers to encapsulate setcookes, getCookies themselves. But cookies are also indispensable: they interact with the server and exist as part of the HTTP specification, and Web Storage is born to "store" data locally.