Get the App
SLTechnology News&Howtos  ›  Development  › 

How css resets the browser default style

Shulou Source: shulou.com Published: 2022-06-03 05:41:51 11月18日 Update

This article mainly shows you "css how to reset browser default style", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "css how to reset browser default style" this article.

The code is as follows:

@ charset "utf-8"

/ *

@ name: base

@ function: reset browser default style

, /

/ * prevent the influence of user-defined background colors on web pages and add fonts that allow users to customize fonts * /

Html {

Color:black

Background:white

}

/ * the inner and outer margins usually make the performance position of each browser style different * /

Body,div,dl,dt,dd,ul,ol,li,h2,h3,h4,h5,h6,h7,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {

Margin:0

Padding:0

}

/ * Note that the form element does not inherit the parent font * /

Body,button,input,select,textarea {

Font:12px SimSun,tahoma,arial,sans-serif

}

Input,select,textarea {

Font-size:100%

}

/ * remove the margins of each Table cell and make their edges coincide * /

Table {

Border-collapse:collapse

Border-spacing:0

}

/ * IE bug fixed: th does not inherit text-align*/

Th {

Text-align:inherit

}

/ * remove the default border * /

Fieldset,img {

Border:none

}

/ * ie6 7 8 (Q) bug shows as inline performance * /

Iframe {

Display:block

}

/ * remove the border of this element under firefox * /

Abbr,acronym {

Border:none

Font-variant:normal

}

/ * consistent del style * /

Del {

Text-decoration:line-through

}

Address,caption,cite,code,dfn,em,th,var {

Font-style:normal

Font-weight:500

}

/ * remove the identity before the list, and li will inherit * /

Ol,ul {

List-style:none

}

/ * alignment is the most important factor in typesetting, don't let everything be in the middle * /

Caption,th {

Text-align:left

}

/ * from yahoo, let the title be customized to suit multiple system applications * /

H2,h3,h4,h5,h6,h7 {

Font-size:100%

Font-weight:500

}

Q:before,q:after {

Content:''

}

/ * unify superscript and subscript * /

Sub, sup {

Font-size:75%

Line-height:0

Position:relative

Vertical-align:baseline

}

Sup {

Top:-0.5em

}

Sub {

Bottom:-0.25em

}

/ * Let the link be underlined in hover * /

A:hover {

Text-decoration:underline

}

/ * No underlining is displayed by default to keep the page concise * /

Ins,a {

Text-decoration:none

}

/ * IE6,7 focal point line removal * /

AVOR focus focus focus

Outline:none

}

/ * clear float * /

.clearfix: before,.clearfix:after {

Content: ""

Display:table

}

.clearfix: after {

Clear:both

Overflow:hidden

}

.clearfix {

Zoom:1; / * for IE6 IE7 * /

}

.clear {

Clear:both

Display:block

Overflow:hidden

Height:0

Line-height:0

Font-size:0

}

/ * set show and hide, usually used to cooperate with JS * /

.hide {

Display:none! important

Visibility:hidden

}

.block {

Display:block! important

}

/ * set inline to reduce the bug caused by floating * /

.fl {

Float:left

Display:inline

}

.fr {

Float:right

Display:inline

}

The above is all the content of the article "how to reset the default style of css browser". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Style browser browse content article underline element user border learning help float different concise important consistent superscript subscript code location Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft NVidia Xiaomi Shulou Technology