Clear and modify the CSS style that comes with Vue

When writing styles in the Vue project, I found that some strange styles and font colors always appeared. Later, I found that Vue’s own default CSS style was caused by it. Just modify the CSS style that comes with Vue.

  • First create a resetVueCSS.css file (other names are also available), then copy the code below and put the css file into the Vue project , I personally put it in the public directory

/**
 * 清除Vue自带的CSS样式
 */
 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,
 menu, nav, output, ruby, section, summary,
 time, mark, audio, video, input {
     margin: 0;
     padding: 0;
     border: 0;
     font-size: 100%;
     font-weight: normal;
     vertical-align: baseline;
 }
 
 /* HTML5旧浏览器的显示role重置 */
 article, aside, details, figcaption, figure,
 footer, header, menu, nav, section {
     display: block;
 }
 
 body {
     line-height: 1;
 }
 
 blockquote, q {
     quotes: none;
 }
 
 blockquote:before, blockquote:after,
 q:before, q:after {
     content: none;
 }
 
 table {
     border-collapse: collapse;
     border-spacing: 0;
 }
 
 /* 链接和按钮默认样式 */
 a,button {
     color: #000000;
     text-decoration: none;
     cursor:pointer;
     -webkit-backface-visibility: hidden;
 }
 
 li {
     list-style: none;
 }
 
 /* 滚动条大小 */
 ::-webkit-scrollbar {
     width: 5px;
     height: 5px;
 }
 
 /* 滚动条颜色和圆角角度 */
 ::-webkit-scrollbar-track-piece {
     background-color: rgba(0, 0, 0, 0.2);
     -webkit-border-radius: 6px;
 }
 
 ::-webkit-scrollbar-thumb:vertical {
     height: 5px;
     background-color: rgba(125, 125, 125, 0.7);
     -webkit-border-radius: 6px;
 }
 
 ::-webkit-scrollbar-thumb:horizontal {
     width: 5px;
     background-color: rgba(125, 125, 125, 0.7);
     -webkit-border-radius: 6px;
 }
 
 html, body {
     width: 100%;
 }
 
 body {
     -webkit-text-size-adjust: none;
     -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
 }
  • Then import the style into the main.js file in the Vue project to override the default style

import '../public/resetVueCSS.css'
//这个路径记得修改,因为我的resetVueCSS.css在public目录中才是这个路径,“..”代表上一级目录

Guess you like

Origin blog.csdn.net/Coin_Collecter/article/details/129628806