CSS3系列教程:邊框半徑和圓角
頁面中圓角的實現是個很頭疼的問題,雖然現在有很多種實現方法,但是都是比較麻煩的。在本文中,讓我們看看如何使用CSS3 border-radius
來實現圓角DIV。
跨瀏覽器相容性
就像在上一篇《CSS3系列教程:簡介》中提到的,並不是所有的瀏覽器支援CSS3,但是那些比較好的瀏覽器選擇相容,而不是直接支援。我們有兩個能使用的字首。
字首:
-moz
(例如 -moz-border-radius
)用於Firefox
-webkit
(例如:-webkit-border-radius
)用於Safari和Chrome。
CSS3圓角(所有的)
不使用圖片來實現圓角曾經是很流行的能力,建立那些完美的小圓角圖片,用做適當的CSS背景,是非常費時的工作。現在,使用CSS3,我們可以用幾行程式碼來建立圓角。
這是一個5px普通邊框和15px邊框半徑的設定:
#roundCorderC{
font-family: Arial;
border: 5px solid #dedede;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;
padding: 15px 25px;
height: inherit;
width: 590px;
}
瀏覽器支援:
- Firefox(3.05+…)
- Google Chrome(1.0.154+…)
- Google Chrome(2.0.156+…)
- Internet Explorer(IE7, IE8)
- Opera 9.6
- Safari(3.2.1+ windows)
CSS3圓角(個別的)
當然,一個DIV的四個角不需要全部都是圓角,你可以個別的實現圓角。
#roundCornerI{ font-family: Arial; border: 5px solid #dedede; -moz-border-radius-topleft: 15px; -moz-border-radius-topright: 0px; -moz-border-radius-bottomright: 15px; -moz-border-radius-bottomleft: 0px; -webkit-border-top-left-radius: 15px; -webkit-border-top-right-radius: 0px; -webkit-border-bottom-left-radius: 0px; -webkit-border-bottom-right-radius: 15px; border-top-left-radius:15px; border-top-right-radius:0; border-bottom-right-radius:15px; border-bottom-left-radius:0; padding: 15x 25px; height: inherit; width: 590px; }
瀏覽器支援:
- Firefox 4+
- Google Chrome 3+
- Internet Explorer 9+
- Safari 3.2.1+
CSS3系列教程|前端觀察
特別宣告,本系列文章譯自:Zen Elements,非常感謝Alex的辛勤工作。
Special Staterment: this series posts were translate from Zen Elements, thanks Alex for his great work so much.
相關推薦
CSS3系列教程:邊框半徑和圓角
頁面中圓角的實現是個很頭疼的問題,雖然現在有很多種實現方法,但是都是比較麻煩的。在本文中,讓我們看看如何使用CSS3 border-radius來實現圓角DIV。 跨瀏覽器相容性 就像在上一篇《CSS3系列教程:簡介》中提到的,並不是所有的瀏覽器支援CSS3,但是那些比較好的瀏覽器選
CSS3系列教程:邊框顏色
現在我們來看一看如何為邊框的border-color新增更多的色彩。 使用CSS3的border-radius屬性,如果你設定了border的寬度是X px,那麼你就可以在這個border上使用X種顏色,每種顏色顯示1px的寬度。如果說你的border的寬度是10個畫素,但是隻聲明瞭5
CSS3系列教程:HSL 和HSLA
使用CSS3 HSL宣告同樣是用來設定顏色的。下一個呢? HSLA? 是的,這個和RGBA的效果是一樣的。 HSL宣告使用色調Hue(H)、飽和度Saturation(s)和亮度Lightness(L)來設定顏色。 Hue衍生於色盤:0和360是紅色,接近120的是綠色,240是藍
CSS3系列教程:背景圖片(背景大小和多背景圖)
背景圖片/紋理有很多種使用方式,常常用於為新增網站的最佳的介面美化。現在它在CSS3中被重視,我們可以應用多背景圖和背景圖片尺寸來實現更完美的效果。 CSS3的背景圖片大小可以寫成 background-size:Apx Bpx; Apx = x軸(圖片寬度) Bpx = y軸
NetworkX系列教程(11)-graph和其他數據格式轉換
sha 小書匠 ans mar http 導入 src 如果 apt 小書匠 Graph 圖論 學過線性代數的都了解矩陣,在矩陣上的文章可做的很多,什麽特征矩陣,單位矩陣等.grpah存儲可以使用矩陣,比如graph的鄰接矩陣,權重矩陣等,這節主要是在等到graph後,
瞭解Flex SDK系列教程(1.Ant和FlexTask)
轉:http://www.riameeting.com/node/1009 推薦兩篇教程http://www.adobe.com/devnet/flex/articles/flex_ant_pt1.htmlhttp://www.adobe.com/devnet/flex/articles/fle
資訊學奧賽系列教程:演算法和程式
演算法的概念: 演算法是解決問題的步驟的描述。 演算法的描述: 可以採用自然語言,程式流程圖,計算機程式描述演算法。 以計算圓的周長和麵積為例 採用自然語言描述為: 開始 輸入半徑R 周長L = 2*3.14*R 面積S
CSS3系列教程:多列/多卷
使用CSS3可以為你的網站建立多列,而不用為每列制定特定的層或段落。 與多背景圖片一樣,CSS3多列也是我最喜愛的一個技術。我想這條CSS3屬性有在報紙和雜誌佈局中以外的很多潛在的用途。如果你在某個想法或個人網站中使用了這種方法,請在下面的評論中提交你的連結,我很高興能確認這種方法能用
CSS3系列教程:嵌入字型/網路字型
想要製作一些很酷的頭部效果而且擺脫網站安全字型並且不使用圖片檔案?那麼就使用CSS3嵌入字型吧! 要使用一款字型,我們首先需要使用‘@font-face’屬性。這必須先準備好我們要用的字型檔案。 儘管這樣,讓我們簡單的學習一下字型方面的歷史。@font-face屬性從CSS2就已經考
CSS3系列教程:RGBA
使用新的CSS3的”RGBA”宣告,不僅僅讓我們像通常一樣設定RGB顏色,而且還可以設定其透明度。 RGBA像RGB一樣設定顏色,而這個”A”——RGBA中的最後一個值——允許我們設定該元素的透明度。就像opacity宣告一樣,一個opacity值為1的元素是完全不透明的,而一個opa
CSS3系列教程:簡介
CSS3不是新事物,更不是隻是圍繞border-radius屬性實現的圓角。它正耐心的坐在那裡,已經準備好了首次登場,呷著咖啡,等著瀏覽器來鋪上紅地毯。你看,瀏覽器需要跟上了…… 注意:瀏覽器需要改進 儘管把玩CSS3是很有趣的事情——就像接下來我要演示的幾篇教程中表現的那樣,但是需
CSS3系列教程:陰影
陰影大約從CSS2就開始有了,但是隻有Safari一個瀏覽器支援它,到現在依然是這樣。陰影在CSS3中可以應用在邊框和文字上,就像圖片的陰影效果一樣。 一般可以分為box-shadow和text-shadow兩類。 CSS3的box-shadow和text-shadow可以寫做:bo
CSS3系列教程:透明度
CSS3透明…不透明…漸變…隨便你怎麼叫它吧!這裡是一些使用CSS3透明度的指南以及一些例子。 其實這個firefox很久以前就支援了,而IE一直不支援! “opacity”宣告用來設定一個元素的透明度:層、文字、圖片等…一個opacity的值為1的元素是完全不透明的,反之,值為0是
詳解css3系列:動畫@keyframes和Animation
在css3中,我們可以通過@keyframes建立關鍵幀動畫效果。我們需要將@keyframes繫結到選擇器中,否則不會有效果出現。同時,我們還需定義動畫時長和動畫名稱 語法 @keyframes animationname {keyframes-selector {css
Tkinter系列教程01—引言和安裝Tk—Python GUI程式設計
[toc] # Tkinter教程系列01——引言和安裝Tk 首發於我的個人部落格 https://chens.life/tkinter-tutorial-chapter-01-introduction-and-install-tk.html ## 引言 這個教程針對於 Tkinter 的初學者而攥寫,
css3彈性盒display:box和flex的完整好教程
guid flexbox iba span style lan guide isp ref 1、flexbox-CSS3彈性盒模型flexbox布局完整版教程(轉)2、CSS3盒模型display:box詳解(轉) css3彈性盒display:box和flex的完整好教
Hyper-V 2016 系列教程10 快照功能 檢查點 和原還虛擬機
hyper-v microsoft windows server 2016 windows 10 虛擬化相對於XenServer和VMware Esxi來說, Hyper-V的快照功能比較簡潔和簡單。(1)打開 Hyper-V管理器,功能菜單,操作 | 檢查點,如下圖所示。(2) 執行後,會顯示如下檢查點的s
Hyper-V 2016 系列教程40 使用 PowerShell 實現虛擬機自動化和管理虛擬機
windows server 2012 2016; hyper-v;虛擬化註:以下內容部分取自微軟官網:可以在 Hyper-V 主機上的 Windows 10 或 Windows Server 技術預覽版虛擬機中使用 PowerShell Direct 運行任意 PowerShell,而無論網絡配置或遠程管理
Hyper-V 2016 系列教程54 SCVMM 2016 布署前 Windows評估和部署工具包 Windows ADK安裝
windows server 虛擬化 在布署SCVMM 2016安裝前,必須要下載 Windows ADK安裝,不然是不能安裝SCVMM 2016的,下面分享一下如何下載和安裝Windows ADK。(1) 下載官方網頁如下圖。(2) 雙擊下載好的可執行EXE文件,選擇安裝路徑如下圖,然後點擊“下
JXLS 2.4.0系列教程(五)——更進一步的應用和bug修復
erl dir 問題 create sna 過程 idl es2017 cal 註:本文代碼建立於前面寫的代碼。不過不看也不要緊。 前面的文章把JXLS 2.4.0 的基本使用寫了一遍,現在講講一些更進一步的使用方法。我只寫一些我用到過的方法,更多的高級使用方法請參