css 常用技巧

文本超出分号:

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

overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-break: break-all;

-webkit-line-clamp: 2;
-moz-line-clamp: 2;
-o-line-clamp: 2;
-ms-line-clamp: 2;

媒介查询

/* iphone4 */
@media screen and (device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2){}
/* iphone5 */
@media screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2){}
屏幕在1200-1500之间
@media screen and (min-width:1200px) and (max-width:1500px){}

禁止IOS滚动条

阻止默认
$("body").on("touchmove",function(event){
event.preventDefault;
}, false)
然后点击取消或者确定时再取消body上的绑定
$("body").off("touchmove");
li:nth-of-type(odd)单数
li:nth-of-type(even) 偶数
text-decoration:line-through;  上划线
li:last-child  最后一个元素


图片上下居中
display:table-cell;
text-align:center;
vertical-align:middle;

图片上下居中 flaot
.goods_indexTwo a .right{
 width: 126px;
 height: 180px;
 display: flex;
 align-items: center;
}
.goods_indexTwo a .right img{
 width: 126px;
 height: auto;
 display: inline-block;
 vertical-align: middle;
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • CSS Sprite(雪碧图|精灵图)指什么? 有什么作用CSS Sprite指的是包含许多不同的图标、按钮或图形...
    coolheadedY阅读 2,662评论 1 2
  • 一、背景图片和背景图的区别 背景色做代码一般用英文单词就可以,但是做网站建议用十六进制background-col...
    崔敏嫣阅读 1,414评论 0 0
  • 1.左右布局 用浮动来实现: 然后,CSS这样写 div#child1,div#child2, {float...
    zzyo96阅读 2,415评论 0 0
  • 1、使用CSS3 box-shadow制作同心圆: 最后的效果: 2、用HTML、CSS制作一个对话框尖角 首先理...
    何大必阅读 1,517评论 0 0
  • Css常用技巧 1.单行省略
    时修七年阅读 1,580评论 0 0

友情链接更多精彩内容