重置样式(scss)

本文详细描述了一种CSS重置和优化的代码,包括清除HTML元素的默认样式,如边距、内边距、字体样式等,以及实现文本溢出隐藏和隐藏滚动条的技巧。
摘要由CSDN通过智能技术生成
body,
div,
span,
p,
h1,
h2,
h3,
h4,
h5,
h6,
img,
del,
em,
strong,
b,
i,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
footer,
header,
nav,
section,
audio,
video,
textarea,
select,
a,
button,
hr {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

article,
aside,
footer,
header,
nav,
section {
  display: block;
}

ol,
ul,
li,
dl,
dt,
dd {
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6,
b,
strong {
  font-weight: normal;
}

html,
body {
  height: 100%;
}

body {
  color: #333;
  font-size: 14px;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, Helvetica, PingFang SC,
    Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
}

legend {
  color: #333;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

img {
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  background-color: transparent;
  cursor: pointer;
}
a:hover,
a:active,
a:focus {
  outline: none;
}

input,
button,
select,
option,
textarea {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  outline: none;
  border: none;
  vertical-align: middle;
  border-radius: 0;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
textarea {
  resize: none;
}
button,
label {
  cursor: pointer;
}
select::-ms-expand {
  display: none;
}

em,
i {
  font-style: normal;
  display: inline-block;
}

// 清除input[number]类型右边上下箭头
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
// 清除input[number]类型右边上下箭头,兼容火狐浏览器
input[type='number'] {
  -moz-appearance: textfield;
}

// 单行溢出隐藏
.one-txt-cut {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

// 两行溢出隐藏
.two-txt-cut {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

// 隐藏滚动条
.hideBar::-webkit-scrollbar {
  display: none;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值