web常用網(wǎng)站整理
在線工具類
常用代碼塊
移動端適配
<script>
//屏幕適應(yīng)
(function (win, doc) {
if (!win.addEventListener) return;
var html = document.documentElement;
function setFont() {
var html = document.documentElement;
var k = 640;
html.style.fontSize = html.clientWidth / k * 100 + "px";
}
setFont();
setTimeout(function () {
setFont();
}, 300);
doc.addEventListener('DOMContentLoaded', setFont, false);
win.addEventListener('resize', setFont, false);
win.addEventListener('load', setFont, false);
})(window, document);
</script>
兼容模式(強制使用ie8來解析)
<meta http-equiv=“X-UA-Compatible” content=“IE=8″>
Google Chrome Frame也可以讓IE用上Chrome的引擎:強制IE8使用IE6或IE5模式來解析
<meta http-equiv=“X-UA-Compatible” content=“IE=6″><!– IE6 mode –>
<meta http-equiv=“X-UA-Compatible” content=“IE=5″><!– IE5 mode –>
<meta http-equiv=“X-UA-Compatible” content=“chrome=1″ />
推薦使用如下:
<meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″ />
解決PNG顯示問題
只需將透明png圖片命名為*-trans.png
需要注意的是:此方法對背景平鋪(background-repeat)和背景(background-position)無法起到任何作用,
默認會占滿整個容器干签。
瀏覽器版本過低拆撼,提示升級
<!--[if lt IE 9]>
<p class="pa chromeframe">您使用的IE瀏覽器版本過低,本站不再支持闸度,<a href="http://windows.microsoft.com
/">升級您的IE瀏覽器</a>竭贩,或使用<a href="http://www.google.cn/chrome/
">Google Chrome</a>、<a href="http://www.firefox.com.cn/download/
">Firefox</a>等高級瀏覽器莺禁,將會得到更好的體驗!</p>
<![endif]-->
css實現(xiàn)文字漸變
background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(#ffff71), to(#ffc84a));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display=inline-block 解決IE8以下不兼容
display:inline-block;*zoom:1;*display: inline;
注:可改用float來解決
在線調(diào)用QQ交談
onclick="javascript:window.open('http://wpa.qq.com/msgrd?v=1&uin=239992698&site=qq&menu=yes');"
郵件發(fā)送
<a href="mailto:zhangrr601@163.com?subject=這是郵件的主題&body=這是郵件的內(nèi)容" rel="nofollow">普通發(fā)送郵件</a>
<br>
<a href="mailto:zhangrr601@163.com?cc=someone@163.com&bcc=somebody@163.com" rel="nofollow">帶抄送密送發(fā)送郵件</a>