首页 > Web开发 > 详细

css之坑

时间:2016-05-27 18:13:26      阅读:147      评论:0      收藏:0      [点我收藏+]

1、background-size要放在background后边才会生效。

2、隐藏滚动条,内容可以滑动

body::-webkit-scrollbar {
  display: none
 /* 隐藏滚动条,但依旧具备可以滚动的功能 */
}

3、导航栏固定

position: fixed;
top:0px;
//bottom: 0;//固定在底部

在中间部分相对定位,就不会消失  

4、rem 是相对于根元素计算的,rem值=当前px除以根元素。如:根元素为16px,需要一个18px的字体,只要18/16=1.125rem.

  

(function () {
      var t;
      function initHtmlFont(){
          var maxWidth = 640;
          var html = document.documentElement;
          var windowWidth = html.clientWidth;
            var windowWidth = html.clientWidth>maxWidth?maxWidth:html.clientWidth;
         
          html.style.fontSize?=?(windowWidth/640)*200+‘px‘;  
      }
      window.onresize = function(){
        clearTimeout(t);
        t = setTimeout(initHtmlFont,250);
      }
      document.addEventListener(‘DOMContentLoaded‘, function () {
        initHtmlFont();
      }, false);
    })();

  

css之坑

原文:http://www.cnblogs.com/qing1304197382/p/5526843.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!