溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

前端開發(fā)代碼模版收錄

發(fā)布時間:2020-04-03 00:13:28 來源:網(wǎng)絡(luò) 閱讀:483 作者:藝晨光 欄目:開發(fā)技術(shù)

一、創(chuàng)建html

<!DOCTYPE html>
<html lang="zn-CN">
<head >
    <meta charset="UTF-8">
    <!--ie8~ie10  使用電腦上IE最新的文檔模式edge渲染頁面  ie11已放棄兼容模式,本身兼容已經(jīng)很好了-->
    <meta http-equiv="x-ua-compatible" content="IE=edge">
    <!--移動端響應(yīng)式設(shè)置-->
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1, minimum-scale=1, user-scalable=no">
    <!--SEO-->
    <meta name="keywords" content="購物,電商">
    <meta name="description" content="綜合購物平臺">
    <title>網(wǎng)頁標(biāo)題</title>
    <link rel="stylesheet" href="css/normalize.css"/>
    <link rel="stylesheet" href="css/main.css"/>
</head>
<body>
<!--版本小于等于ie8處理-->
<!--[if lte IE 8]>
<p class="browserupgrade">您的瀏覽器版太舊了,請到 <a href="http://browsehappy.com">這里</a>更新,以獲取最佳的體驗</p>
<![endif]-->
<header>
</header>
<div class="container">
</div>
<footer>
</footer>
</body>
</html>


二、基本css

    1、初始化頁面(normalize.css):http://down.51cto.com/data/2318760

    2、常用基本樣式、工具樣式 (pc上使用rem的話,需要考慮下css3屬性rem的兼容性)

/* ===================
    基本默認(rèn)值
    ================== */
html{
    font-size: 125%;/* 瀏覽器默認(rèn)16px*125%=20px,頁面中使用1rem=20px */
    color: #222;
}
::selection{
    background-color: #b3d4fc;
    text-shadow: none;
}/* 設(shè)置文字選中的顏色,以及是否有陰影 */

ul{
    margin: 0;
    padding: 0;
}
li{
    list-style: none;
}

/* =====================
    工具樣式
    ==================== */
.center-block{
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.pull-right{
    float: right; !important;
}
.pull-left{
    float: left; !important;
}
.text-right{
    text-align: right; !important;
}
.text-left{
    text-align: left; !important;
}
.text-center{
    text-align: center; !important;
}
.hide{
    display: none; !important;
}
.show{
    display: block; !important;
}

.invisible{
    visibility: hidden;
}/* 不僅隱藏元素,而且不占用空間 */

.text-hide{
    font: 0/0 a;
    color: transparent;
    text-shadow: none;
    background-color: transparent;
    border: 0;
}/* 隱藏文本 */

.clearfix:before,
.clearfix:after{
    content:"";
    display: table;
}/* 清除浮動1  使用:before可以防止本元素的頂部margin與上方元素的底部margin發(fā)生重疊*/

.clearfix:after{
    clear: both;
}/* 清除浮動2 */

/* ======================
    瀏覽器更新提示
    ===================== */
.browserupgrade{
    margin: 0;
    padding: 0.5rem;
    background: #cccccc;
}

/* ====================
    自定義頁面樣式
    =================== */
body{
    font-size: 0.6rem;
    font-family: normal normal,microsoft yahei,Arial,sans-serif;
    line-height: 1.5;
    background-color: #f7f7f7;
}
a{
    color: #666666;
    text-decoration: none;
}
a:hover,a:active{
    color: #0ae;
    text-decoration: underline;
}


三、移動端rem處理 (已1rem=30px為例)

(function() {
  var iWidth = document.documentElement.getBoundingClientRect().width;
  iWidth = iWidth > 750 ? 750 : iWidth;
  document.getElementsByTagName('html')[0].style.fontSize = iWidth / 25 + 'px';
})();


附:

  1、顏色拾取器(美工必備屏幕顏色吸取器) http://down.51cto.com/data/2318767

  2、10個HTML5美化版復(fù)選框和單選框:http://www.html5tricks.com/10-pretty-checkbox-radiobox.html

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI