CSS Reset style reset implementation example

CSS Reset style reset implementation example

Introduction: All browsers come with default styles that are applied to every page, called "user agent style sheets". (A ladder is required as follows)

Chromium UA stylesheet -Google Chrome & Opera

Mozilla UA stylesheet - firefox

WebKit UA stylesheet - Safari

Although most of them are the same, there are also many styles that are inconsistent, such as the search input box

Therefore, we need to reset CSS processing, unify the differences between different browsers, confirm the starting standards developed by the team, and make up for the browser's "shortcomings".

html{
   /* Standard font size is OK, but will change dynamically if rem is used on mobile devices. */
  font-size:14px;
  /* Use the IE box model (personal choice, I usually set the width to be the actual size of the box, including padding and border) */
  box-sizing: border-box;
  
}

html,body{
   /* In some mobile browsers, when you click a link or clickable element, a translucent gray background will appear; */
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    /* Improve the scrolling experience on mobile devices*/
  -webkit-overflow-scrolling: touch;
  overflow-scrolling: touch;
   /* Same height as the browser window*/
  height: 100%;
}

body{
   /* Some backgrounds are light gray by default, so they are all set to pure white*/
  background: #fff;
   /* According to antd, don't use Microsoft YaHei in the company. It is not recommended to use rem fonts. */
  font:14px,-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Hiragino Sans GB','Microsoft YaHei',
  'Helvetica Neue',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'
   /* Make the font smoother */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

Remove the browser's default margin and padding, and delete some unnecessary tags yourself

body,
p,
h1,
h2,
h3,
h4,
h5,
h6,
dl,
dd,
ul,
ol,
th,
td,
button,
figure,
input,
textarea,
form,
pre,
blockquote,
figure{
margin: 0;
padding: 0;
}

a{
   /* Little hands */
  cursor: pointer;
   /* Cancel the default underline of the hyperlink */
  text-decoration:none;
   /* It is also done in antd, it depends on whether your team needs this style*/
  transition: color 0.3s ease;
}

ol,
ul{
   /* Remove the ugly style. */
  list-style:none     
}

Some properties of these nodes do not inherit the parent node style, so all inherit it and cancel the outline effect.

a,
h1,
h2,
h3,
h4,
h5,
h6,
input,
select,
button,
textarea {
font-family: inherit;
font-size: inherit;
font-weight: inherit;
font-style: inherit;
line-height: inherit;
color: inherit;
outline: none;
}

button,
input[type='submit'],
input[type='button'] {
 /*Clickable hand*/
cursor: pointer;
}
 /* Canceling the apperance of some browser numeric input controls can change the appearance of the controls. */
input[type='number'] {
-moz-appearance:textfield;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
margin: 0;
-webkit-appearance: none;
}
/**
 * Remove inner borders and padding in Firefox.
 */
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}
/**
 * Make hidden in HTML5 display correctly in IE10*/

[hidden]
  display: none;
}
template {
 /* Some browsers will display template, but the template tag is rarely used, so you can choose it yourself. */
display: none;
}


css reset address

We will continue to add more in the future, let’s join us, friends.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

<<:  Detailed description of HTML table border control

>>:  Example of creating a virtual host based on Apache port

Recommend

Analysis of the solution to Nginx Session sharing problem

This article mainly introduces the solution to th...

Detailed explanation of various methods of Vue component communication

Table of contents 1. From father to son 2. From s...

Detailed explanation of Nginx static file service configuration and optimization

Root directory and index file The root directive ...

Implementation of Nginx configuration of multi-port and multi-domain name access

To deploy multiple sites on a server, you need to...

Web Design Tutorial (5): Web Visual Design

<br />Previous article: Web Design Tutorial ...

Analysis of the differences between Iframe and FRAME

1. Use of Iframe tag <br />When it comes to ...

IE8 Developer Tools Menu Explanation

<br />This article has briefly explained the...

Ant designing vue table to achieve a complete example of scalable columns

Perfect solution to the scalable column problem o...

MySQL slow query optimization: the advantages of limit from theory and practice

Many times, we expect the query result to be at m...

Analysis of uniapp entry-level nvue climbing pit record

Table of contents Preface Hello World image Set b...

Detailed explanation of common methods of JavaScript arrays

Table of contents Common array methods pop() unsh...

Tutorial on customizing rpm packages and building yum repositories for Centos

1 Keep the rpm package downloaded when yum instal...

How to use crontab to add scheduled tasks in Linux

Preface The Linux system is controlled by the sys...