OOCN分享圈's Archiver

oocn 发表于 2017-2-10 14:04

10个CSS简写/优化技巧

CSS简写就是指将多行的CSS属性简写成一行,又称为CSS代码优化或CSS缩写。CSS简写的最大好处就是能够显著减少CSS文件的大小,优化网站整体性能,更加容易阅读。

下面介绍常见的CSS简写规则:

一、盒子大小
这里主要用于两个属性:margin和padding,我们以margin为例,padding与之相同。盒子有上下左右四个方向,每个方向都有个外边距:[code]1
2
3
4
margin-top:1px;
margin-right:2px;
margin-bottom:3px;
margin-left:4px;
你可以简写成:

1
margin:1px 2px 3px 4px;
语法 margin:top right bottom left;

1
2
3
4
5
6
7
8
//四个方向的边距相同,等同于margin:1px 1px 1px 1px;
margin:1px;
//上下边距都为1px,左右边距均为2px,等同于margin:1px 2px 1px 2px;
margin:1px 2px;
//右边距和左边距相同,等同于margin:1px 2px 3px 2px;
margin:1px 2px 3px;
//注意,这里虽然上下边距都为1px,但是这里不能缩写。
margin:1px 2px 1px 3px;
二、边框(border)

边框的属性如下:

1
2
3
border-width:1px;
border-style:solid;
border-color:#000;
可以缩写为一句:

1
border:1px solid #000;
语法 border:width style color;

三、背景(Backgrounds)
背景的属性如下:

1
2
3
4
5
background-color:#f00;
background-image:url(background.gif);
background-repeat:no-repeat;
background-attachment:fixed;
background-position:00;
可以缩写为一句:

1
background:#f00 url(background.gif) no-repeat fixed 0 0;
语法是background:color image repeat attachment position;
你可以省略其中一个或多个属性值,如果省略,该属性值将用浏览器默认值,默认值为:

color: transparent

image: none

repeat: repeat

attachment: scroll

position: 0% 0%

四、字体(fonts)
字体的属性如下:

1
2
3
4
5
font-style:italic;
font-variant:small-caps;
font-weight:bold;font-size:1em;
line-height:140%;
font-family:"Lucida Grande",sans-serif;
可以缩写为一句:

1
font:italic small-caps bold 1em/140%"Lucida Grande",sans-serif;
注意,如果你缩写字体定义,至少要定义font-size和font-family两个值。

五、列表(lists)
取消默认的圆点和序号可以这样写list-style:none;,
list的属性如下:

1
2
3
list-style-type:square;
list-style-position:inside;
list-style-image:url(image.gif);
可以缩写为一句:

1
list-style:square inside url(image.gif);
六、颜色(Color)

16进制的色彩值,如果每两位的值相同,可以缩写一半。例如:

Aqua: #00ffff ——#0ff
Black: #000000 ——#000
Blue: #0000ff ——#00f
Dark Grey: #666666 ——#666
Fuchsia:#ff00ff ——#f0f
Light Grey: #cccccc ——#ccc
Lime: #00ff00 ——#0f0
Orange: #ff6600 ——#f60
Red: #ff0000 ——#f00
White: #ffffff ——#fff
Yellow: #ffff00 ——#ff0

七、属性值为0
书写原则是如果CSS属性值为0,那么你不必为其添加单位(如:px/em),你可能会这样写:

1
padding:10px 5px 0px 0px;
试试这样吧:

1
padding:10px 5px 00 ;
八、最后一个分号

最后一个属性值后面分号可以不写,如:

1
2
3
4
5
6
#nav{
border-top:4px solid #333;
font-style: normal;
font-variant:normal;
font-weight: normal;
}
可以简写成:

1
2
3
4
5
6
#nav{
border-top:4px solid #333;
font-style: normal;
font-variant:normal;
font-weight: normal
}
九、字体粗细(font-weight)

你可能会这样写:

1
2
3
4
5
6
h1{
font-weight:bold;
}
p{
font-weight:normal;
}
可以简写成:

1
2
3
4
5
6
h1{
font-weight:700;
}
p{
font-weight:400;
}
十、圆角半径(border-radius)
border-radius是css3中新加入的属性,用来实现圆角边框。

