• CSS技巧和经验列表


    如何清除图片下方出现几像素的空白间隙?

    img{display:block;}

    如何让文本垂直对齐文本输入框?

    input{vertical-align:middle;}

    如何使文本溢出边界显示为省略号?

    #test{150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

    如何容器透明,内容不透明?

    .outer{200px;height:200px;background:#000;filter:alpha(opacity=20);opacity:.2;}

    如何区别display:none与visibility:hidden?

    相同的是display:none与visibility:hidden都可以用来隐藏某个元素; 不同的是display:none在隐藏元素的时候,将其占位空间也去掉;而visibility:hidden只是隐藏了内容而已,其占位空间仍然保留。

    如何解决IE7及更早浏览器下当li中出现2个或以上的浮动时,li之间产生的空白间隙的BUG?

    li{vertical-align:top;}

    如何解决按钮在IE7及更早浏览器下随着value增多两边留白也随着增加的问题?

    input,button{overflow:visible;}

    如何解决Chrome在应用transition时页面闪动的问题?

    -webkit-transform-style:preserve-3d;或-webkit-backface-visibility:hidden;

    如何在IE6及更早浏览器中定义小高度的容器?

    #test{overflow:hidden;height:1px;font-size:0;line-height:0;}

    为什么Standard mode下IE无法设置滚动条的颜色?

    html{
        scrollbar-3dlight-color:#999;
        scrollbar-darkshadow-color:#999;
        scrollbar-highlight-color:#fff;
        scrollbar-shadow-color:#eee;
        scrollbar-arrow-color:#000;
        scrollbar-face-color:#ddd;
        scrollbar-track-color:#eee;
        scrollbar-base-color:#ddd;
    }

    将原来设置在body上的滚动条颜色样式定义到html标签选择符上即可

    如何让已知高度的容器在页面中水平垂直居中?

    #test{position:absolute;top:50%;left:50%;200px;height:200px;margin:-100px 0 0 -100px;}

    如何让未知尺寸的图片在已知宽高的容器内水平垂直居中?

    #test{display:table-cell;*display:block;*position:relative;200px;height:200px;text-align:center;vertical-align:middle;}
    #test p{*position:absolute;*top:50%;*left:50%;margin:0;}
    #test p img{*position:relative;*top:-50%;*left:-50%;vertical-align:middle;}

    如何使页面文本行距始终保持为n倍字体大小的基调?

    body{line-height:n;}
     


  • 相关阅读:
    linux安装uwsgi,报错问题解决
    centos7 安装 mysql
    centos7 安装 redis
    Python 第三方登录 实现QQ 微信 微博 登录
    39个前端精美后台模板
    Excel中replace函数使用方法
    Excel实用录入技巧
    Excel的快速录入
    Excel表格规范
    Excel快捷键大全 Excel2013/2010/2007/2003常用快捷键大全
  • 原文地址:https://www.cnblogs.com/u-lhy/p/7062001.html
Copyright © 2020-2023  润新知