加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 综合聚焦 > 编程要点 > 语言 > 正文

简述css中的一些实用属性操作

发布时间:2023-08-05 14:25:48 所属栏目:语言 来源:
导读:   本文主要给大家分享一下css中的一些实用属性操作,对新手学习CSS有一定的帮助,使用起来也是事半功倍,那么接下来我们就具体的了解看看,都有哪些css属性操作吧。

  1、自定义文本选择

  ::select
    本文主要给大家分享一下css中的一些实用属性操作,对新手学习CSS有一定的帮助,使用起来也是事半功倍,那么接下来我们就具体的了解看看,都有哪些css属性操作吧。
 
  1、自定义文本选择
 
  ::selection {
 
    background: red;
 
    color: black;
 
  }
 
  2、去掉video的controls中的下载按钮
 
  video::-internal-media-controls-download-button {
 
      display:none;
 
  }
 
  video::-webkit-media-controls-enclosure {
 
      overflow:hidden;
 
  }
 
  video::-webkit-media-controls-panel {
 
      width: calc(100% + 30px);
 
  }
 
  3、css3特性中的transform:translateZ(0)有什么作用
 
  GPU加速,优化前端性能
 
  4、滚动条样式修改
 
  /* * 可以换其他选择器 */
 
  *::-webkit-scrollbar {
 
      width: 2px;
 
    height: 2px;
 
  }
 
  *::-webkit-scrollbar-thumb {
 
    border-radius: 5px;
 
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
 
      -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
 
    background: #00063a;
 
  }
 
  *::-webkit-scrollbar-track {
 
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
 
      -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
 
      border-radius: 0;
 
    background: #00063a;
 
  }
 
  5、input type number 隐藏上下按钮
 
  input::-webkit-outer-spin-button,
 
  input::-webkit-inner-spin-button {
 
      -webkit-appearance: none;
 
  }
 
  input[type="number"]{
 
      -moz-appearance: textfield;
 
  }
 
  6、css渐变虚框
 
  <style>
 
      .box {
 
          width: 150px;
 
          border: 2px dashed #fff;
 
          background: linear-gradient(to bottom, #34538b, #cd0000);
 
          background-origin: border-box;
 
      }
 
      .content {
 
          height: 100px;
 
          background-color: #fff;
 
      }
 
  </style>
 
  <div class="box">
 
      <div class="content"></div>
 
  </div>
 
 
  7、border渐变色圆角
 
  <style type="text/css">
 
   .content {
 
   width: 100px;
 
       height: 100px;
 
       box-sizing: border-box;
 
       padding: 5px;
 
       border-radius: 50%;
 
       background-image: -webkit-linear-gradient(top, red 0%, blue 30%, yellow 60%, green 90%);  
 
       background-image: -moz-linear-gradient(top, red 0%, blue 30%, yellow 60%, green 90%);
 
       background-image: linear-gradient(top, red 0%, blue 30%, yellow 60%, green 90%);  
 
   }
 
   .box {
 
   width:100%;
 
       height:100%;
 
       border-radius:50%;
 
       background:#fff;
 
   }
 
  </style>
 
  <div class="content">
 
   <div class="box"></div>
 
  </div>
 
 
  8、输入框光标变色,文字不变色
 
  
 
  input{
 
      caret-color: red;
 
  }
 
 
  9、锥形渐变
 
  .box {
 
      width: 300px; height: 300px;
 
      background: conic-gradient(from 45deg, white, black, white);
 
  }
 
 
  10、 text-decoration实现波浪线
 
  wavy {
 
      display: block;
 
      height: .5em;
 
      white-space: nowrap;
 
      letter-spacing: 100vw;
 
      padding-top: .5em;
 
      overflow: hidden;
 
  }
 
  wavy::before {
 
      content: "\2000\2000";
 
      /* IE浏览器实线代替 */
 
      text-decoration: overline;
 
      /* 现代浏览器 */
 
      text-decoration: overline wavy;
 
  }
 
 
  11、css三角形
 
  <style type="text/css" media="screen">
 
  .div1{
 
   width: 0;
 
   height: 0;
 
   border: 100px solid;
 
   <!--上右下左-->
 
   border-color: red transparent transparent transparent;
 
  }
 
  </style>
 
  <div class="div1"></div>

  12、css背景渐变与背景图片并存
 
  background: url(https://img.alicdn.com/imgextra/i4/1881744325/O1CN01JBktT81hotb8c6Py0_!!1881744325.png)
 
  center no-repeat,linear-gradient(to bottom,red,#3c3f40);

  13、自定义浏览器滚动条
 
  /*定义滚动条宽高及背景,宽高分别对应横竖滚动条的尺寸*/
 
  ::-webkit-scrollbar {
 
      width: 5px;
 
      height: 5px;
 
      background-color: rgba(245, 245, 245, 0.47);
 
  }
 
  /*定义滚动条的轨道,内阴影及圆角*/
 
  ::-webkit-scrollbar-track {
 
      -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
 
      border-radius: 10px;
 
      background-color: #f5f5f5;
 
  }
 
  /*定义滑块,内阴影及圆角*/
 
  ::-webkit-scrollbar-thumb {
 
      /*width: 10px;*/
 
      height: 20px;
 
      border-radius: 10px;
 
      -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
 
      background-color: rgba(85, 85, 85, 0.25);
 
  }
 
  14、改变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;
 
  }
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章