1
2
3
4
5
6
7
8
9
-moz-border-radius-bottomleft:6px;
-moz-border-radius-topleft:6px;
-moz-border-radius-topright:6px;
-webkit-border-bottom-left-radius:6px;
-webkit-border-top-left-radius:6px;
-webkit-border-top-right-radius:6px;
border-bottom-left-radius:6px;
border-top-left-radius:6px;
border-top-right-radius:6px;
可以简写成:

1
2
3
-moz-border-radius:6px 6px 0;
-webkit-border-radius:6px 6px 0;
border-radius:6px 6px 0;
语法 border-radius:topleft topright bottomright bottomleft[/code]

倾情 发表于 2017-2-17 22:03

[quote]他[她]看完这篇文章说:[img]http://oocn.258club.com/attachments/month_1412/14120408339fa81fa2b9de7e74.png[/img][/quote]

打的赢 发表于 2023-10-23 11:30

[img]https://i.jpg.dog/3fa3afcc25ebd88a0f2a033ff3dc25b4.png[/img]
[img]https://i.jpg.dog/99b6c14df53ca936525247432a0d289a.png[/img]
[img]https://i.jpg.dog/2cd6758d46d96a1255884ee31844e2fe.png[/img]
[img]https://i.jpg.dog/0c96871256ef5e8c05080d151a7621b6.png[/img]
[img]https://i.jpg.dog/42bbc5e0d69ee00dcac6aa8991f2ec69.png[/img]
[img]https://i.jpg.dog/1966ad944c639e96db89019eb72c06a0.png[/img]
[img]https://i.jpg.dog/efac4729353bc31928d339d85b91694b.png[/img]
[img]https://i.jpg.dog/380d645bc6bbed595940f05ac8eb87c8.png[/img]
[img]https://i.jpg.dog/78253635b81fc43a5d45f29f3ebd4998.png[/img]
[img]https://i.jpg.dog/c059dddd9e66b1db8749dc6b87ade1ab.png[/img]
[img]https://i.jpg.dog/e7dcee326e5329c792ce2d269489e445.png[/img]
[img]https://i.jpg.dog/cfcc915de6955598d9bac37a8321b878.png[/img]
[img]https://i.jpg.dog/91cbaa1735621403c78677805cbde8fc.png[/img]
[img]https://i.jpg.dog/df82ab5bbfb4f8f1ba53e42526b6fc30.png[/img]
[img]https://i.jpg.dog/8d7663180a18796a5224defb0c943ef7.png[/img]
[img]https://i.jpg.dog/556258787d531f2e29d91343d2e1a0fb.png[/img]
[img]https://i.jpg.dog/37c725dd424bdedda58533c3a039922e.png[/img]
[img]https://i.jpg.dog/a8d759cf9fcefd9efa42fe17fb1edb9f.png[/img]
[img]https://i.jpg.dog/b89f19acee37f0a80935e6d2be625470.png[/img]
[img]https://i.jpg.dog/4b119f280447016adc92dfeed5a97db0.png[/img]
[img]https://i.jpg.dog/de77e9e650fbd2e7fe0724ab98d720e0.png[/img]
[img]https://i.jpg.dog/6c9c6abe3688b69fe0bd549c2fce41be.png[/img]
[img]https://i.jpg.dog/a4f1fd802747b83c5c15fa5d8d0246d4.png[/img]
[img]https://i.jpg.dog/bacf477c18664d63180c674212013260.png[/img]
[img]https://i.jpg.dog/072f48c8eb806385baef18fc21fdc545.png[/img]
[img]https://i.jpg.dog/c68fc05d7993e2f538aa6e726c77179d.png[/img]
[img]https://i.jpg.dog/cc66bc0a1a920694d34356e766ad69d9.png[/img]
[img]https://i.jpg.dog/cfc7c5f0b164daf9430bed9ff77a5a35.png[/img]
[img]https://i.jpg.dog/8f3cefc388e1a1dec93764ff8ed78d73.png[/img]
[img]https://i.jpg.dog/0a8bd0b2f5b7b3606a8f55eb787502b9.png[/img]
[img]https://i.jpg.dog/2148779f8f880c2178efa63e2a896abd.png[/img]
[img]https://i.jpg.dog/e91c03f5c74691428c9cc1ef7335679e.png[/img]
[img]https://i.jpg.dog/26b803d6a071f04216809f5dfec132d4.png[/img]



