天天看点

css美化input file按钮的代码方法

??浠??ㄥ??琛ㄥ???????典?锛?input??textarea??button???峰?姣?杈?瀹规??瀹?涔?锛?select??input file???峰??句互瀹?涔???

?

input file?ㄧ郴缁?榛?璁や???澶?瑙?锛?

?

css美化input file按钮的代码方法

??浠???澶???杩?瀹?涔?input??border?ユ?瑰??绯荤?榛?璁ょ??澶?瑙?锛?

?

css美化input file按钮的代码方法

濡???瑕?璁╂?瑙??????存?浜?涓??癸???浠??冲??涔?瀹???????棰??诧????虫?崇?ㄨ?????剧???ヤ唬?匡???杩?css瀹?涔?input flie杩???????涓??扮?????剁?剁???颁?绡???绔?锛?input file ??浠堕???╂?缇??? 浣???????绯荤?榛?璁ょ??????璁剧疆????搴?负0锛???瀹?涔?涓?涓?label??绛炬?峰?锛??ヨ?????????????????

???т??????规?锛???涔?璇?楠?浜?涓?涓?锛?浠g??濡?涓?锛?

?

<!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" 慰nm慰use慰ut="document.getElementById('upload').style.display='none';" class="inputstyle" />

</span>

<label for="unload" 慰nm慰use慰ver="document.getElementById('upload').style.display='block';" class="file1">娴?瑙?...</label>

<input type="file" 慰nchange="document.getElementById('viewfile').value=this.value;this.style.display='none';" class="file" id="upload" />

</div>

</body>

</html>

?