iis服务器助手广告广告
返回顶部
首页 > 资讯 > 前端开发 > html >火狐支持css改变滚动条的属性是什么
  • 671
分享到

火狐支持css改变滚动条的属性是什么

2024-04-02 19:04:59 671人浏览 独家记忆
摘要

本文小编为大家详细介绍“火狐支持CSS改变滚动条的属性是什么”,内容详细,步骤清晰,细节处理妥当,希望这篇“火狐支持css改变滚动条的属性是什么”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学

本文小编为大家详细介绍“火狐支持CSS改变滚动条的属性是什么”,内容详细,步骤清晰,细节处理妥当,希望这篇“火狐支持css改变滚动条的属性是什么”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

火狐支持的改变滚动条的CSS属性有两个:1、scrollbar-color属性,用于设置元素滚动条的颜色,可控制滚动条轨道和滚动条拇指的颜色,语法“scrollbar-color:color|dark|light;”;2、scrollbar-width属性,用于设置显示时元素滚动条的宽度或厚度,语法“scrollbar-width:thin|none|宽度大小值;”。

教程操作环境:windows7系统、css3&&HTML5版、Dell G3电脑。

修改火狐滚动条样式的css属性只有 scrollbar-colorscrollbar-width

scrollbar-color属性

scrollbar-color属性用于设置元素滚动条的颜色。它可用于分别控制滚动条轨道和滚动条拇指的颜色。滚动条的轨迹是滚动条的背景,它保持固定并显示可以滚动的区域。滚动条的拇指指的是滚动条的移动部分,该部分浮点数在轨道的顶部,表示滚动条的当前位置。

  • track(轨道)是指滚动条,其一般是固定的而不管滚动位置的背景。

  • thumb(拇指)是指滚动条通常漂浮在轨道的顶部上的移动部分。

语法:

scrollbar-color:auto | color | dark | light
auto在没有任何其他相关滚动条颜色属性的情况下,滚动条的轨道部分默认平台渲染。
dark显示黑色滚动条,可以是平台提供的滚动条的深色变体,也可以是带深色的自定义滚动条。
light显示一个轻量滚动条,可以是平台提供的滚动条的轻微变体,也可以是带有浅色的自定义滚动条。
<color> <color>将第一种颜色应用于滚动条拇指,第二种颜色应用于滚动条轨道。
scrollbar-color: auto; 

scrollbar-color: dark; 

scrollbar-color: light; 

scrollbar-color: red #00f; 

示例:

<!DOCTYPE html> 
<html> 
<head> 
  <title> 
    CSS | scrollbar-color   </title> 
  <style> 
    .scrollbar-auto { 
      scrollbar-color:auto; 
  
      height:150px; 
      width:200px; 
      overflow-y:scroll; 
      background-color:lightgreen; 
    } 
  </style> 
</head> 
<body> 
  <h2 style="color:green"> 
    GeeksforGeeks   </h2> 
  <b> 
    CSS | scrollbar-color   </b> 
  <p> 
    The container below has     scrollbar-color set to  
    'auto'. 
  </p> 
  <div class="scrollbar-auto"> 
    GeeksforGeeks is a computer science     portal with a huge variety of well     written and explained computer science     and programming articles, quizzes and     interview questions. The portal also     has dedicated GATE preparation and     competitive programming sections. 
  </div> 
</body> 
</html>

火狐支持css改变滚动条的属性是什么

<!DOCTYPE html> 
<html> 
<head> 
  <title> 
    CSS | scrollbar-color   </title> 
  <style> 
    .scrollbar-colored { 
      scrollbar-color:red green; 
        
      height:150px; 
      width:200px; 
      overflow-y:scroll; 
      background-color:lightgreen;  
    } 
  </style> 
</head> 
<body> 
  <h2 style="color:green"> 
    GeeksforGeeks   </h2> 
  <b> 
    CSS | scrollbar-color   </b> 
  <p> 
    The container below has a     red green scrollbar-color. 
  </p> 
  <div class="scrollbar-colored"> 
    GeeksforGeeks is a computer science     portal with a huge variety of well     written and explained computer science     and programming articles, quizzes and     interview questions. The portal also     has dedicated GATE preparation and     competitive programming sections. 
  </div> 
</body> 
</html>

火狐支持css改变滚动条的属性是什么

scrollbar-width属性

scrollbar-width 属性允许开发者设置滚动条出现时的厚度

scrollbar-width属性用于设置显示时元素滚动条的宽度或厚度。此属性可用于以下页面上:用户接口要求元素应更突出地显示,并且缩小滚动条宽度可为元素提供更多空间。

语法:

scrollbar-width:auto | thin | none |len

用法:

scrollbar-width: auto; 

scrollbar-width: thin; 

scrollbar-width: none; 

scrollbar-width: 66px; 

属性值:

  • auto:它用于设置滚动条宽度,以由浏览器自动设置。它是默认值。

<!DOCTYPE html> 
<html> 
      
<head> 
    <title>CSS | scrollbar-width property</title> 
      
    <style> 
        .scrollbar-auto { 
            scrollbar-width:auto; 
            background-color:lightgreen; 
            height:150px; 
            width:200px; 
            overflow-y:scroll; 
        } 
    </style> 
