CSS 宝典

input点击时候,有个灰块

outline:medium;
-webkit-tap-highlight-color:rgba(0,0,0,0);
-webkit-user-modify:read-write-plaintext-only;

 

横向滚动。

.container {
    overflow-x: scroll;
    overflow-y:hidden;
    white-space:nowrap;
    padding: 15px 0px 20px;
    .item {
        display: inline-block;
        width: 33%;
        img {
            width: 70%;
        }
    }
}

 

 宽度计算。android4.3不兼容。android4.4部分兼容

width: calc(~'100% - 54px');

CSS单行省略号:

overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;

CSS多行省略号:(padding过大,会无效果)

display: -webkit-box;
text-overflow: ellipsis;
overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;

 CSS垂直剧中  flex

.y-item-img-bg {
    position: absolute;
    right: 6%;
    top: 10px;
    width: 30%;
    height: 80px;
    display: flex;
    display: -webkit-flex;
    text-align: center;
    align-items: center;
    justify-content: center;
    img {
        max-width: 100%;
        max-height: 100%;
    }
}

 CSS正方形(头图) padding-bottom: 100% 。(height:100%。 会导致图片更改图片比例,若图片不是正方形,图片会被压缩。)

.img-bg{
    position: relative;
    height: 0;
    margin: 0;
    overflow: hidden;
    padding-bottom: 100%;
    .item-img {
        position: absolute;
        top: 0px;
        left: 0px;
        bottom: 0px;
        width: 100%;
        height: 100%;
    }
}

 

1像素line。  transform 是关键。

:global .line {
      width: 100%;
      height: 1px;
      background-color: #EBEBEB;
      -webkit-transform: scale(1, 0.5);
      transform: scale(1, 0.5);
    }

 

input placeholder 设置

        input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { 
            color: #cccccc; 
        } 
        input:-moz-placeholder, textarea:-moz-placeholder { 
            color: #cccccc; 
        } 
        input::-moz-placeholder, textarea::-moz-placeholder { 
            color: #cccccc; 
        } 
        input:-ms-input-placeholder, textarea:-ms-input-placeholder { 
            color: #cccccc; 
        }

屏幕宽度

document.documentElement.clientWidth

 

转载于:https://www.cnblogs.com/penn-wang/p/5524746.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值