CSS中reset.css初始化设置

13 篇文章 0 订阅
8 篇文章 0 订阅

这边是放置assets文件夹里面的css文件夹里面
在这里插入图片描述

/**
 * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
 * http://cssreset.com
 */
 
 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;
   font-weight: normal;
   vertical-align: baseline;
 }
 /* HTML5 display-role reset for older browsers */
 article, aside, details, figcaption, figure, 
 footer, header, hgroup, menu, nav, section{
   display: block;
 }
 ol, ul, li{
   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;
 }
  
 /* custom */
 a{
   color: #7e8c8d;
   text-decoration: none;
   -webkit-backface-visibility: hidden;
 }
 ::-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%;
   font-family: "Arial", "Microsoft YaHei", "黑体", "宋体", "微软雅黑", sans-serif;
   font-size: 14px;
 }
 body{
   line-height: 1;
   -webkit-text-size-adjust: none;
   -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
 }
 /*清除浮动*/
 .clearfix:before,
 .clearfix:after{
   content: " ";
   display: inline-block;
   height: 0;
   clear: both;
   visibility: hidden;
 }
 .clearfix{
   *zoom: 1;
 }
  
 /*隐藏*/
 .dn{
   display: none;
 }
 
 
/*
    Remove all the styles of the "User-Agent-Stylesheet", except for the 'display' property
    - The "symbol *" part is to solve Firefox SVG sprite bug
 */
 *:where(:not(html, iframe, canvas, img, svg, video):not(svg *, symbol *)) {
  all: unset;
  display: revert;
}

/* Preferred box-sizing value */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Reapply the pointer cursor for anchor tags */
a, button {
  cursor: revert;
}

/* Remove list styles (bullets/numbers) */
ol, ul, menu {
  list-style: none;
}

/* For images to not be able to exceed their container */
img {
  max-width: 100%;
}

/* removes spacing between cells in tables */
table {
  border-collapse: collapse;
}

/* Safari - solving issue when using user-select:none on the <body> text input doesn't working */
input, textarea {
  -webkit-user-select: auto;
}

/* revert the 'white-space' property for textarea elements on Safari */
textarea {
  white-space: revert;
}

/* minimum style to allow to style meter element */
meter {
  -webkit-appearance: revert;
  appearance: revert;
}

/* reset default text opacity of input placeholder */
::placeholder {
  color: unset;
}

/* fix the feature of 'hidden' attribute.
 display:revert; revert to element instead of attribute */
:where([hidden]) {
  display: none;
}

/* revert for bug in Chromium browsers
 - fix for the content editable attribute will work properly.
 - webkit-user-select: auto; added for Safari in case of using user-select:none on wrapper element*/
:where([contenteditable]:not([contenteditable="false"])) {
  -moz-user-modify: read-write;
  -webkit-user-modify: read-write;
  overflow-wrap: break-word;
  -webkit-line-break: after-white-space;
  -webkit-user-select: auto;
}

/* apply back the draggable feature - exist only in Chromium and Safari */
:where([draggable="true"]) {
  -webkit-user-drag: element;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 在 Vue 使用 highlight.js 设置行号的方法如下: 1. 安装 highlight.js 和 v-highlight.js Vue 插件: ``` npm install highlight.js v-highlight.js --save ``` 2. 在 main.js 引入 highlight.js 并注册 v-highlight.js 插件: ``` import hljs from 'highlight.js' import VueHighlightJS from 'v-highlight.js' Vue.use(VueHighlightJS, { languages: { js: hljs.javascript, html: hljs.xml, css: hljs.css } }) ``` 3. 在组件使用 v-highlight 指令,并设置 line-numbers 类名: ``` <template> <div> <pre v-highlight="code" class="line-numbers">{{ code }}</pre> </div> </template> <script> export default { data () { return { code: '<div>hello world</div>' } } } </script> ``` 4. 在 CSS 设置行号样式: ``` .line-numbers { position: relative; padding-left: 3.8em; counter-reset: linenumber; } .line-numbers > span { pointer-events: none; position: absolute; left: -3.8em; width: 3.2em; text-align: right; padding-right: 0.8em; counter-increment: linenumber; } .line-numbers > span:before { content: counter(linenumber); color: #999; } ``` 注意:如果要支持其它语言需要在第二步引入对应的语言高亮库。 ### 回答2: 在Vue使用highlight.js设置行号相对简单。首先,我们需要在项目安装highlight.js库。可以通过npm或yarn进行安装。安装完成后,我们可以在Vue的组件引入highlight.js。 ```bash npm install highlight.js ``` 然后,在Vue的组件引入highlight.js。 ```javascript import hljs from 'highlight.js'; import 'highlight.js/styles/monokai-sublime.css'; ``` 接下来,在Vue组件的mounted钩子函数进行highlight.js的初始化设置行号。 ```javascript mounted() { const codes = document.getElementsByTagName('code'); for (let i = 0; i < codes.length; i++) { const highlightCode = codes[i]; hljs.lineNumbersBlock(highlightCode); } } ``` 在HTML,我们可以使用`<code>`标签将需要高亮显示的代码包裹起来。示例代码如下: ```html <template> <div> <pre><code class="javascript">function helloWorld() { console.log('Hello World'); }</code></pre> </div> </template> ``` 最后,在组件的样式,我们需要为highlight.js设置一些样式。 ```css pre { padding: 10px; background-color: #f7f7f7; } code { font-size: 14px; color: #333; } ``` 这样,我们使用highlight.js设置行号的功能就完成了。当组件被渲染时,highlight.js会自动对`<code>`标签的代码进行高亮显示,并显示行号。 ### 回答3: 在Vue使用highlight.js设置行号需要进行一下几个步骤: 1. 首先,从highlight.js官方网站(https://highlightjs.org/)下载所需要的highlight.js插件文件。 2. 将下载得到的highlight.js插件文件放置到你的Vue项目的某个目录,比如/src/plugins/。 3. 在Vue项目的入口文件main.js导入highlight.js插件。可以使用import语句将highlight.js插件导入: ``` import hljs from 'path/to/highlight.js'; ``` 4. 接下来,在Vue组件需要使用行号的地方,可以使用`v-highlightjs`指令来设置行号。例如,如果你想要在一个`<pre>`标签的代码块设置行号,可以像下面这样使用指令: ``` <pre v-highlightjs> <code> // 在这里写你的代码 </code> </pre> ``` 5. 在Vue组件的`mounted`钩子函数调用highlight.js的初始化函数,以便在页面加载完成后自动设置行号。可以使用以下代码: ``` mounted() { hljs.initHighlighting.called = false; hljs.initHighlighting(); } ``` 6. 最后,在Vue组件的样式文件添加一些CSS样式来设置行号的显示。这是可选的,你可以根据自己的需求自定义样式。例如,可以使用以下样式: ``` pre [class*="hljs-line"] { position: relative; padding-left: 3.8em; counter-increment: linenumber; } pre [class*="hljs-line"]::before { content: counter(linenumber); position: absolute; left: 0.5em; color: #999; font-size: 0.8em; } ``` 以上就是在Vue使用highlight.js设置行号的步骤。通过这些步骤,你可以在Vue项目方便地使用highlight.js插件并设置行号来高亮显示代码。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值