欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

用CSS美化之inputfile按鈕

2024-03-27    分類: 網(wǎng)站建設

如果要讓瀏覽按鈕更漂亮一點,我們想定義它的背景顏色,甚至想用背景圖片來代替,通過css定義input flie還真是辦不到的。偶然看到一篇文章:input file 文件選擇框美化 作者是把系統(tǒng)默認的按鈕設置透明度為0,再定義一個label標簽樣式,來覆蓋透明掉的按鈕。

代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>input file的另類做法</title> <style type="text/css"> <!-- * { font-size:12px} body { margin:0} .line { position:relative; float:left; padding:8px 0} .line span { float:left} input { border:1px solid #888; vertical-align:middle} .file { position:absolute; left:90px; top:8px; display:none;filter:alpha(opacity=0);opacity:0} .file1 { padding:2px 10px; display:block; float:left; background:#FF66CC; color:#fff; z-index:1; margin-left:5px; vertical-align:middle; cursor: pointer} .inputstyle { width:150px; border:1px solid #888; z-index:99} --> </style> </head> <body> <div class="line"> <span> <label>上傳文件:</label> <input name="" type="text" id="viewfile" onmouseout="document.getElementById('upload').style.display='none';" class="inputstyle" /> </span> <label for="unload" onmouseover="document.getElementById('upload').style.display='block';" class="file1">瀏覽...</label> <input type="file" onchange="document.getElementById('viewfile').value=this.value;this.style.display='none';" class="file" id="upload" /> </div> </body> </html>

雖然多了很多標簽,但這種偷梁換柱的做法還是值得研究。有沒有更好、更科學的作法還有待發(fā)掘.

標題名稱:用CSS美化之inputfile按鈕
URL地址:http://www.chinadenli.net/news30/321980.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供自適應網(wǎng)站靜態(tài)網(wǎng)站Google外貿(mào)網(wǎng)站建設商城網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設公司