美文网首页
细滚动条样式

细滚动条样式

作者: 林ze宏 | 来源:发表于2018-05-24 15:47 被阅读0次

/*定义滚动条宽高及背景,宽高分别对应横竖滚动条的尺寸*/
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background-color: rgba(255, 255, 255, 0);
}

/*定义滚动条的轨道,内阴影及圆角*/
*::-webkit-scrollbar-track {
  border-radius: 10px;
  background-color: rgba(230, 230, 230, 0.05);
}

*:hover::-webkit-scrollbar-track {
  background-color: rgba(230, 230, 230, 0.5);
}

/*定义滑块,内阴影及圆角*/

*::-webkit-scrollbar-thumb {
  height: 20px;
  border-radius: 10px;
  -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
  background-color: rgba(216, 216, 216, 0.4);
  transition: background-color 1s;
}

*:hover::-webkit-scrollbar-thumb {
  background-color: rgba(216, 216, 216, 1);
}

*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(190, 190, 190, 1);
}

*::-webkit-scrollbar-thumb:active {
  background-color: rgba(160, 160, 160, 1);
}

几种布局

  • 左右布局,左边查询条件响应式变化,右边查询按钮规定大小且位置不变


    布局一
    input样式
    button样式
说明:外框父节点宽度100%,padding很重要,即使是padding了,位置还是输入父节点的;input 宽度100%,但是,不会占据父节点的padding位置;button 使用 absolute 定位到父节点padding的位置。
.search_item{
    width: 100%;
    position: relative;
    padding-right: 60px;
}
.search_item input {
    width: 100%;
    height: 50px;
    border: none;
    outline-style: none;
}
 .search_item .search_btn {
    position: absolute;
    top: 5px;
    right: 0;
    height: 42px;
    width: 42px;
    border-radius: 50%;
    padding: 0;
    font-size: 20px;
}

相关文章

网友评论

      本文标题:细滚动条样式

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