美文网首页
前端工作中常用 CSS

前端工作中常用 CSS

作者: wu_wise | 来源:发表于2022-11-22 09:13 被阅读0次

文字溢出省略号

  1. 文字单行溢出:
overflow: hidden;            // 溢出隐藏
text-overflow: ellipsis;      // 溢出用省略号显示
white-space: nowrap;         // 规定段落中的文本不进行换行
  1. 多行文字溢出:
verflow: hidden;            // 溢出隐藏
text-overflow: ellipsis;     // 溢出用省略号显示
display:-webkit-box;         // 作为弹性伸缩盒子模型显示。
-webkit-box-orient:vertical; // 设置伸缩盒子的子元素排列方式:从上到下垂直排列
-webkit-line-clamp:3;        // 显示的行数

渐变

//渐变(方向)
background: linear-gradient(to right, rgba(255, 255, 255, 0),green,rgba(255,255,255,0));

//渐变(角度)
background: linear-gradient(88deg, red 0%, rgba(77, 247, 191, 0.26) 12%, rgba(77, 247, 191, 0) 100%);

边框渐变:

border有个border-image的属性,类似background也有个background-image一样,通过为其设置渐变颜色后,实现的渐变,后面的数字4为x方向偏移量

.border-grident{
  margin-top: 20px;
  width: 200px;
  height: 200px;
  border: 4px solid;
  border-image: linear-gradient(to right, #8f41e9, #578aef) 4;
}

css伪类三角形:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>css</title>
  <style>
    .triangle {
    width: 0;
    height: 0;
    border: 100px solid;
    border-color: orangered skyblue gold yellowgreen;
}
  </style>
</head>
<body>
  <div class="triangle">
  </div>
</body>
</html>

下三角

.down-triangle {
    width: 0;
    height: 0;
    border-top: 50px solid blue;
    border-right: 50px solid transparent;
    border-left: 50px solid transparent;
}

相关文章

网友评论

      本文标题:前端工作中常用 CSS

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