需要準(zhǔn)備的材料分別有:電腦、瀏覽器、html編輯器。

成都創(chuàng)新互聯(lián)公司專(zhuān)注為客戶(hù)提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站、泗水網(wǎng)絡(luò)推廣、小程序定制開(kāi)發(fā)、泗水網(wǎng)絡(luò)營(yíng)銷(xiāo)、泗水企業(yè)策劃、泗水品牌公關(guān)、搜索引擎seo、人物專(zhuān)訪(fǎng)、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);成都創(chuàng)新互聯(lián)公司為所有大學(xué)生創(chuàng)業(yè)者提供泗水建站搭建服務(wù),24小時(shí)服務(wù)熱線(xiàn):18982081108,官方網(wǎng)址:chinadenli.net
1、首先,打開(kāi)html編輯器,新建html文件,例如:index.html。
2、在index.html中的style標(biāo)簽中,輸入css代碼:button {background-color: #00a7d0}
button:hover {background-color: #ff7701}。
3、瀏覽器運(yùn)行index.html頁(yè)面,此時(shí)顯示出了藍(lán)色背景顏色的按鈕。
4、將鼠標(biāo)移入按鈕,此時(shí)按鈕的背景顏色變成了橙色。
按鈕自適應(yīng)原理是利用a標(biāo)簽和i標(biāo)簽各自一個(gè)背景組合成為按鈕,達(dá)到自適應(yīng),具體實(shí)現(xiàn)css樣式及html結(jié)構(gòu)如下,感興趣的朋友可以參考下
原理:利用a標(biāo)簽和i標(biāo)簽各自一個(gè)背景組合成為按鈕,達(dá)到自適應(yīng)。
復(fù)制代碼
代碼如下:
!DOCTYPE
html
html
head
meta
charset="UTF-8"
style
type="text/css"
.btn
a{text-decoration:none;}
.btn{display:
inline-block;
background:
url(s_btn.png)
no-repeat
0;
height:
22px;
line-height:
22px;
color:
#666;
vertical-align:top;}
.btn
i{display:block;font-style:
normal;
font-size:
12px;
padding:
10px;
background:url(s_btn.png)
no-repeat
right
-22px;
}
.btn:hover{text-decoration:
none;color:#4c8136;background-position:
-44px;}
.btn:hover
i{background-position:
right
-66px;}
.btn:active{background-position:
-88px;}
.btn:active
i{background-position:
right
-110px;}
.btn_disabled,
.btn_disabled:hover{background:
url(../img/s_btn.png)
no-repeat
-132px;cursor:
default;}
.btn_disabled
i,
.btn_disabled:hover
i,
.s_btn_disabled:active
i{background-position:
right
-154px;color:#999;}
/style
/head
body
a
href="#"
class="btn"
i這是按鈕/i
/a
a
href="#"
class="btn"
i按鈕/i
/a
/body
/html
效果:
css設(shè)置按鈕樣式的方法:定義一個(gè)css選擇器,然后在按鈕標(biāo)簽中使用此選擇器即可設(shè)置按鈕樣式。使用:hover偽類(lèi)選擇器可以設(shè)置按鈕 交互時(shí)樣式。
需要準(zhǔn)備的材料分別有:電腦、瀏覽器、html編輯器。
1、首先,打開(kāi)html編輯器,新建html文件,例如:index.html。
2、在index.html中的style標(biāo)簽中,輸入css代碼:
button {border:0;width: 200px;height: 80px;background-color: gainsboro; cursor: not-allowed}
3、瀏覽器運(yùn)行index.html頁(yè)面,此時(shí)通過(guò)css實(shí)現(xiàn)了按鈕的禁用樣式。
用CSS代碼設(shè)定按鈕的圓角樣式,這個(gè)在css3中才能實(shí)現(xiàn),通過(guò)使用border-radius來(lái)實(shí)現(xiàn)這個(gè)效果,不過(guò)有瀏覽器的兼容性問(wèn)題,-moz(例如 -moz-border-radius)用于Firefox;-webkit(例如:-webkit-border-radius)用于Safari和Chrome;border-radius:5px 15px 20px 25px;它的意思就是上的圓角5px,右的圓角15px,下的圓角20px,左的圓角25px,通過(guò)例子來(lái)實(shí)際看下:
div id="round"/div
#round {
padding:10px; width:300px; height:50px;
border: 5px solid #dedede;
-moz-border-radius: 15px; ? ? ?/* Gecko browsers */
-webkit-border-radius: 15px; ? /* Webkit browsers */
border-radius:15px; ? ? ? ? ? ?/* W3C syntax */
}
效果如圖:
html
head
title按鈕超鏈接/title
style
!--
a{ /* 統(tǒng)一設(shè)置所有樣式 */
font-family: Arial;
font-size: .8em;
text-align:center;
margin:3px;
}
a:link, a:visited{ /* 超鏈接正常狀態(tài)、被訪(fǎng)問(wèn)過(guò)的樣式 */
color: #A62020;
padding:4px 10px 4px 10px;
background-color: #ecd8db;
text-decoration: none;
border-top: 1px solid #EEEEEE; /* 邊框?qū)崿F(xiàn)陰影效果 */
border-left: 1px solid #EEEEEE;
border-bottom: 1px solid #717171;
border-right: 1px solid #717171;
}
a:hover{ /* 鼠標(biāo)經(jīng)過(guò)時(shí)的超鏈接 */
color:#821818; /* 改變文字顏色 */
padding:5px 8px 3px 12px; /* 改變文字位置 */
background-color:#e2c4c9; /* 改變背景色 */
border-top: 1px solid #717171; /* 邊框變換,實(shí)現(xiàn)“按下去”的效果 */
border-left: 1px solid #717171;
border-bottom: 1px solid #EEEEEE;
border-right: 1px solid #EEEEEE;
}
--
/style
/head
body
a href="#"首頁(yè)/a
a href="#"心情日記/a
a href="#"學(xué)習(xí)心得/a
a href="#"工作筆記/a
a href="#"生活瑣碎/a
a href="#"其他/a
/body
/html
當(dāng)前名稱(chēng):按鈕css樣式代碼,css 按鈕樣式
網(wǎng)站地址:http://chinadenli.net/article33/dsgsjss.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站維護(hù)、App設(shè)計(jì)、網(wǎng)站建設(shè)、微信小程序、關(guān)鍵詞優(yōu)化、網(wǎng)站導(dǎo)航
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
移動(dòng)網(wǎng)站建設(shè)知識(shí)