Introduce reset.css reset style sheet method into vite project

Method 1: Download the reset.css style sheet and then import it for use

① Download style sheet content

Download address: https://meyerweb.com/eric/tools/css/reset/

The contents of the reset.css file are as follows:

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    
    
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    
    
	display: block;
}
body {
    
    
	line-height: 1;
}
ol, ul {
    
    
	list-style: none;
}
blockquote, q {
    
    
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    
    
	content: '';
	content: none;
}
table {
    
    
	border-collapse: collapse;
	border-spacing: 0;
}

Create a new reset style sheet file "reset.css" in the project and copy the above content into the file

②Introduce the reset style sheet in the “main.ts” file

Import the "reset.css" file into the "main.ts" file:

import './assets/reset.css'

As shown below:

Insert image description here

Method 2: Install the style sheet through a plug-in, and then introduce it for use

① Install the reset style sheet plug-in - - - "npm i reset-css"

Run the installation command under the project to install the "reset-css" plug-in

npm i reset-css

As shown in the figure:
Insert image description here
after installation, you can see the record in the "package.json" file:

Insert image description here

②Introduce the reset style sheet in the “main.ts” file

import 'reset-css'

as the picture shows:
Insert image description here

Tip:
After installing the 'reset-css' plug-in, you can view the reset style sheet information under the "node_modules" folder. As follows:
Insert image description here
Insert image description here

Guess you like

Origin blog.csdn.net/qq_39111074/article/details/132740154