溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

css3中怎么實(shí)現(xiàn)線性漸變和徑向漸變

發(fā)布時(shí)間:2021-07-22 15:25:23 來源:億速云 閱讀:146 作者:Leah 欄目:web開發(fā)

css3中怎么實(shí)現(xiàn)線性漸變和徑向漸變,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。

線性漸變:ie6以下不兼容

徑向漸變:只支持firefox、Chrome和Safari

代碼如下:


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
<title>Background Color</title>
<style type="text/css">
* {
marigin:0;
padding:0;
}
div{
margin-bottom:20px;
width:300px;
height:100px;
}
.linear{/*線性漸變樣式*/
background-color: #1FA9F4; /* Old browsers */
background-image: -moz-linear-gradient(top,#1FA9F4 0%, #001C4E 100%); /* FF3.6+ */
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1FA9F4), color-stop(100%,#001C4E)); /* Chrome,Safari4+ */
background-image: -o-linear-gradient(top,#1FA9F4 0%, #001C4E 100%); /* Opera 11.10+ */
background-image: -ms-linear-gradient(top,#1FA9F4 0%, #001C4E 100%); /* IE10+ */
background-image: linear-gradient(to bottom,#1FA9F4 0%, #001C4E 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1FA9F4', endColorstr='#001C4E',GradientType=0 ); /* IE6-8 */
}
.circle{/*徑向漸變樣式*/
background-color: #1FA9F4; /* Other browsers*/
background-image:-moz-radial-gradient(center 80px 45deg, circle farthest-corner, #1FA9F4 0%, #001C4E 100%); /* FF3.6+ */
background-image: -webkit-gradient(radial,50% 100%,10,50% 50%,90,from(rgba(31,169,244,1)),to(rgba(0,28,78,1))); /* Chrome,Safari4+ */
}
</style>
</head>
<body>
<div class="linear">
</div>
<div class="circle">
</div>
</body>
</html>


效果圖:
css3中怎么實(shí)現(xiàn)線性漸變和徑向漸變

看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請關(guān)注億速云行業(yè)資訊頻道,感謝您對(duì)億速云的支持。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI