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

A screenshot demo based on canvas in html

Written at the beginning I remember seeing a shar...

WeChat Mini Program Basic Tutorial: Use of Echart

Preface Let’s take a look at the final effect fir...

How to remotely connect to MySQL database with Navicat Premium

The party that creates a new connection is equiva...

Solution to MySQL remote connection failure

I have encountered the problem that MySQL can con...

Elements of user experience or elements of web design

System and user environment design <br />Th...

Summary of JavaScript JSON.stringify() usage

Table of contents 1. Usage 1. Basic usage 2. The ...

MySQL series: Basic concepts of MySQL relational database

Table of contents 1. Basic Concepts 2. Developmen...

IE8 browser will be fully compatible with Web page standards

<br />According to foreign media reports, in...

When the interviewer asked the difference between char and varchar in mysql

Table of contents Difference between char and var...

How to make spaces have the same width in IE and FF?

body{font-size:12px; font-family:"宋体";}...

Summary of MySQL common SQL statements including complex SQL queries

1. Complex SQL queries 1.1. Single table query (1...

jQuery implements Table paging effect

This article shares the specific code of jQuery t...