這篇文章會記錄咱們平時經常使用到的 CSS 片斷,使用這些 CSS 能夠幫助咱們解決許多實際項目問題中遇到的,牆裂建議點贊收藏再看,方便往後查找😁css
浮動給咱們的代碼帶來的麻煩,想必不須要多說,咱們會用不少方式來避免這種麻煩,其中我以爲最方便也是兼容性最好的一種是,在同級目錄下再建立一個<div style="clear:both;"></div>
;不過這樣會增長不少無用的代碼。此時咱們用:after
這個僞元素來解決浮動的問題,若是當前層級有浮動元素,那麼在其父級添加上 clearfix 類便可。html
// 清除浮動 .clearfix:after { content: "\00A0"; display: block; visibility: hidden; width: 0; height: 0; clear: both; font-size: 0; line-height: 0; overflow: hidden; } .clearfix { zoom: 1; }
在 css 的世界裏水平居中比垂直居中來的簡單一些,通過了多年的演化,依然沒有好的方式來讓元素垂直居中(各類方式各有優缺點,但都不能達到兼容性好,破壞力小的目標),如下是幾種常見的實現方式前端
絕對定位方式且已知寬高
git
position: absolute; top: 50%; left: 50%; margin-top: -3em; margin-left: -7em; width: 14em; height: 6em;
絕對定位 + 未知寬高 + translate
github
position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); //須要補充瀏覽器前綴
flex 輕鬆搞定水平垂直居中(未知寬高)
web
display: flex; align-items: center; justify-content: center;
當文本的內容超出容器的寬度的時候,咱們但願在其默認添加省略號以達到提示用戶內容省略顯示的效果。chrome
寬度固定,適合單行顯示...
瀏覽器
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
寬度不固定,適合多行以及移動端顯示
hexo
overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
當咱們但願給文本製造一種模糊效果感受的時候,能夠這樣作app
color: transparent; text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
咱們來實現一個很是簡潔的 loading 效果
.loading:after { display: inline-block; overflow: hidden; vertical-align: bottom; content: "\2026"; -webkit-animation: ellipsis 2s infinite; } // 動畫部分 @-webkit-keyframes ellipsis { from { width: 2px; } to { width: 15px; } }
默認狀況下,咱們在網頁上選中文字的時候,會給選中的部分一個深藍色背景顏色(能夠本身拿起鼠標試試),若是咱們想本身定製被選中的部分的樣式呢?
// 注意只能修改這兩個屬性 字體顏色 選中背景顏色 element::selection { color: green; background-color: pink; } element::-moz-selection { color: green; background-color: pink; }
有時候咱們會有這樣的需求,在一個列表展現頁面,有一些列表項是新添加的、或者熱度比較高的,就會要求在其上面添加一個貼紙效果的小條就像 hexo 默認博客的 fork me on github 那個效果同樣。
接下來咱們開始一步步完成最左邊的這個效果
html
<div class="wrap"> <div class="ribbon"> <a href="#">Fork me on GitHub</a> </div> </div>
css
/* 外層容器幾本設置 */ .wrap { width: 160px; height: 160px; overflow: hidden; position: relative; background-color: #f3f3f3; } .ribbon { background-color: #a00; overflow: hidden; white-space: nowrap; position: absolute; /* shadom */ -webkit-box-shadow: 0 0 10px #888; -moz-box-shadow: 0 0 10px #888; box-shadow: 0 0 10px #888; /* rotate */ -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); /* position */ left: -50px; top: 40px; } .ribbon a { border: 1px solid #faa; color: #fff; display: block; font: bold 81.25% "Helvetica Neue", Helvetica, Arial, sans-serif; margin: 1px 0; padding: 10px 50px; text-align: center; text-decoration: none; /* shadow */ text-shadow: 0 0 5px #444; }
當咱們給部分 input 類型的設置 placeholder 屬性的時候,有的時候須要修改其默認的樣式。
input::-webkit-input-placeholder { color: green; background-color: #f9f7f7; font-size: 14px; } input::-moz-input-placeholder { color: green; background-color: #f9f7f7; font-size: 14px; } input::-ms-input-placeholder { color: green; background-color: #f9f7f7; font-size: 14px; }
在移動端瀏覽器上,當你點擊一個連接或者經過 Javascript 定義的可點擊元素的時候,會出現藍色邊框,說實話,這是很噁心的,怎麼去掉呢?
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
要實現相似 word 中首字下沉的效果可使用如下代碼
element:first-letter { float: left; color: green; font-size: 30px; }
在不少地方咱們能夠用得上小三角,接下來咱們畫一下四個方向的三角形
.triangle { /* 基礎樣式 */ border: solid 10px transparent; } /*下*/ .triangle.bottom { border-top-color: green; } /*上*/ .triangle.top { border-bottom-color: green; } /*左*/ .triangle.top { border-right-color: green; } /*右*/ .triangle.top { border-left-color: green; }
能夠看出畫一個小三角很是簡單,只要兩行樣式就能夠搞定,對於方向只要想着畫哪一個方向則設置反方向的樣式屬性就能夠
通常狀況下,咱們但願在如下元素身上添加鼠標手型
a[href], input[type="submit"], input[type="image"], input[type="button"], label[for], select, button { cursor: pointer; }
在訪問移動網站時,你會發現,在選中的元素周圍會出現一些灰色的框框,使用如下代碼屏蔽這種樣式
-webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
pre、code、legend、fieldset、blockquote … 等標籤不是很經常使用,因此就不一一列舉,若是項目中使用到,能夠本身單獨寫
body, p, h1, h2, h3, h4, h5, h6, dl, dd, ul, ol, th, td, button, figure, input, textarea, form { margin: 0; padding: 0; }
不一樣瀏覽器的 input、select、textarea 的盒子模型寬度計算方式不一樣,統一爲最多見的 content-box
input, select, textarea { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; } table { /*table 相鄰單元格的邊框間的距離設置爲 0*/ border-spacing: 0; /*默認狀況下給 tr 設置 border 沒有效果,若是 table 設置了邊框爲合併模式:「border-collapse: collapse;」就能夠了*/ border-collapse: collapse; }
acronym、fieldset … 等其餘標籤不是很經常使用,就不會一一列舉;若是項目中用到,能夠本身單獨寫
img, input, button, textarea { border: none; -webkit-appearance: none; } input { /*因爲 input 默認不繼承父元素的居中樣式,因此設置:「text-align: inherit」*/ text-align: inherit; } textarea { /*textarea 默認不能夠放縮*/ resize: none; }
outline
樣式因爲如下元素的部分屬性沒有繼承父節點樣式,因此聲明這些元素的這些屬性爲父元素的屬性
a, h1, h2, h3, h4, h5, h6, input, select, button, option, textarea, optgroup { font-family: inherit; font-size: inherit; font-weight: inherit; font-style: inherit; line-height: inherit; color: inherit; outline: none; }
另外 del、ins 標籤的中劃線、下劃線仍是挺好的,就不去掉
a { text-decoration: none; } ol, ul { /*開發中 UI 設計的列表都是和原生的樣式差太多,因此直接給取消 ol,ul 默認列表樣式*/ list-style: none; } button, input[type="submit"], input[type="button"] { /*鼠標通過是「小手」形狀表示可點擊*/ cursor: pointer; } input::-moz-focus-inner { /*取消火狐瀏覽器部分版本 input 聚焦時默認的「padding、border」*/ padding: 0; border: 0; }
input[type="number"] { -moz-appearance: textfield; } input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: #999; } input:-moz-placeholder, textarea:-moz-placeholder { color: #999; } input::-moz-placeholder, textarea::-moz-placeholder { color: #999; } input:-ms-input-placeholder, textarea:-ms-input-placeholder { color: #999; } template { /*因爲部分瀏覽 template 會顯示出來,因此要隱*/ display: none; }
.pf { position: fixed; /*chrome 內核 瀏覽器 position: fixed 防止抖動*/ -webkit-transform: translateZ(0); }
.middle { position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; }
.v-middle { position: relative; top: 50%; -webkit-transform: -webkit-translateY(-50%); -moz-transform: -moz-translateY(-50%); -o-transform: -o-translateY(-50%); transform: translateY(-50%); }
.bb { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
.to { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
不一樣的瀏覽器對各個標籤默認的樣式是不同的,並且有時候咱們也不想使用瀏覽器給出的默認樣式,咱們就能夠用 reset.css 去掉其默認樣式
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td { margin: 0; padding: 0; } body, button, input, select, textarea { font: 12px/1.5 tahoma, arial, \5b8b\4f53; } h1, h2, h3, h4, h5, h6 { font-size: 100%; } address, cite, dfn, em, var { font-style: normal; } code, kbd, pre, samp { font-family: couriernew, courier, monospace; } small { font-size: 12px; } ul, ol { list-style: none; } a { text-decoration: none; } a:hover { text-decoration: underline; } sup { vertical-align: text-top; } sub { vertical-align: text-bottom; } legend { color: #000; } fieldset, img { border: 0; } button, input, select, textarea { font-size: 100%; } table { border-collapse: collapse; border-spacing: 0; }
/* 強制不換行 */ div { white-space: nowrap; } /* 自動換行 */ div { word-wrap: break-word; word-break: normal; } /* 強制英文單詞斷行 */ div { word-break: break-all; }
table { border: 1px solid #000; padding: 0; border-collapse: collapse; table-layout: fixed; margin-top: 10px; } table td { height: 30px; border: 1px solid #000; background: #fff; font-size: 15px; padding: 3px 3px 3px 8px; color: #000; width: 160px; }
當咱們提早知道要居中元素的長度和寬度時,可使用這種方式:
.container { position: relative; width: 300px; height: 200px; border: 1px solid #333333; } .content { background-color: #ccc; width: 160px; height: 100px; position: absolute; top: 50%; left: 50%; margin-left: -80px; /* 寬度的一半 */ margin-top: -50px; /* 高度的一半 */ }
當要居中的元素不定寬和定高時,咱們可使用 transform 來讓元素進行偏移。
.container { position: relative; width: 300px; height: 200px; border: 1px solid #333333; } .content { background-color: #ccc; position: absolute; top: 50%; left: 50%; transform: translate3d(-50%, -50%, 0); text-align: center; }
line-height
實際上是行高,咱們能夠用行高來調整佈局!
不過這個方案有一個比較大的缺點是:文案必須是單行的,多行的話,設置的行高就會有問題。
.container { width: 300px; height: 200px; border: 1px solid #333333; } .content { line-height: 200px; }
給容器元素設置display: table
,當前元素設置display: table-cell
:
.container { width: 300px; height: 200px; border: 1px solid #333333; display: table; } .content { display: table-cell; vertical-align: middle; text-align: center; }
咱們能夠給父級元素設置爲display: flex
,利用 flex 中的align-items
和justify-content
設置垂直方向和水平方向的居中。這種方式也不限制中間元素的寬度和高度。
同時,flex 佈局也能替換line-height
方案在某些 Android 機型中文字不居中的問題。
.container { width: 300px; height: 200px; border: 1px solid #333333; display: flex; align-items: center; justify-content: center; } .content { background-color: #ccc; text-align: center; }
一種經常使用的方式是把外層的 div 設置爲 table-cell;而後讓內部的元素上下左右居中。固然也還有一種方式,就是把 img 當作 div,參考 6 中的代碼進行設置。
CSS 代碼以下:
.content { width: 400px; height: 400px; border: 1px solid #ccc; text-align: center; display: table-cell; vertical-align: middle; }
html 代碼以下:
<div class="content"> <img src="./4.jpg" alt="img" /> </div>
咱們常常會遇到這樣的 UI 需求,就是標題兩邊有兩個小橫崗,以前是怎麼實現的呢?好比用個border-top
屬性,而後再把中間的文字進行絕對定位,同時給這個文字一個背景顏色,把中間的這部分蓋住。
如今咱們可使用僞元素來實現!
<div class="title">標題</div>
title { color: #e1767c; font-size: 0.3rem; position: relative; &:before, &:after { content: ""; position: absolute; display: block; left: 50%; top: 50%; -webkit-transform: translate3d(-50%, -50%, 0); transform: translate3d(-50%, -50%, 0); border-top: 0.02rem solid #e1767c; width: 0.4rem; } &:before { margin-left: -1.2rem; } &:after { margin-left: 1.2rem; } }
border 除了做爲簡單的繪製邊框之外,還能夠繪製三角形,梯形,星形等任意的多邊形,如下爲繪製的兩個三角形和梯形
<div class="triangle1"></div> <div class="triangle2"></div> <div class="trapezoid"></div>
.triangle1 { /*銳角三角形*/ width: 0; height: 0; border-top: 50px solid transparent; border-bottom: 100px solid #249ff1; border-left: 30px solid transparent; border-right: 100px solid transparent; } .triangle2 { /*直角三角形*/ width: 0; height: 0; border-top: 80px solid transparent; border-bottom: 80px solid #ff5b01; border-left: 50px solid #ff5b01; border-right: 50px solid transparent; } .trapezoid { /*梯形*/ width: 0; height: 0; border-top: none; border-right: 80px solid transparent; border-bottom: 60px solid #13dbed; border-left: 80px solid #13dbed; }
border-radius
主要用於繪製圓點、圓形、橢圓、圓角矩形等形狀,如下爲簡單繪製的兩個圖形。
<div class="circle"></div> <div class="ellipse"><div></div></div>
.circle, .ellipse { width: 100px; height: 100px; background: #249ff1; border-radius: 50%; } .ellipse { width: 150px; background: #ff9e01; }
但border-radius
屬性實際上能夠設置最多 8 個值,經過改變 8 個值能夠獲得許多意想不到的圖像
對於box-shadow
,其完整的聲明爲box-shadow: h-shadow v-shadow blur spread color inset
,各個值表示的意義分別爲:s 水平方向的偏移,垂直方向的便宜,模糊的距離(羽化值),陰影的大小(不設置或爲 0 時陰影與主體的大小一致),陰影的顏色和是否使用內陰影。實際應用時能夠接收 3-6 個值,對應分別以下:
同時,border-shadow
接受由多個以上各類值組成的以逗號分隔的值,經過這一特性,咱們能夠實現如多重邊框的等效果。如下咱們用該屬性來實現一個單標籤且不借助僞元素的添加圖標和表明目標的的圖標。
<div class="plus"></div> <div class="target"></div>
.plus { width: 30px; height: 30px; margin-left: 50px; /*因爲box-shadow不佔空間,經常須要添加margin來校訂位置*/ background: #000; box-shadow: 0 -30px 0 red, 0 30px 0 red, -30px 0 0 red, 30px 0 0 red; } .target { width: 30px; height: 30px; background: red; border-radius: 50%; margin-left: 50px; box-shadow: 0 0 0 10px #fff, 0 0 0 20px red, 0 0 0 30px #fff, 0 0 0 40px red; }
CSS3 的漸變屬性十分強大,理論上經過漸變能夠繪製出任何的圖形,漸變的特性和使用足足能夠寫一篇長文,如下爲一個例子
<div class="gradient"></div>
.gradient { position: relative; width: 300px; height: 300px; border-radius: 50%; background-color: silver; background-image: linear-gradient(335deg, #b00 23px, transparent 23px), linear-gradient(155deg, #d00 23px, transparent 23px), linear-gradient( 335deg, #b00 23px, transparent 23px ), linear-gradient(155deg, #d00 23px, transparent 23px); background-size: 58px 58px; background-position: 0px 2px, 4px 35px, 29px 31px, 34px 6px; }
.cup { display: inline-block; width: 0.9em; height: 0.4em; border: 0.25em solid; border-bottom: 1.1em solid; border-radius: 0 0 0.25em 0.25em; } cup:before { position: absolute; right: -0.6em; top: 0; width: 0.3em; height: 0.8em; border: 0.25em solid; border-left: none; border-radius: 0 0.25em 0.25em 0; content: ""; }
.heart { display: inline-block; margin-top: 1.5em; width: 50px; height: 50px; background: green; } .heart:before, .heart:after { position: absolute; width: 1em; height: 1.6em; background: #000; border-radius: 50% 50% 0 0; content: ""; bottom: 0; } .heart:before { -webkit-transform: rotate(45deg); -webkit-transform-origin: 100% 100%; right: 0; background: red; opacity: 0.5; z-index: 5; } .:after { -webkit-transform: rotate(-45deg); -webkit-transform-origin: 0 100%; left: 0; opacity: 0.8; }
.camera { display: inline-block; border-style: solid; border-width: 0.65em 0.9em; border-radius: 0.1em; } .camera:before { position: absolute; top: -0.3em; left: -0.3em; width: 0.4em; height: 0.4em; border-radius: 50%; border: 0.1em solid #fff; box-shadow: 0 0 0 0.08em, 0 0 0 0.16em #fff; content: ""; } .camera:after { position: absolute; top: -0.5em; left: 0.5em; width: 0.2em; border-top: 0.125em solid #fff; content: ""; }
.moon { display: inline-block; height: 1.5em; width: 1.5em; box-shadow: inset -0.4em 0 0; border-radius: 2em; transform: rotate(20deg); }
常規浮動 list 浮動 image 浮動
.float-left { float: left; } .float-right { float: right; } .float-li li,/*定義到li父元素或祖先元素上*/ li.float-li { float: left; } .float-img img,/*定義到img父元素或祖先元素上*/ img.float-li { float: left; } .float-span span,/*定義到span父元素或祖先元素上*/ span.float-span { float: right; }
.bg-img { background-image: url("../img/bg.png"); background-position: center top; background-repeat: no-repeat; } .bg01-img { background-image: url("../img/bg01.png"); background-position: center top; background-repeat: no-repeat; } .bg02-img { background-image: url("../img/bg02.png"); background-position: center top; background-repeat: no-repeat; } .bg03-img { background-image: url("../img/bg03.png"); background-position: center top; background-repeat: no-repeat; } .bg04-img { background-image: url("../img/bg04.png"); background-position: center top; background-repeat: no-repeat; }
.inherit-width { width: inherit; } .inherit-min-width { min-width: inherit; } .inherit-height { height: inherit; } .inherit-min-height { min-height: inherit; } .inherit-color { color: inherit; }
.text-indent { text-indent: 2rem; } /*16px*/ .text-indent-xs { text-indent: 1.5rem; } /*12px*/ .text-indent-sm { text-indent: 1.7rem; } /*14px*/ .text-indent-md { text-indent: 2rem; } /*18px*/ .text-indent-lg { text-indent: 2.4rem; } /*20px*/
.line-height-xs { line-height: 1.3rem; } .line-height-sm { line-height: 1.5rem; } .line-height-md { line-height: 1.7rem; } .line-height-lg { line-height: 2rem; } .line-height-25x { line-height: 25px; } .line-height-30x { line-height: 30px; }
.ul-indent-xs { margin-left: 0.5rem; } .ul-indent-sm { margin-left: 1rem; } .ul-indent-md { margin-left: 1.5rem; } .ul-indent-lg { margin-left: 2rem; } .ol-list, .ul-list { list-style: disc; }
.truncate { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .hide { display: none; }
.img-max, .video-max { width: 100%; height: auto; } /*display顯示方式*/ .inline { display: inline; } .inline-block { display: inline-block; } .block { display: block; }
.border-xs-black { border: 1px solid #000; } .border-sm-black { border: 2px solid #000; } .border-md-black { border: 3px solid #000; } .border-lg-black { border: 5px solid #000; } .border-xs-gray { border: 1px solid #9c9c9c; } .border-sm-gray { border: 2px solid #9c9c9c; } .border-md-gray { border: 3px solid #9c9c9c; } .border-lg-gray { border: 5px solid #9c9c9c; }
.bg-white { background: #fff !important; } .bg-black { background: #1b1c1d !important; } .bg-gray { background: #767676 !important; } .bg-light-gray { background: #f8f7f7 !important; } .bg-yellow { background: #fbbd08 !important; } .bg-orange { background: #f2711c !important; } .bg-red { background: #db2828 !important; } .bg-olive { background: #b5cc18 !important; } .bg-green { background: #21ba45 !important; } .bg-teal { background: #00b5ad !important; } .bg-darkGreen { background: #19a97b !important; } .bg-threeGreen { background: #097c25 !important; } .bg-blue { background: #2185d0 !important; } .bg-violet { background: #6435c9 !important; } .bg-purple { background: #a333c8 !important; } .bg-brown { background: #a5673f !important; }
hr, .hr-xs-Silver, .hr-sm-black, .hr-sm-Silver, .hr-xs-gray, .hr-sm-gray { margin: 20px 0; } hr { border: none; border-top: 1px solid #000; } .hr-xs-Silver { border: none; border-top: 1px solid #c0c0c0; } .hr-sm-black { border: none; border-top: 2px solid #000; } .hr-sm-Silver { border: none; border-top: 2px solid #c0c0c0; } .hr-xs-gray { border: none; border-top: 1px solid #767676; } .hr-sm-gray { border: none; border-top: 2px solid #767676; }
.hover-red a:hover,/*爲a標籤祖先元素添加類名 默認無智能提醒*/ a.hover-red:hover { color: red; } /*單獨爲a標籤添加類名*/ .hover-yellow a:hover,/*爲a標籤祖先元素添加類名 默認無智能提醒*/ a.hover-yellow:hover { color: #ffd700; } /*單獨爲a標籤添加類名*/ .hover-green a:hover,/*爲a標籤祖先元素添加類名 默認無智能提醒*/ a.hover-green:hover { color: #70aa39; } /*單獨爲a標籤添加類名*/ .hover-blue a:hover,/*爲a標籤祖先元素添加類名 默認無智能提醒*/ a.hover-blue:hover { color: blue; } /*單獨爲a標籤添加類名*/ .hover-gray a:hover,/*爲a標籤祖先元素添加類名 默認無智能提醒*/ a.hover-gray:hover { color: #9c9c9c; } /*單獨爲a標籤添加類名*/ .underline a:hover, a.underline:hover { text-decoration: underline; }
.shadow-text-xs { text-shadow: 4px 3px 0 #1d9d74, 9px 8px 0 rgba(0, 0, 0, 0.15); } /*智能兼容ie10以上 暫不考慮*/ .shadow-xs { -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=1, Direction=100, Color='#cccccc')"; /* For IE 8 */ filter: progid:DXImageTransform.Microsoft.Shadow(Strength=1, Direction=100, Color='#cccccc'); /* For IE 5.5 - 7 */ -moz-box-shadow: 1px 1px 2px #cccccc; /* for firefox */ -webkit-box-shadow: 1px 1px 2px #cccccc; /* for safari or chrome */ box-shadow: 1px 1px 2px #cccccc; /* for opera or ie9 */ } .shadow-sm { -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=120, Color='#cccccc')"; /* For IE 8 */ filter: progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=120, Color='#cccccc'); /* For IE 5.5 - 7 */ -moz-box-shadow: 2px 2px 3px #cccccc; /* for firefox */ -webkit-box-shadow: 2px 2px 3px #cccccc; /* for safari or chrome */ box-shadow: 2px 2px 3px #cccccc; /* for opera or ie9 */ } .shadow-md { -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=135, Color='#cccccc')"; /* For IE 8 */ filter: progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=135, Color='#cccccc'); /* For IE 5.5 - 7 */ -moz-box-shadow: 3px 3px 5px #cccccc; /* for firefox */ -webkit-box-shadow: 3px 3px 5px #cccccc; /* for safari or chrome */ box-shadow: 3px 3px 5px #cccccc; /* for opera or ie9 */ } .shadow-lg { -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=5, Direction=150, Color='#cccccc')"; /* For IE 8 */ filter: progid:DXImageTransform.Microsoft.Shadow(Strength=5, Direction=150, Color='#cccccc'); /* For IE 5.5 - 7 */ -moz-box-shadow: 5px 5px 8px #cccccc; /* for firefox */ -webkit-box-shadow: 5px 5px 8px #cccccc; /* for safari or chrome */ box-shadow: 5px 5px 8px #cccccc; /* for opera or ie9 */ }
.border-radius-xs { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .border-radius-sm { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } .border-radius-md { -webkit-border-radius: 7px; -moz-border-radius: 5px; border-radius: 5px; } .border-radius-lg { -webkit-border-radius: 9px; -moz-border-radius: 9px; border-radius: 9px; }
若是文章和筆記能帶您一絲幫助或者啓發,請不要吝嗇你的贊和收藏,你的確定是我前進的最大動力😁