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

js implements the pop-up login box by clicking the pop-up window

This article shares the specific code of js to re...

Use jQuery to fix the invalid page anchor point problem under iframe

The application scenario is: the iframe page has n...

Steps to create your own YUM repository

To put it simply, the IP of the virtual machine u...

Move MySQL database to another disk under Windows

Preface Today I installed MySQL and found that th...

10 bad habits to avoid in Docker container applications

There is no doubt that containers have become an ...

HTML+CSS implementation code for rounded rectangle

I was bored and suddenly thought of the implementa...

Mysql sql slow query monitoring script code example

1. Modify my.cnf #The overall effect is that both...

Why developers must understand database locks in detail

1.Lock? 1.1 What is a lock? The real meaning of a...

Detailed explanation of Axios asynchronous communication in Vue

1. First, we create a .json file for interactive ...

Use tomcat to deploy SpringBoot war package in centos environment

Prepare war package 1. Prepare the existing Sprin...

Deploy Nginx+Flask+Mongo application using Docker

Nginx is used as the server, Mongo is used as the...

XHTML Getting Started Tutorial: Using the Frame Tag

<br />The frame structure allows several web...

MySQL 8.0.20 installation tutorial and detailed tutorial on installation issues

Original address: https://blog.csdn.net/m0_465798...