[img]https://cdnjson.com/images/2023/10/16/73695364_202310150858500908143473.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150859030924145795.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150859160440405406.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150859280643668185.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150859390580477375.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150859510408729317.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150905040018243571.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150905140315736450.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150905230783927963.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150905340611656678.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150905440268736605.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150905540486259089.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150919410283764841.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150919520830234633.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150920030643203181.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150920130627154929.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150920230096356611.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150920320908786921.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150924320502106318.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150924420721994835.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150924550518548028.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150925090580930576.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150925190456482383.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150925300346694108.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150929290862295186.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150929390971857832.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150929500471220039.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150930000424451139.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150930100377284549.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150930200456163384.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150933510908958742.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150934010924491575.png[/img]
[img]https://cdnjson.com/images/2023/10/16/73695364_202310150934110377862246.png[/img]




[img]http://www.712100.org/data/attachment/forum/202310/17/153418dhzpsskizsvsvzho.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153422rt4myaa9d88s6ada.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153425c65ewuwm3aee3766.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153428izxyy8uiazff3ijn.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153436vxmwlpu7t93swrax.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153440zurxxhcyk99rxhcc.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153446jkawlk1a11t1eeet.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153449dop87mq19lmm2ppe.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153453m53jtxz8ta5r3jmq.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153457hotvfeef9tru35f6.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153500og24993te4neeonj.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153504khwboizhw00c5ciu.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153510igc2frv94vrcgg9r.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153515s48znk24x4un4x54.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153519hadywmtz0maiad8b.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153523qpghrirjpyrrmykr.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153527yey5vyqqs83r3fo8.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/153530gdtfumewf11honh8.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154141c1s7odnfd511d1fp.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154146eusu63sjf82sfzvx.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154149e4xxdjsztdxd8ml6.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154154i66625zbbb6gpgo4.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154157xbsuhdsbdk3u3hgb.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154200k2epch2v70rs6esv.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154206tjqjleq2b2yy2ees.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154209autbz6kxm37tbrx3.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154213wprrn4rbsrqqpq5p.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154216e3nhywprhhfq9wfz.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154220bw76w9wcvc9l10c9.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154224dcs646lyksc6yqnk.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154230ffghptckcws3csdg.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154233eb1z7cn7ue0nmcqb.png[/img]
[img]http://www.712100.org/data/attachment/forum/202310/17/154236vw43o9pcjl9b0amc.png[/img]
{2023年10月01日}2023冬季,全球 崩 盘,三 峡 溃 坝

{2023年10月01曰}2023冬季,全球 崩 盘,三 峡 溃 坝



作者 : 薛桦镰
时间:  2023年10月01曰 О8:49:57        星期曰        农历八月十七
           上正宗指 3110.48点    恒指 17809.66点   道指33507.50点
           囯际音乐节      囯际老人节
           


         
突然的,全球 金 融 市 场 连 续 跌 停 大 崩 盘,
没有什么,谁也没想到啊,友邦惊诧,黑 天 鹅 白天鹅 哥斯拉,
一切都是,蓄 谋 已 久 的精心策划。zéi 喊捉zéi。


{一} 今时今曰{癸卯2023年10月01曰 } :
今时今曰,我预.测,人类有始.以来最大的金.融.崩 盘 ,未来三个月
之内,即,2023年11月、12月、2024年元月,将 震 撼呈 现。
---- 中卝囯股市、全球股市、全球金融市场 连序跌婷大崩 盘 , 大盘连
       续或稍稍间断30/40多个跌亭板,人类有.史以来最大的金融.嗨啸。
股市、汇市、债市、期货商品、可能还有楼卝市,全部连卝锁式彻底崩溃。
黄 金 价 格 应 该 避 险 bào 涨。
忽 然 之 间 ,天 塌 了。{ 全 球 闪 崩 }
十 八 级 金融大 地.震,史无前例地球崩卝盘,要 多 惨 有 多惨,世界沫曰。
金融天坑,股市雪崩、铡 dāo 斩 首 、bào 雷 溃 坝 ,希 特 勒 巴巴罗萨
金融闪击战 。画 皮 ,终 于 撕 去 了 。
最热的天气,最冷的人心。
道琼斯,憋了14年的一泡shǐ{⑥440.О8},2023冬季,总算找到了,公共厕所。
缠中说禅17年之前预卝言的,2019毁miè性下跌。{有四年误差}
已故“周期天王”周金涛的,“2018年到2019年

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.