</head> 
  
<body> 
    <h2 style="color:green"> 
        GeeksforGeeks     </h2> 
      
    <b>CSS | scrollbar-width</b> 
      
    <p>scrollbar-width:auto</p> 
      
    <div class="scrollbar-auto"> 
        GeeksforGeeks is a computer science         portal with a huge variety of well         written and explained computer science         and programming articles, quizzes and         interview questions. The portal also  
        has dedicated GATE preparation and         competitive programming sections. 
    </div> 
</body> 
  
</html>

火狐支持css改变滚动条的属性是什么

  • thin:用于将滚动条的宽度设置为默认滚动条的更薄的变体。

<!DOCTYPE html> 
<html> 
      
<head> 
    <title>CSS | scrollbar-width</title> 
      
    <style> 
        .scrollbar-thin { 
            scrollbar-width:thin; 
            background-color:lightgreen; 
            height:150px; 
            width:200px; 
            overflow-y:scroll; 
        } 
    </style> 
</head> 
  
<body> 
    <h2 style="color:green"> 
        GeeksforGeeks     </h2> 
      
    <b>CSS | scrollbar-width</b> 
      
    <p>scrollbar-width:thin</p> 
      
    <div class="scrollbar-thin"> 
        GeeksforGeeks is a computer science         portal with a huge variety of well         written and explained computer science         and programming articles, quizzes and         interview questions. The portal also  
        has dedicated GATE preparation and         competitive programming sections. 
    </div> 
</body> 
  
</html>

火狐支持css改变滚动条的属性是什么

  • none:它用于完全隐藏滚动条,但是内容仍可滚动。

<!DOCTYPE html> 
<html> 
      
<head> 
    <title>CSS | scrollbar-width</title> 
      
    <style> 
        .scrollbar-none { 
            scrollbar-width:none; 
            background-color:lightgreen; 
            height:150px; 
            width:200px; 
            overflow-y:scroll; 
        } 
    </style> 
</head> 
  
<body> 
    <h2 style="color:green"> 
        GeeksforGeeks     </h2> 
      
    <b>CSS | scrollbar-width</b> 
      
    <p>scrollbar-width:none</p> 
      
    <div class="scrollbar-none"> 
        GeeksforGeeks is a computer science         portal with a huge variety of well         written and explained computer science         and programming articles, quizzes and         interview questions. The portal also  
        has dedicated GATE preparation and         competitive programming sections. 
    </div> 
</body> 
  
</html>

火狐支持css改变滚动条的属性是什么

读到这里,这篇“火狐支持css改变滚动条的属性是什么”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注编程网html频道。

--结束END--

本文标题: 火狐支持css改变滚动条的属性是什么

本文链接: https://www.lsjlt.com/news/98565.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • 火狐支持css改变滚动条的属性是什么
    本文小编为大家详细介绍“火狐支持css改变滚动条的属性是什么”,内容详细,步骤清晰,细节处理妥当,希望这篇“火狐支持css改变滚动条的属性是什么”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学...
    99+
    2024-04-02
  • css的overflow属性怎么定义滚动条
    这篇文章主要介绍css的overflow属性怎么定义滚动条,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!   一:条件   滚动条和overflow是紧密相关的。只有当父级的ov...
    99+
    2024-04-02
  • css中的overflow属性怎么实现滚动条设置和隐藏滚动条
    小编给大家分享一下css中的overflow属性怎么实现滚动条设置和隐藏滚动条,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧! ...
    99+
    2024-04-02
  • 滚动条css设置的方法是什么
    滚动条的CSS设置是通过以下属性来实现的:1. scrollbar-width:用于设置滚动条的宽度,取值可以是auto、thin、...
    99+
    2023-05-30
    滚动条css css
  • CSS怎么改变webkit内核浏览器的滚动条样式
    本篇内容主要讲解“CSS怎么改变webkit内核浏览器的滚动条样式”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“CSS怎么改变webkit内核浏览器的滚动条样式...
    99+
    2024-04-02
  • css中的浮动属性值是什么
    这篇“css中的浮动属性值是什么”文章,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要参考一下,对于“css中的浮动属性值是什么”,小编整理了以下知识点,请大家跟着小编的步伐一步一步的慢慢理解,接下来就让我们进入主题...
    99+
    2023-06-06
  • css的浮动属性是什么以及其属性值有哪些
    这篇文章将为大家详细讲解有关css的浮动属性是什么以及其属性值有哪些,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。在css中,浮动属性是“float”,用于...
    99+
    2024-04-02
  • css中用于清除浮动的属性是什么
    本文小编为大家详细介绍“css中用于清除浮动的属性是什么”,内容详细,步骤清晰,细节处理妥当,希望这篇“css中用于清除浮动的属性是什么”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识...
    99+
    2024-04-02
  • vue使用计算属性完成动态滑竿条制作的方法是什么
    本篇内容介绍了“vue使用计算属性完成动态滑竿条制作的方法是什么”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!布局部分:<div&nb...
    99+
    2023-06-21
软考高级职称资格查询
推荐阅读
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作