1、首先創(chuàng)建一個txt文件,修改后綴名:把.txt改為.html,用記事本打開添加如下代碼:打開瀏覽器,這是一個沒有添加樣式的button,外觀不美觀,而且在不同的瀏覽器下顯示的外觀是不一樣的,所以我們要添加統(tǒng)一的樣式。

我們提供的服務(wù)有:成都網(wǎng)站設(shè)計、做網(wǎng)站、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、玄武ssl等。為上千多家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的玄武網(wǎng)站制作公司
2、按鈕樣式比較多,這樣寫讓代碼不整潔,可閱讀性差,就要用style標(biāo)簽。
3、style type="text/css"/style樣式表。style標(biāo)簽里面表示的是一個樣式表,我們所有的樣式都可以寫到標(biāo)簽中去。這段代碼的意思是:凡是button標(biāo)簽都使用這個樣式。
4、把 樣式表中的 ?button{}改成了.ui_button{},然后在button標(biāo)簽里面加了class屬性,這樣做的意思是,這個button標(biāo)簽使用了名字為ui_button的樣式。
5、通過javascript動態(tài)修改樣式,為了避免用戶多次點擊提交按鈕重復(fù)提交信息,在用戶點擊提交按鈕之后,禁用按鈕,并設(shè)置按鈕字體的顏色為灰色。
6、修改樣式的其他方法:obj.style.cssText = "color:#E1E1E1;background-color:black;";cssText可以寫多個樣式樣式屬性。
7、修改樣式的其他方法:obj.setAttribute("class", "style2");直接更改按鈕標(biāo)簽的class屬性,把指向名為ui_button的樣式改為指向名為style2的樣式。
8、修改樣式的其他方法:link href="css1.css" rel="stylesheet" type="text/css" id="css"/obj.setAttribute("href","css2.css");修改引用外部的樣式表文件,這樣就可以對整個頁面的樣式進(jìn)行全部更新。
用CSS做一個按鈕,添加鏈接,首先給這個按鈕一個id或者是class,然后我們在通過css的width,height來改變這個按鈕的默認(rèn)寬度和高度,在用一個a標(biāo)簽將這個按鈕包裹起來,就能實現(xiàn)鏈接的添加,通過代碼來理解下:
html
head
style
#but{
widht:220px;
height:300px;
}
/style
/head
body
a href='地址'
input type='button' id='but' value='我是一個鏈接'
/a
/body
/html
首先:
遨游用的是IE的內(nèi)核,你在IE里看到的效果跟遨游應(yīng)該是完全一樣的.
其次:
DW不是所見即所得.所以一切以瀏覽器為準(zhǔn).
第三:
a:hover{ =表示鼠標(biāo)經(jīng)過的時候.
color:#ecd8db; =表示字體的顏色
padding:4px 10px; =表示內(nèi)容和邊框之間的距離.
background-color:#ecd8db; =表示背景的顏色.
你沒注意到字體的顏色跟背景的顏色一樣嗎?當(dāng)然看不到字.
解決辦法:把color:#ecd8db;刪了或改其他顏色
第四:
沒仔細(xì)研究為什么出不來效果.
不過可以這樣解決.
把上面的
a{font:18px Arial, Helvetica, sans-serif;
text-align:center;
margin:3px;}
修改成:
a{font:18px Arial, Helvetica, sans-serif;
text-align:center;
margin:3px;
float:left;
display:block;
width:100px;
}
完整代碼如下(直接復(fù)制進(jìn)DreamWeaver就可以了)
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""
html xmlns=""
head
meta http-equiv="Content-Type" content="text/html; charset=gb2312" /
title無標(biāo)題文檔/title
style
a{font:18px Arial, Helvetica, sans-serif;
text-align:center;
margin:3px;
float:left;
display:block;
width:100px;
}
a:link,a:visited{
color:#a62020;
padding:4px 10px;
background-color:#ecd8db;
text-decoration:none;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #eeeeee;
border-right-color: #717171;
border-bottom-color: #717171;
border-left-color: #eeeeee;
}
a:hover{
padding:4px 10px;
background-color:#ecd8db;
text-decoration:none;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #717171;
border-right-color: #eeeeee;
border-bottom-color: #eeeeee;
border-left-color: #717171;
}
/style
/head
body
a href="#"首頁/a
a href="#"心情日記/a
a href="#"學(xué)習(xí)心得/a
a href="#"工作筆記/a
a href="#"生活瑣碎/a
a href="#"其他/a
/body
/html
名稱欄目:css按鈕鏈接樣式,css外部鏈接樣式
轉(zhuǎn)載來源:http://chinadenli.net/article15/dsippdi.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、網(wǎng)頁設(shè)計公司、域名注冊、網(wǎng)站營銷、ChatGPT、移動網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)