成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

用CSS美化之inputfile按鈕

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

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

代碼如下:

<!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>

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

標(biāo)題名稱:用CSS美化之inputfile按鈕
URL地址:http://jinyejixie.com/news30/321980.html

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

廣告

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

成都網(wǎng)站建設(shè)公司
顺昌县| 蒲城县| 福州市| 都兰县| 桑植县| 东兴市| 峡江县| 巴林左旗| 商河县| 武鸣县| 阜城县| 和林格尔县| 宁明县| 吉林市| 南康市| 安化县| 新昌县| 罗田县| 克东县| 阳泉市| 甘泉县| 成都市| 塔河县| 呼伦贝尔市| 邯郸市| 松阳县| 香河县| 绥宁县| 冷水江市| 左云县| 彩票| 平顺县| 广宁县| 隆德县| 英山县| 始兴县| 大荔县| 错那县| 海淀区| 台南县| 莎车县|