CSS格式化代码(国内各大网站)

本文介绍了京东、腾讯和百度各自对于CSS代码的格式化处理方式,详细阐述了不同平台的代码风格和规范。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

京东格式化CSS代码

/*京东格式化CSS代码*/
/*把所有标签的默认内外边距清零*/
* {
    margin: 0;
    padding: 0
}
/*em 和 i 斜体文字不倾斜*/
em,
i {
    font-style: normal
}
/*去掉li的小圆点*/
li {
    list-style: none
}

img {
    /*border: 0;照顾低版本浏览器 如果 图片外面包含了链接会有边框的问题 */
    border: 0;
    /*取消图片底部有空白缝隙的问题*/
    vertical-align: middle
}

button {
    /*当鼠标经过按钮时,鼠标变成小手*/
    cursor: pointer
}

a {
    color: #666;
    /* 取消链接下划线*/
    text-decoration: none
}

/*链接鼠标经过,改变颜色*/
a:hover {
    color: #c81623
}

button,
input {
    font-family: Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif
}

body {
    /*CSS3 抗锯齿*/
    -webkit-font-smoothing: antialiased;
    background-color: #fff;
    font: 12px/1.5 Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif;
    color: #666
}


/*自定义隐藏*/
.hide,
.none {
    display: none
}

/*自定义清除浮动*/
.clearfix:after {
    visibility: hidden;
    clear: both;
    display: block;
    content: ".";
    height: 0
}

.clearfix {
    *zoom: 1
}

腾讯CSS格式化代码

html {
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    font-size: 100px;
}

body {
    color: #fff;
    line-height: 1.5;
    font-size: 14px;
    font-family: 'PingFangSC-Regular', 'helvetica neue', tahoma, 'PingFang SC', 'microsoft yahei', arial, 'hiragino sans gb', sans-serif;
    -webkit-font-smoothing: antialiased;
}

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,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td {
    margin: 0;
    padding: 0;
}

button,
input,
optgroup,
select,
textarea {
    color: inherit;
    font: inherit;
    margin: 0;
    padding: 0;
    border: 0;
    background: 0;
}

button:focus,
input:focus,
optgroup:focus,
select:focus,
textarea:focus {
    /*设置没有文本修饰(默认也是none)*/
    text-decoration: none;
    /*移动端 当点击一个链接或者通过Javascript定义的可点击元素的时候,它就会出现一个半透明的灰色背景,这里设置颜色为黑色*/
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    /*去掉文本框获取焦点是的蓝色框*/
    outline: none;
}

textarea {
    /*去掉多行文本框拖拽功能*/
    resize: none;
}

img {
    border: 0;
    /*通过设置图片与文字底线对齐,来消除图片底部空白间隙*/
    vertical-align: bottom;
}

a {
    text-decoration: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    /*消除下划线*/
    outline: none;
}

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

ul,
li {
    /*清除列表小圆点*/
    list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-size: 100%;
    font-variant: normal;
}

/*clearfix 清除浮动*/
.clearfix:before,
.clearfix:after {
    content: "";
    display: table;
}

.clearfix:after {
    clear: both;
    overflow: hidden;
}

/*自定义清除边距类*/
.clear-p-t {
    padding-top: 0 !important;
}

.clear-margin {
    margin: 0 !important;
}

.clear-b-margin {
    margin-bottom: 0 !important;
}

.light {
    color: #0052D9;
}

.p-light {
    padding-left: 5px;
}

百度CSS格式化代码

blockquote,
body,
button,
dd,
dl,
dt,
fieldset,
form,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
input,
legend,
li,
ol,
p,
pre,
td,
textarea,
th,
ul {
    margin: 0;
    padding: 0
}

html {
    color: #000;
    overflow-y: scroll;
    overflow: -moz-scrollbars
}

body,
button,
input,
select,
textarea {
    font: 12px arial
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-size: 100%
}

em {
    font-style: normal
}

small {
    font-size: 12px
}

ol,
ul {
    list-style: none
}

a {
    text-decoration: none
}

a:hover {
    text-decoration: underline
}

legend {
    color: #000
}

fieldset,
img {
    border: 0
}

button,
input,
select,
textarea {
    font-size: 100%
}

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

img {
    -ms-interpolation-mode: bicubic
}

textarea {
    resize: vertical
}

.left {
    float: left
}

.right {
    float: right
}

.overflow {
    overflow: hidden
}

.hide {
    display: none
}

.block {
    display: block
}

.inline {
    display: inline
}

.error {
    color: red;
    font-size: 12px
}

button,
label {
    cursor: pointer
}

.clearfix:after {
    content: '\20';
    display: block;
    height: 0;
    clear: both
}

.clearfix {
    zoom: 1
}

.clear {
    clear: both;
    height: 0;
    line-height: 0;
    font-size: 0;
    visibility: hidden;
    overflow: hidden
}

.wordwrap {
    word-break: break-all;
    word-wrap: break-word
}

.s-yahei {
    font-family: arial, 'Microsoft Yahei', '微软雅黑'
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值