美文网首页
Css常见用法

Css常见用法

作者: w_wx_x | 来源:发表于2018-12-27 16:41 被阅读4次
div水平居中
div{
  width:80px;
  height:50px;
  border:1px solid red;
  margin:0 auto;
}
绝对定位居中
// 水平垂直居中
div{
  width:200px;
  height:100px;
  border:1px solid red;
  position:absolute;
  top:50%;
  left:50%;
  margin:-50px 0 0 -100px;     // transform: translateX(-50%) translateY(-50%)
}
//水平居中
div{
  width:200px;
  height:100px;
  border:1px solid red;
  position:absolute;
  margin:0 auto;
  left:0;
  right:0;
}
三角形
.triangle{
  width:0;
  height:0;
  border-width:40px;
  border-style:solid;
  border-color:transparent transparent #ff0000 transparent;
}
消除transition闪屏
.css{
  trandform-style:preserve-3d;
  backface-visibility:hidden;
  perspective:1000
}
.css{
  transform:translate3d(0,0,0)
}
文本溢出
// 单行文本溢出
p{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
// 多行文本溢出
.text-ellipsis{
  display:-webkit-box;                // 将对象作为弹性伸缩盒子模型显示
  -webkit-box-orient:vertical;        // 设置或检索伸缩盒对象的子元素的排列方式
  -webkit-line-clamp:3;               // 限制一个块元素显示的文本行数
  overflow:hidden;
}
图文不可复制
.page{
  -webkit-user-select: none; 
  -ms-user-select: none; 
  -moz-user-select: none; 
  -khtml-user-select: none; 
  user-select: none;
}
placeholder
input::-webkit-input-placeholder { 
    /* WebKit browsers */ 
    font-size:14px; 
    color: #333; 
} 
input::-moz-placeholder { 
    /* Mozilla Firefox 19+ */
    font-size:14px; 
    color: #333; 
} 
input:-ms-input-placeholder { 
    /* Internet Explorer 10+ */
    font-size:14px; 
    color: #333; 
}

相关文章

  • Css常见用法

    div水平居中 绝对定位居中 三角形 消除transition闪屏 文本溢出 图文不可复制 placeholder

  • CSS常见属性

    CSS常见属性 颜色 color属性定义文本颜色。 常见用法: color: green color: #ff66...

  • CSS的常见用法

    CSS左右布局 一般来说,如果有2个块级元素,那么应该是上下排开的,现在要将他们放在一行中,那么需要添加float...

  • 你可能不知道的 transition 技巧与细节

    CSS 中,transition 属性用于指定为一个或多个 CSS 属性添加过渡效果。最为常见的用法,也就是给元素...

  • 任务8-CSS选择器

    课程目标 掌握常见 CSS 选择器的用法 对选择器优先级有一定认识 课程任务 1. CSS选择器常见的有几种? i...

  • python学习笔记:xpath+css

    xpath用法 CSS用法

  • 【Animate.css】CSS动画库

    本节目录 Animate.css简介 Animate.css基础用法 Animate.css配合JS的用法和讲解 ...

  • 任务8_CSS选择器

    课程目标 掌握常见 CSS 选择器的用法 对选择器优先级有一定认识 学习建议 从学 CSS 开始,课程视频里的代码...

  • web前端入门到实战:CSS伪元素(content与counte

    counter基本用法 在CSS里头,counter是个很有意思的功能,最常见得就是如果我们使用list清单,样式...

  • css选择器(8)

    掌握常见 CSS 选择器的用法对选择器优先级有一定认识 学习建议 从学 CSS 开始,课程视频里的代码需要边听、边...

网友评论

      本文标题:Css常见用法

      本文链接:https://www.haomeiwen.com/subject/nlxdlqtx.html