微信的css重置及字体变动<移动端 一>

common/  adaptational.js

//$(document).ready(function(){
    //通过手机屏幕dpr和手机宽度来确定font-size的值

    function autorun() {

        //初始值

        var default_width = 20;

        var default_dpr = 2;

        var dpr = window.devicePixelRatio;

        var width = parseInt($(window).width());

        var html_style = '';

        var body_style = '';

        //dpr倍数

        var difference = dpr / default_dpr;

        //计算

        if (difference === 1) {

            var default_min_size = 20 * difference;

            var default_max_size = 33.75 * difference;

            var default_coefficient = 0.0625 * difference;

            html_style = get_font_size(width, default_min_size, default_max_size, default_coefficient);

            body_style = 'font-size:' + difference * 12 + 'px';

        } else {

            html_style = get_font_size(width, 20, 33.75, 0.0625);

            //body_style = 'font-size:12px';

        }

        //进行dom操作

        $("html").attr('style', html_style);

        //$("body").attr('style', body_style);

    }
    /**

     * 通过手机屏幕dpr和手机宽度来确定font-size的值

     * @param {int} width

     * @param {int} default_min_size

     * @param {int} default_max_size

     * @param {int} default_coefficient

     * @returns {String}

     */

    function get_font_size(width, default_min_size, default_max_size, default_coefficient) {

        var style = '';

        //屏幕宽度需要在320-540之间进行计算

        if (width < 320) {

            style = 'font-size:' + default_min_size + 'px';

        } else if (width > 540) {

            style = 'font-size:' + default_max_size + 'px';

        } else {

            var difference = width - 320;

            var fontsize = default_min_size + difference * default_coefficient;

            style = 'font-size:' + fontsize + 'px';

        }

        return style;

    }
    autorun();

//})

reset.css 重置css

/*reset*/
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    font-family:"微软雅黑","黑体","_sans",Arial;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-size:125%;
}

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td, hr, button, article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    box-sizing:border-box;
}
fieldset, img {
    border: 0
}
address, caption, cite, code, dfn, em, th, var, i, b {
    font-style: normal;
    font-weight: 500
}

ol, ul {
    list-style: none
}

h1, h2, h3, h4, h5, h6, b {
    font-size: inherit;
    font-weight: 500
}
q:before, q:after {
    content: ''
}

a:visited, a:hover {
    color: #000;
    text-decoration: none
}
html {
    height: 100%
}

body {
    min-height: 100%
}

input, select, textarea {
    font-size: 100%
}

ins, a {
    text-decoration: none
}

a,input, textarea{
    color: #000;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
input[type="button"], input[type="submit"], input[type="reset"] {
    -webkit-appearance: none;
}
input {
    background:no-repeat 0 0 scroll #eee;
    border:none;
    outline:medium; /* 在浏览器下面,点击input输入时,会有边框,只要在样式中应用:outline:medium;即可去掉边框。 */
    padding:0; /*input默认有上下padding*/
}

/* 隐藏滚动条 */
::-webkit-scrollbar { width: 0; }
input:not([type="checkbox"]), select, textarea { outline: none; border: none; -webkit-appearance: none; }


body{
    overflow-x: hidden;
}
.c_f3f3f3{
    background:#f3f3f3;
}
.wraper{
    padding-bottom: 5.8rem;
    padding-top:6.7rem;
}

 

html {
    background: #e5e5e5;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    font-family:"Arial","微软雅黑","黑体","_sans";font-size:125%;
}

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td, hr, button, article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    box-sizing:border-box;
}

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
    display: block;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0)
}

audio, canvas, video {
    display: inline-block;
    *display: inline;
    *zoom: 1
}

table {
    border-collapse: collapse;
    border-spacing: 0
}

th {
    text-align: inherit
}

fieldset, img {
    border: 0
}

iframe {
    display: block
}

abbr, acronym {
    border: 0;
    font-variant: normal
}

del {
    text-decoration: line-through
}

address, caption, cite, code, dfn, em, th, var, i, b {
    font-style: normal;
    font-weight: 500
}

ol, ul {
    list-style: none
}

h1, h2, h3, h4, h5, h6, b {
    font-size: inherit;
    font-weight: 500
}

q:before, q:after {
    content: ''
}

a:visited, a:hover {
    color: #000;
    text-decoration: none
}

html {
    height: 100%
}

body {
    min-height: 100%;
    background:#f3f5f7;
}

input, select, textarea {
    font-size: 100%
}

ins, a {
    text-decoration: none
}

a,input, textarea{
    color: #000;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
input[type="button"], input[type="submit"], input[type="reset"] {
    -webkit-appearance: none;
}
input {
    background:no-repeat 0 0 scroll #EEEEEE;
    border:none;
    outline:medium; /* 在浏览器下面,点击input输入时,会有边框,只要在样式中应用:outline:medium;即可去掉边框。 */ 
    padding:0; /*input默认有上下padding*/
}

/* 隐藏滚动条 */
::-webkit-scrollbar { width: 0; }
input:not([type="checkbox"]), select, textarea { outline: none; border: none; -webkit-appearance: none; }

 

posted on 2017-11-30 15:46  技术V类  阅读(563)  评论(0)    收藏  举报

导航