【发布时间】:2019-06-21 14:35:30
【问题描述】:
我有一个带有滚动条的文本区域。我知道它可能只适用于 webkit 浏览器,这很好。
我添加了hover,但它没有按预期工作。背景变为红色,表示悬停有效,但cursor 没有改变。
是我做错了什么还是 Chrome 没有完全实现它?
请务必点击“运行代码 sn-p”查看演示,或前往此处:https://jsfiddle.net/k4dm6pgL/
textarea {
height: 150px;
width: 500px;
}
textarea::-webkit-scrollbar {
background-color: #fff;
width: 16px;
}
textarea::-webkit-scrollbar-track {
background-color: #fff;
}
textarea::-webkit-scrollbar-track:hover {
background: red;
cursor: pointer;
}
textarea::-webkit-scrollbar-thumb {
background-color: #babac0;
border-radius: 16px;
border: 4px solid #fff;
}
textarea::-webkit-scrollbar-button {
display: none;
}
<textarea>Gingerbread cheesecake bonbon cotton candy cheesecake. Topping pudding ice cream cupcake apple pie pastry caramels. Lemon drops ice cream icing chocolate bar dessert ice cream ice cream. Chocolate cake biscuit cotton candy.
Danish tiramisu tiramisu macaroon fruitcake caramels topping. Halvah oat cake donut. Chocolate cake sugar plum gingerbread jelly cookie. Bear claw marzipan biscuit soufflé donut.
Apple pie chocolate cake tart liquorice pudding sweet roll. Pie gummi bears cake. Dessert apple pie carrot cake tiramisu bear claw.
Danish pie croissant. Cookie halvah lollipop sweet roll gummies wafer marzipan chocolate cake. Caramels chocolate cotton candy cotton candy candy canes. Jelly beans lollipop marzipan chocolate cake chocolate cake cookie.
Dragée bonbon oat cake sweet roll toffee jujubes chocolate cake bear claw sweet. Sesame snaps cupcake pie donut ice cream brownie. Danish carrot cake gummi bears oat cake sweet roll oat cake dessert chocolate cake cake. Caramels tart liquorice.
Gingerbread cheesecake bonbon cotton candy cheesecake. Topping pudding ice cream cupcake apple pie pastry caramels. Lemon drops ice cream icing chocolate bar dessert ice cream ice cream. Chocolate cake biscuit cotton candy.
Danish tiramisu tiramisu macaroon fruitcake caramels topping. Halvah oat cake donut. Chocolate cake sugar plum gingerbread jelly cookie. Bear claw marzipan biscuit soufflé donut.
Apple pie chocolate cake tart liquorice pudding sweet roll. Pie gummi bears cake. Dessert apple pie carrot cake tiramisu bear claw.
Danish pie croissant. Cookie halvah lollipop sweet roll gummies wafer marzipan chocolate cake. Caramels chocolate cotton candy cotton candy candy canes. Jelly beans lollipop marzipan chocolate cake chocolate cake cookie.
Dragée bonbon oat cake sweet roll toffee jujubes chocolate cake bear claw sweet. Sesame snaps cupcake pie donut ice cream brownie. Danish carrot cake gummi bears oat cake sweet roll oat cake dessert chocolate cake cake. Caramels tart liquorice.</textarea>
同样的内容也可以在这里编辑:https://jsfiddle.net/k4dm6pgL/
【问题讨论】:
-
抱歉,我看不到任何红色背景,您能否提供更多关于您想要实现的目标的详细信息? 编辑:我正在使用 Chrome
-
@Ced 确保您使用的是 chrome。 webkit === chrome
-
我其实是但无法重现
-
@Ced 您是否单击“运行代码 sn-p”?请尝试使用 jsfiddle 链接,看看是否显示效果更好。
-
@Maurice 您是否单击“运行代码 sn-p”?试试 jsfiddle 链接,看看是否有帮助。
标签: css hover scrollbar mouse-cursor