日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

(原)各种输入框美化

發(fā)布時間:2024/4/15 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 (原)各种输入框美化 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

更新于20161124

?(均可兼容IE8以上)

1. input[type=file]

  如圖

  ? ? ??

? ? ? ? ? ? ? ? ? ? ?上傳圖片前 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 上傳圖片后

?

<div class="claCreate_ipt"><div id="preview"><img id="imghead" src='./images/class_img4.png' /></div><a href="javascript:;" class="uploadBtn">上傳<input type="file" onchange="previewImage(this)" /></a> </div>

.claCreate_ipt{padding-left: 18px; }.claCreate_ipt input[type=text]{border: solid 1px #b29a91;border-radius: 10px;color: #b29a91;padding: 0 20px;height: 28px;width: 286px; }/* 頭像上傳 */ #imghead {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);}.uploadBtn, #preview{float: left; }#imghead{width: 118px;height: 118px; }.uploadBtn {position: relative;display: inline-block;background-color: #ecb43b;border-radius: 6px;padding: 6px 24px;overflow: hidden;color: #fff;text-indent: 0;font-size: 18px;top: 78px;margin-left: 32px;line-height: 26px; } .uploadBtn input {position: absolute;right: 0;top: 0;bottom: 0;left: 0;opacity: 0; } .uploadBtn:hover {background-color: #f0b73c;text-decoration: none; } /* 頭像上傳 END*/ //圖片上傳預(yù)覽 IE是用了濾鏡。 function previewImage(file) {var MAXWIDTH = 118; var MAXHEIGHT = 118;var div = document.getElementById('preview');if (file.files && file.files[0]){div.innerHTML ='<img id=imghead>';var img = document.getElementById('imghead');img.onload = function(){var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);img.width = rect.width;img.height = rect.height; // img.style.marginLeft = rect.left+'px';img.style.marginTop = rect.top+'px';}var reader = new FileReader();reader.onload = function(evt){img.src = evt.target.result;}reader.readAsDataURL(file.files[0]);}else //兼容IE {var sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';file.select();var src = document.selection.createRange().text;div.innerHTML = '<img id=imghead>';var img = document.getElementById('imghead');img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);status =('rect:'+rect.top+','+rect.left+','+rect.width+','+rect.height);div.innerHTML = "<div id=divhead style='width:"+rect.width+"px;height:"+rect.height+"px;margin-top:"+rect.top+"px;"+sFilter+src+"\"'></div>";} } function clacImgZoomParam( maxWidth, maxHeight, width, height ){var param = {top:0, left:0, width:width, height:height};if( width>maxWidth || height>maxHeight ){rateWidth = width / maxWidth;rateHeight = height / maxHeight;if( rateWidth > rateHeight ){param.width = maxWidth;param.height = Math.round(height / rateWidth);}else{param.width = Math.round(width / rateHeight);param.height = maxHeight;}}param.left = Math.round((maxWidth - param.width) / 2);param.top = Math.round((maxHeight - param.height) / 2);return param; }

?

?

?

2. select?

? 如圖

  ? ??

<div class="ansIndex_toperSel"><select><option>所有科目</option><option>所有科目1</option></select> </div>

.ansIndex_toperSel{float: left;width: 140px;height: 30px;margin: 17px 60px 0 0;border: none;border-radius: 5px;overflow: hidden;background: url(../images/select.jpg) no-repeat right #fff; }.ansIndex_toperSel select {background: transparent;width: 170px;height: 30px;font-size: 16px;padding: 0 10px;border: none;border-radius: 5px;-webkit-appearance: none; /*for chrome*/ }

?

轉(zhuǎn)載于:https://www.cnblogs.com/microhuu/p/6099744.html

總結(jié)

以上是生活随笔為你收集整理的(原)各种输入框美化的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。