Wang's blog Wang's blog
首页
  • 前端文章

    • HTML教程
    • CSS
    • JavaScript
  • 前端框架

    • Vue
    • React
    • VuePress
    • Electron
  • 后端技术

    • Npm
    • Node
    • TypeScript
  • 编程规范

    • 规范
  • 我的笔记
  • Git
  • GitHub
  • VSCode
  • Mac工具
  • 数据库
  • Google
  • 服务器
  • Python爬虫
  • 前端教程
更多
收藏
关于
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

Wang Mings

跟随大神,成为大神!
首页
  • 前端文章

    • HTML教程
    • CSS
    • JavaScript
  • 前端框架

    • Vue
    • React
    • VuePress
    • Electron
  • 后端技术

    • Npm
    • Node
    • TypeScript
  • 编程规范

    • 规范
  • 我的笔记
  • Git
  • GitHub
  • VSCode
  • Mac工具
  • 数据库
  • Google
  • 服务器
  • Python爬虫
  • 前端教程
更多
收藏
关于
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • CSS

    • 常用css
    • sass用法
    • viewport详解
    • css各种布局
    • a标签小妙用
    • flex布局语法
    • CSS-function汇总
    • CSS变量的使用
    • css使用小技巧
    • css重置样式表
    • CSS之animation动画
    • 隐藏元素的方法
    • 项目上使用微标
    • CSS之transition过渡
    • flex布局案例-基础
    • flex布局案例-骰子
    • css模块化实现教程
    • Flex布局教程语法篇
    • 粘性定位sticky的用途
    • flex布局案例-圣杯布局
    • flex布局案例-网格布局
    • css实现滚动视觉差效果
    • flex布局案例-输入框布局
    • 伪元素表单控件默认样式重置
    • 水平垂直居中的几种方式-案例
    • 从box-sizing属性入手,了解盒子模型
    • 文字在一行或多行时超出显示省略号
    • 如何根据系统主题自动响应CSS深色模式
    • 「css技巧」使用hover和attr()定制悬浮提示-demo
    • 「布局技巧」图片未加载前自动撑开元素高度
  • Npm

  • Vue

  • HTML

  • Node

  • Yaml

  • React

  • 框架

  • 规范

  • Electron

  • JS演示

  • VuePress

  • JavaScript

  • TypeScript

  • 微信小程序

  • TypeScript-axios

  • 前端
  • CSS
wangmings
2022-07-19

css重置样式表

# css重置样式表

个人整理工作中常用的css重置样式,和一些样式解决方法,并写上了注释

html, body {
	height: 100%;
	/* 文字风格 Sans-serif 各笔画粗细相同,Serif 笔画粗细不同,monospace 等宽体,cursive草书,fantasy梦幻 */
	font-family: "Microsoft YaHei", sans-serif, "Helvetica Neue", Helvetica, Arial, "黑体", "宋体", Arial;
	-webkit-tap-highlight-color: transparent;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
  }
  body {
	font-size: 14px;
	color: #333;
  }
  
  /* 重置各标签的默认样式 */
  a, body, center, cite, code, dd, del, div, dl, dt, em, fieldset, figcaption, figure, footer, form,
  h1, h2, h3, h4, h5, h6, header, hr, html, img, input, label, legend, li, mark, ol, p, section, span,  textarea, time, td, th, ul {
	  margin: 0;
	  border: 0;
	  padding: 0;
	  font-style: normal;
	  box-sizing: border-box;
	  /*  自动换行 */
	  word-wrap:break-word;
	  /*  强制英文单词断行 */
	  word-break: break-all;
  }
  
  /*  设置标签为块级分类 */
  article,
  aside,
  details,
  fieldset,
  figcaption,
  figure,
  footer,
  header,
  main,
  nav,
  section {
	  display: block
  }
  
  /* 去除input标签的默认样式 */
  button, input, textarea {
	-webkit-appearance: none;
	font-family: "Microsoft YaHei", sans-serif, "Helvetica Neue", Helvetica, Arial, "黑体", "宋体", Arial;
	  border: 0;
	  margin: 0;
	  padding: 0;
	  font-size: 1em;
	  line-height: 1em;
	  outline: none;
	  background-color: transparent;
  }
  
  /*  禁止多文本框手动拖动大小 */
  textarea {
	  resize: none;
	  -webkit-appearance: none;
  }
  
  /* 去掉按下的阴影盒子 */
  input,
  textarea,
  a {
	  -webkit-tap-highlight-color: transparent;
  }
  
  /*  清除a标签下划线 */
  a,
  a:visited {
	  text-decoration: none
  }
  a:focus,
  a:active,
  a:hover {
	  outline: none;
  }
  
  /*  清除列表前面的点 */
  ol,
  li,
  ul {
	  list-style: none
  }
  
  /*  清除IE下图片的边框 */
  img {
	border-style: none;
	font-size: 0;
  }
  
  /*  解决chrome浏览器默认黄色背景问题 */
  input:-webkit-autofill,
  textarea:-webkit-autofill,
  select:-webkit-autofill {
	-webkit-box-shadow: 0 0 0 1000px #fff inset;
  }
  
  /*  设置默认滚动条样式 */
  ::-webkit-input-placeholder { color: #afbdcc; }
  :-moz-placeholder { color: #afbdcc; }
  ::-moz-placeholder { color: #afbdcc; }
  :-ms-input-placeholder { color: #afbdcc; }
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background-color: #f5f5f5; }
  ::-webkit-scrollbar-track-piece { background-color: #f5f5f5; border-radius: 6px; }
  ::-webkit-scrollbar-thumb { background-color: #cccccc; border-radius: 6px; }
  ::-webkit-scrollbar-corner { background-color: #f5f5f5; }
  ::-webkit-resizer { background-repeat: no-repeat; background-position: bottom right; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
编辑 (opens new window)
css使用小技巧
CSS之animation动画

← css使用小技巧 CSS之animation动画→

最近更新
01
theme-vdoing-blog博客静态编译问题
09-16
02
搜索引擎
07-19
03
友情链接
07-19
更多文章>
Theme by Vdoing | Copyright © 2019-2022 Evan Xu | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式