TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Don't use custom CSS scrollbars

382 点作者 Twixes将近 2 年前

61 条评论

jmbwell将近 2 年前
I recognize that web developers want full control over the user experience, usually to the point of reimplementing all of the native UI widgets provided by the user’s OS.<p>As a user, I prefer for my OS to do things my OS does, including styling my widgets. My scrollbars, my scrolling behavior, window chrome, all of it… whether it’s good or bad or right or wrong, that’s between me and my OS.<p>As a user, I hate when web apps mess with scrolling. It breaks affordances I use, like tapping at the top of the screen to jump to the top of the page, or home&#x2F;end keys on desktop. It is inevitably a worse experience than native scrolling, no matter how hard you try. Facebook mobile web for example is basically unusable right now because it’s trying to overthink scrolling. If Facebook can’t get it right, I’m not sure what makes anyone else think they can.<p>And why would anyone want to? Honestly! Microsoft and Apple have already done all that work.<p>As for scroll bars and other widgets, again, right or wrong, that’s not for some web site to mess with. Sorry if the developer doesn’t like the way it looks… they only have to deal with it while working on it. As a user, I am stuck with the developer’s choices, even if they override my own choices, which I’ve made in my OS, which is where those choices belong.<p>If you’re going to clobber native experience, I would argue, don’t do it unless there is absolutely no other option. Corollary: there is always another option.
评论 #36306254 未加载
评论 #36306026 未加载
评论 #36306079 未加载
评论 #36306873 未加载
评论 #36306008 未加载
评论 #36307126 未加载
评论 #36315188 未加载
评论 #36305338 未加载
评论 #36309477 未加载
评论 #36306813 未加载
preommr将近 2 年前
&gt; Don&#x27;t use custom CSS scrollbars<p>Alright, I guess I&#x27;ll go back to using js scrollbars instead &#x2F;s<p>I hate articles like this because they present highly opinionated solutions as something definite even though it has a narrow focus on what the author cares about.<p>Web apps can be incredibly powerful and convenient, sometimes a scrollbar is in the middle of the page like with that codepen. In those situations, being able to style and control the width of the scrollbar is useful.<p>How about we hold developers accountable for their work instead of trying to ruin it for the rest of us because a minority do something badly.
评论 #36302771 未加载
评论 #36303798 未加载
评论 #36303152 未加载
评论 #36306300 未加载
评论 #36306066 未加载
评论 #36306020 未加载
评论 #36305547 未加载
评论 #36306587 未加载
评论 #36305620 未加载
评论 #36304666 未加载
评论 #36306299 未加载
karaterobot将近 2 年前
&gt; Scrollbars are part of the area of the browser that is outside your scope of concern.<p>No, they&#x27;re actually in my scope of concern, that is the whole point of your article. The reason they were brought into my scope of concern is that a lot of people had a use case for styling custom scrollbars. I have a use case for it myself. If you&#x27;re saying &quot;don&#x27;t abuse your ability as a developer and make inacessible websites&quot; then yeah, okay. But taking options away from people because they might theoretically make bad moves with them is not a good strategy. If you took away every CSS attribute I could use to make inaccessible websites, we wouldn&#x27;t have anything left. You&#x27;d be surprised what I can mess up. Better to teach people how to do it right and why.
评论 #36303166 未加载
评论 #36311441 未加载
presentation将近 2 年前
One thing I didn’t expect was that for a large data table that allowed side scrolling, Windows users comfortable with Excel didn’t know that they could scroll side to side because the scroll bar fell below the fold. I ended up needing to measure the page to set the height of the table to make sure that the table wouldn’t be taller than the page. But what I really wanted was to sticky the scroll bar so that it was always visible, or to display it at the top of the table instead of the bottom.<p>I want to style scroll bars for this, not to make them prettier.
评论 #36304041 未加载
评论 #36303872 未加载
评论 #36306578 未加载
willio58将近 2 年前
On pages, I fully agree. Within components, I also agree but I&#x27;ve found it hard to push back when a design calls for scrollbars because the alternative is... what?<p>It can be difficult to visually say &quot;Hey, you! There&#x27;s more to see if you scroll down in this area&quot; You can try to use gradients with fade-outs, you can try to make it so the top of the last item in a scroll area is just visible enough to make it clear something can be scrolled into view. I&#x27;ve also seen actual text-based messages at the bottom of scroll areas to let users know. But at that point, is it really better than creating your own little scroll bar?<p>Really I think we just need better APIs from the browsers to customize when a scroll bar is shown (again, not on the page level but within scrollable elements), and what it looks like. This has already gotten much better over the years but there are still some features that would be great to have in this area.<p>One thing I will say is I really dislike the smooth-scrolling behavior that some sites build in with JS. It&#x27;s usually broken on macs that already have smooth scrolling and it&#x27;s just a dumb thing to add.
评论 #36302682 未加载
评论 #36303551 未加载
评论 #36302863 未加载
评论 #36302914 未加载
codedokode将近 2 年前
Modern disappearing scrollbars in Linux are an awful design:<p>- as scrollbar in browser disappears, I cannot see the position on the page and whether it is scrollable at all<p>- as scrollbar handle is very narrow, it is difficult to drag it<p>You might ask, why drag the scrollbar handle? Well, when you have tens thousands of lines in the terminal, it will take a long time to scroll it using touchpad or mouse wheel.
评论 #36305449 未加载
评论 #36308271 未加载
andersrs将近 2 年前
The worst pattern I&#x27;ve seen is setting the page height to the viewport height and then placing scrollbars on containers. For example this particular UI library has managed to break print layout and page navigation keys and mouse scrolling until you focus the content div <a href="https:&#x2F;&#x2F;www.skeleton.dev&#x2F;docs&#x2F;get-started" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.skeleton.dev&#x2F;docs&#x2F;get-started</a><p>I was once guilty of doing this on a site I made but the users called it out so I fixed it. It&#x27;s another thing for a UI library to spread this pattern.
评论 #36302591 未加载
评论 #36304826 未加载
评论 #36302719 未加载
WirelessGigabit将近 2 年前
Also don&#x27;t use buttons that don&#x27;t show me the link I&#x27;m navigating to. If you must have a different style, style them around an `a href`, not a `button`.<p>And actions should be buttons, not links. I&#x27;m looking at all of those cookie websites with a &#x27;link&#x27; that says &#x27;Confirm choices&#x27; and a button that says &#x27;Allow all&#x27;. Instinctively we go to the button, not the link.<p>Weirdly enough I responded on the Image send to Microsoft via MS Edge article about how even Microsoft, the writer of LOTS of documentation on how to make good UIs, abuses all these things.<p>Now, of course we could argue about how these things just visuals, but that&#x27;s not completely true. Lots of screen readers depend on the semantics of the document structure to actually identify objects correctly. Button? Action, edit, sign up, delete, .... Something that actually changes something.<p>Link: navigation...
评论 #36307297 未加载
adamredwoods将近 2 年前
&gt;&gt; Apple learned the lesson about visible scrollbars the hard way when it introduced its ultra-minimal, disappearing scrollbar indicators.<p>&gt;&gt; There’s no visual indication that there’s more content present in this window—the only way to discover it is to scroll downwards. However, without an affordance to indicate the presence of additional offscreen content, the chances are low that someone will bother to check.<p>I appreciate the callout that Apple is an infringer on removing the scrollbars, which is a bad UI practice. For the entire lifespan of the web, overflow content indicators have been (aka scrollbars), for better or worse, an inherent function of the browser.
评论 #36304687 未加载
Minor49er将近 2 年前
On the contrary, we should be encouraging people to customize scrollbars so that scrolling is taken into consideration again. It can help get rid of trends like invisible&#x2F;hidden scrollbars or those useless horizontal progress bars that shows how far into a page you&#x27;ve read
评论 #36302725 未加载
gwern将近 2 年前
&gt; When you style things on the web, you get control over almost the entire experience. From ten thousand feet up, your scope of concern is this:<p>The mockup scrollbar looks nothing like scrollbars are now.<p>&gt; Do you need to make someone download that extra data? &gt; &gt; Spoilers: you don’t. Scrollbars work without CSS.<p>No, they don&#x27;t, because web browsers have been busy <i>removing scrollbars as much as possible</i>. As I type this, there is no scrollbar on my screen because Firefox no longer does that. For a moment, I thought maybe FF still showed at least 1 pixel of the scrollbar, but I scraped it off with my fingernail and it turned out to be a cat hair. The scrollbar appears only for like a second before &#x27;helpfully&#x27; fading out, and is a few pixels wide (on a 4k portrait monitor where I&#x27;m not exactly hurting for space). Chromium still has a semi-reasonable scrollbar, but I can&#x27;t vouch for the official Google Chrome. Safari and Mac OS&#x2F;iOS have, of course, been years ahead of everyone else in the wonderful pro-user innovation of &#x27;hiding scrollbars and making them a pixel wide if absolutely forced to display one&#x27;.<p>&gt; ...This is why Apple introduced a preference to always show scroll bars...Windows followed this path blazed by Apple<p>Yes, a preference to go back to the old standard behavior, which in designer-speak means &quot;we done f-ked up, but we hate real users and love the sleek minimalist appearance <a href="https:&#x2F;&#x2F;asktog.com&#x2F;atc&#x2F;the-third-user&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;asktog.com&#x2F;atc&#x2F;the-third-user&#x2F;</a> more, so this is our way to get our users to shut up&quot;. And &#x27;blazed&#x27;, in this case, is &#x27;lit on fire many decades of hard-earned UI experience&#x27;.<p>&gt; As an aside, I set the operating systems I use to always show scroll bars.<p>Which is why you should support custom CSS scollbars to negate browsers &amp; OSes hiding them.
评论 #36305691 未加载
eviks将近 2 年前
&gt; There’s no visual indication that there’s more content present in this window—the only way to discover it is to scroll downwards. However, without an affordance to indicate the presence of additional offscreen content, the chances are low that someone will bother to check. &gt; This is why Apple introduced a preference to always show scroll bars.<p>But the proper solution is to add the info&#x2F;affordance in that specific instance instead of always wasting space even when you don&#x27;t use the scroll bar. This would also allow you to have a more convenient wide scroll bar for when you actually need to use it (in very large documents&#x2F;lists, though currently you can&#x27;t setup your scroll bar to depend on that)<p>And here is the main problem with the article - this general approach blocks would block all UI innovation until some browser&#x2F;OS vendor implemented something poorly (of course, this doesn&#x27;t mean your implementation will be better, but someone else&#x27;s will be)
评论 #36305614 未加载
MrPatan将近 2 年前
Custom scrollbars, as in &quot;I&#x27;ll hijack the scroll events and draw custom stuff on the side of the element&quot; kind of custom, yeah, that&#x27;s bad and buggy and annoying. Being able to style native scrollbars is a godsend which satisfies designers and brand people and prevents the first kind of custom scrollbars.
评论 #36308162 未加载
codeptualize将近 2 年前
I agree with many points but there is definitely a need for custom scrollbars.<p>The reality is that if you have scrolling in the page (like a column layout for example), you kinda have to customize the scrollbars. If only to not break your layout as scrollbars are completely different everywhere, hidden, different widths, some ugly, some nice, no reliable way to detect the situation, it&#x27;s a mess.<p>I would opt for more options: give us better tools to style (around) scrollbars, give us the tools to honor what the user prefers, to know when and when not to blend it in with the UI, to increase contrast, or to just leave it alone.<p>Just not customizing is not a realistic solution for a lot of situations.
评论 #36303362 未加载
graycat将近 2 年前
Several billion people understand and make good use of the standard HTML scroll bars.<p>For any change, on the first day, only the programmer understands the new scroll bars.<p>For an Internet user who each month or so goes to dozens, maybe hundreds, of Web sites, all the new scroll bars are something new to learn likely particular to that site. So, for that user, a significant part of the Internet becomes dozens or even hundreds of times harder to use.<p>Same for standard HTML push buttons, links, check boxes, radio buttons, multi-line text boxes, single line text boxes (and the ones for passwords), etc.<p>Changes make the site obscure and significantly more work to use.<p>Web site owners: When I see a Web page with an obscure user interface, commonly I just do a single left click on the <i>X</i> in the upper right corner of the Web browser instance displaying that page.<p>Beyond an obscure user interface, often I can conclude that the Web site does not want me to see the content on their Web pages because they cover up the content with <i>pop-up</i> windows or expand and contract some header material at the top of the page, material that wastes limited vertical space on my screen.<p>Another problem is Web pages that follow my mouse pointer and respond to its position without my giving a click. Big interruption in using the site. Nearly always I&#x27;m just trying to bring the window to the top of the <i>Z-order</i> so, instead, have to swat like a dozen flying insects the various responses to the mouse click -- again, I do want to see the page and just want to bring it to the top of the Z-order.<p>Then there is Web site code making the window larger -- again it&#x27;s like swatting flying insects. No, no, 1000 times no, with rare exceptions, I do NOT want any one page to <i>hog</i> my screen area. The reason is fundamental: In visiting the page, I&#x27;m trying to get something DONE, and that requires seeing at least two windows, maybe a few more than two. When one program takes up all or too much of the screen area, I can&#x27;t see the other windows I need and, thus, can&#x27;t get the work done.<p>There is an old remark that goes something like &quot;Just because you could doesn&#x27;t mean you should.&quot;-
评论 #36307920 未加载
circuit10将近 2 年前
What about when a native scroll bar looks completely off compared to the the theme of the rest of the page?
评论 #36302509 未加载
评论 #36302430 未加载
评论 #36302469 未加载
评论 #36309732 未加载
评论 #36305398 未加载
bbrks将近 2 年前
One of my very first blog posts[1], which took off at the time on HN[2] was on this topic - in reaction to the trend of &quot;horizontal page progress bars&quot; (a.k.a. scroll bars!)<p>What&#x27;s old is new again... and again... and again... :)<p>[1] <a href="https:&#x2F;&#x2F;bbrks.me&#x2F;reinventing-scrollbars&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;bbrks.me&#x2F;reinventing-scrollbars&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6246777">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6246777</a>
htek将近 2 年前
If only this were a law. I can&#x27;t stand when sites play &quot;hide the scrollbar&quot; or &quot;find the hover sweet spot to display the scrollbar&quot; and I click on where I think the scrollbar is and instead click on a link that&#x27;s was two pixels away from where I thought I was clicking. How is this accessible? Edit: How does this improve the user experience?
SilverBirch将近 2 年前
I agree with the overall point, but there&#x27;s some bits here that are a little bit silly<p>&gt;You might be scoffing at the kilobytes this removal represents, but when it comes to web performance, every little bit counts<p>Go to Apple.com. Do you think that they value minimizing site size or do they prioritize the design first and then figure out how to make it performant? What this argument is really saying is that you should make the value judgement that performance vs quality should be somewhere towards the performance side, but I think plenty of people would make a different decision. You can argue that the scrollbar is extremely low value and therefore performance should be the priority but then... why are you writing an article about scrollbars?
Waterluvian将近 2 年前
Scrollbars are frustrating to handle. Getting their actual size if you need to do stuff like compensate for a virtual table is really tedious. And Macs do them entirely different from everyone else, so that’s not nice either.
dahwolf将近 2 年前
Another fun one is scroll-triggered animations, as one would commonly find on an Apple product detail page, as just an example.<p>The problem is that it assumes smooth scrolling input, typically a touchpad or a touch-only device. The experience completely breaks down into wild stuttering when scrolling with friction: mouse-wheel that scrolls with discrete steps or the classic &quot;drag the scollbar&quot; interaction.<p>Even when using smooth scrolling input it sucks, as you carefully need to time&#x2F;verify your scroll speed as content appears&#x2F;disappears based on force applied.
jmaker将近 2 年前
Fwiw, that huge font size doesn’t invite me to actually read the text. I’d rather have custom scroll bars than try to read when there literally are just three sentences that fit on my iPhone viewport.
评论 #36308298 未加载
quickthrower2将近 2 年前
Too much fun to be had, Streisand:<p><pre><code> body { scrollbar-color: #f16d4f #cccccc; &amp;::-webkit-scrollbar { width: 13rem; } &amp;::-webkit-scrollbar-track { background: #000; } &amp;::-webkit-scrollbar-thumb { background-image: url(&quot;https:&#x2F;&#x2F;picsum.photos&#x2F;200&#x2F;200&quot;); background-repeat:none; height: 13rem; border-radius: 13rem; } }</code></pre>
zokier将近 2 年前
How many of the arguments apply to <i>any</i> CSS styling?
评论 #36306125 未加载
评论 #36303466 未加载
hunter2_将近 2 年前
The author&#x27;s main point is &quot;When you override this expression, you’re indirectly communicating that someone’s personal preferences are less important than your own visual sensibilities&quot; but that&#x27;s always be the entire point of CSS. The browser comes with default styles, the user can override those, the website can override those overrides, and then extensions can override that. Granted, very few users probably do override the browser default styles due to those defaults rarely getting used anyway given the prevalence of websites doing so...<p>Also interesting that the author makes no mention of the ability for the site to set the color of the address bar area for Android browsers. Seems like the same gripe should be had.<p>Aside: I find it funny that the author says &quot;This phenomenon is why checkboxes use squares and radio buttons use circles&quot; and then links to a page for the reader to find out more, in which the prominent photo is of a radio with square pop-out buttons.<p>But a good read nonetheless.
cebsoto将近 2 年前
Favorite line in this entire article....sums up the thought very nice and answers the &quot;why&quot; when I have to explain why modify components is not a good idea.<p>Ambiguity means less certainty about what the piece of UI is, how you interact with it, and what effects taking action on it will cause. The more you deviate, the more confusing things get.
nawgz将近 2 年前
I mean, I use custom scrollbars so my apps look the same on each OS. Do you propose that I should instead accept windows making horrible ugly things that take up more space rather than just showing a minimal scroll bar?<p>Seems like a non issue to me. My users are much happier with the more minimalist scrolls I’ve implemented over windows stealing 30px per scrollbar
LinAGKar将近 2 年前
What&#x27;s going on in that Finder video?<p>&gt;There’s no visual indication that there’s more content present in this window<p>Not only that. There is a clear indicator that there isn&#x27;t more content, since the last row isn&#x27;t filled. Only, there is, but one of the rows has randomly been truncated for some reason?
TobyTheDog123将近 2 年前
Not to be an asshole, but --- well, I guess I&#x27;ll be an asshole.<p>This is good, thoroughly-researched advice with just enough condescension that I walked away from it kinda wanting to style my own CSS scrollbars.<p>Additionally, there&#x27;s a comment on this post replying to someone with &quot;You&#x27;ll live&quot; which really isn&#x27;t helping the case presented in the article.<p>I won&#x27;t, I don&#x27;t have a good reason to, but I had a nice nostalgia trip to w3schools: <a href="https:&#x2F;&#x2F;www.w3schools.com&#x2F;howto&#x2F;howto_css_custom_scrollbar.asp" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.w3schools.com&#x2F;howto&#x2F;howto_css_custom_scrollbar.a...</a>
kossTKR将近 2 年前
I don&#x27;t know if it was Apple that pioneered the hidden scrollbars but it&#x27;s extremely stupid and makes everyones lives using a computer much harder when navigating using the GUI, - before that there was always folder size indicator right there.<p>Can we get back to some actual human friendly interface guidelines please? I like both Apple and designers in large parts, but they&#x27;ve gotten too much influence.<p>Also extreme whitespace designs with scrolling hell.<p>Give us back GUI&#x27;s with lots of content on screen, it may looks dense but is much easier to navigate, and can be pretty if you follow an engineering &#x2F; power user ethos.
teel将近 2 年前
Funny to see this link here, just after I saw this site yesterday. I was forced to google how to disable custom scrollbars when I was reading the &quot;A simple hash table in C&quot; link from 2 days ago [1]. The site set the scrollbar width to 4 pixels which was so narrow I could just see it but couldn&#x27;t grab it with mouse anymore. Totally unusable.<p>[1] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36302552">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36302552</a>
ceving将近 2 年前
Don&#x27;t use custom font sizes in your blog.
rektide将近 2 年前
There was a quick starburst trend around 2010 where super-fancy css componentry was being heavily explored &amp; all sorts of interesting but not necessarily better stuff was being done, with radical redesigns. My mini-project submission for a job I got was using a super melted Geiger esque up-down button set.<p>I&#x27;ve tried to go back &amp; find evidence of this era, to find more examples of these heavily glitzed up components. And wow, so much of this has disappeared entirely off the net. Maybe I&#x27;m lacking the right keywords. But this feels like a mega flash in the pan that came &amp; went super fast.
评论 #36307481 未加载
weird-eye-issue将近 2 年前
What about when you have scrollbars inside the &quot;scope of concern&quot; the author pointed out..<p>The sweeping statement in the title doesn&#x27;t feel fully thought out even after the author ranted for over 3,000 words
madsbuch将近 2 年前
&gt; Scrollbars are part of the area of the browser that is outside your scope of concern.<p>This is simply wrong. You might have a scrollbar in your content, which indeed is the scope of concern for the developer.
Aeolun将近 2 年前
&gt; You might be scoffing at the kilobytes this removal represents, but when it comes to web performance, every little bit counts<p>I read this, and I get a very good idea of what the rest of the post will contain.
评论 #36306342 未加载
captainpiggies将近 2 年前
I just wanted to say thank you. I didn&#x27;t know about the setting to always show scrollbars on macOS and them being hidden by default was bothering me for a while.
评论 #36312458 未加载
gatkinso将近 2 年前
I feel the same way about scroll-jacking and smooth scroll.
darepublic将近 2 年前
I like the site csstricks.com but a while back I was disappointed to see they were customizing their scrollbar. It seemed really tacky and unappealing
pvinis将近 2 年前
this post could have been way less that a million lines long. maybe if it had a nice colored scrollbar it would be more pleasant to read.<p>kidding aside, it is longer that it could be, to get the point across. maybe the browser just needs a similar setting to the macos and windows one, to never use css on scrollbar, and we&#x27;re good?
_madmax_将近 2 年前
I&#x27;ll use whatever the hell I want, lol.
sharkbird2将近 2 年前
I largely agree, but the one thing I have been wanting to do sometimes is too be able to put marks&#x2F;indicators on the scrollbar of where important pieces of information is in the flow.<p>A lot like chrome does when you use ctrl+f to search for a word.
Sujeto将近 2 年前
I have an application that looks terrible if I don&#x27;t make the scrollbar transparent. I thought this was going to be about not using those horrible javascript scrollbar libraries, which make the code a lot more complex (I tried them all).
评论 #36303067 未加载
kibwen将近 2 年前
On the contrary, I&#x27;m completely in favor of custom CSS scrollbars because it&#x27;s unimaginable that websites could do <i>worse</i> than modern OSes already do when it comes to scrollbars. If anyone here has a time machine, immediately after you&#x27;ve finished killing Hitler may I recommend that you gently persuade Jony Ive away from the terrible decision to make scrollbars hidden, low contrast, and impossibly thin.
评论 #36306936 未加载
bee_rider将近 2 年前
Is it possible to configure Firefox to ignore custom scroll bars? I haven’t noticed many at all.<p>IMO it is a dumb feature, but there’s no harm in having it in CSS for people who want it, as long as the rest of us can ignore it.
chrismorgan将近 2 年前
&gt; <i>Modifying the scrollbar via CSS means the scrollbar will effectively disappear when a Forced Color mode theme is applied. Again, if you can’t see it, you won’t know it’s there.</i><p>&gt; <i>Much like with Forced Colors Mode, custom CSS scrollbars will not honor the presence of an enabled Increased Contrast Mode.</i><p>These both just sound like browser bugs. In those modes, <i>of course</i> the browser should be ignoring or further modifying scrollbar colour changes.<p>MDN on scrollbar-color: “Note: @media (forced-colors: active) sets scrollbar-color to auto.” (However, I can’t find any spec citation for this, not in Media Queries Level 5 or CSS Scrollbars Styling Module Level 1.)<p>—⁂—<p>Here’s my take:<p>• Don’t use scrollbar-color on the document area, but treat this outermost scrollbar as browser chrome. In the early days of scrollbar-color it helped to set a suitable color-scheme setting in order to reliably get light or dark scrollbars as appropriate, but I don’t think any browser really needs that any longer (though it’s still a good idea, especially for other controls).<p>• It’s OK to use scrollbar-color on scroll areas <i>within</i> the document, so long as you maintain suitable contrast. Transparent tracks are a little risky, but at least acceptable in most inner scroll areas.<p>• On scrollbar-width, there’s a reason the values are `auto | thin | none`. As the spec says &lt;<a href="https:&#x2F;&#x2F;w3c.github.io&#x2F;csswg-drafts&#x2F;css-scrollbars&#x2F;#scrollbar-width" rel="nofollow noreferrer">https:&#x2F;&#x2F;w3c.github.io&#x2F;csswg-drafts&#x2F;css-scrollbars&#x2F;#scrollbar...</a>&gt;: “The primary purpose of this property is not to allow authors to chose a particular scrollbar aesthetic for their pages, but to let them indicate for certain small or cramped elements of their pages that a smaller scrollbar would be desirable.” If you have a scrolling sidebar, for example, `scrollbar-width: thin` is completely reasonable. Other than that, there’s nothing useful to touch.<p>• <i>Never</i> use the older ::-webkit-scrollbar* pseudoelements (which are the only way to get things like 1px wide scrollbars, like the article speaks of). Their degree of control was a mistake &lt;<a href="https:&#x2F;&#x2F;w3c.github.io&#x2F;csswg-drafts&#x2F;css-scrollbars&#x2F;#out-of-scope" rel="nofollow noreferrer">https:&#x2F;&#x2F;w3c.github.io&#x2F;csswg-drafts&#x2F;css-scrollbars&#x2F;#out-of-sc...</a>&gt;, and their implementation never got beyond half-baked anyway, so that touching them <i>at all</i> harms scrollbar accessibility on at least Windows with non-overlay scrollbars (you lose the arrows at the ends).<p>• With all of these new scrollbar CSS properties, note how thoroughly they’re defined as <i>hints</i>. If certain accessibility modes make scrollbar tweaks break things, that’s very probably the browser’s fault. And it’s an unhappy situation when authors have to consider browser bugs (though it certainly does happen sometimes).
gureddio将近 2 年前
Someone re-writes this article every few years. It&#x27;s not the first time that somebody has pointed out that customising the scrollbar isn&#x27;t a great idea
al_be_back将近 2 年前
the OP mentioned apple&#x27;s headaches with the &quot;disappearing&quot; scrollbar, yes I often experienced that in Apple&#x27;s own site, iTunes Connect (manage App submissions, rejections&#x2F;comments etc). Disappearing scrollbars on TextArea with large amounts of text made is very easy to miss whole paragraphs of text, can be very costly.<p>I&#x27;m for &quot;Customizing the UI&quot;, as long as it helps the User get the most out of the site.
BeFlatXIII将近 2 年前
CSS scrollbars… those take me back to my middle school experimentations with HTML back when interactive web pages were called &quot;dynamic HTML&quot;
robomc将近 2 年前
What would be nice would be some sort of solemn undertaking that the presence or absence of a browser scrollbar will never alter the placement of the content.
评论 #36305237 未加载
butz将近 2 年前
Worst thing is when interaction with scrollbar is considered enough to enable video autoplay and another annoying features.
okanat将近 2 年前
I wonder if there is a way to override the entire web with a custom stylesheet plugin like Stylus for Firefox.
评论 #36302601 未加载
Dracula707将近 2 年前
so first about size is what 5 lines of css when most companies use react or any other framework. And every website has different theme, style, buttons, checkboxes so what let&#x27;s don&#x27;t use css at all then? and user can install extension that let them override css.
scotty79将近 2 年前
Did he mention scrollbars in the content of the webpage? Or is it all only about single main scrollbar?
reboot81将近 2 年前
I need to follow in your footsteps and write why websites shouldn’t prevent autofill.
pgib将近 2 年前
Worse even than this is that Microsoft Sway implements its own custom _scrolling_!
RobotToaster将近 2 年前
Does firefox ignore this? The codepen example doesn&#x27;t seem to work for me.
bandie91将近 2 年前
&quot;AppWeb&quot; and &quot;DocWeb&quot; should be 2 different platforms.
lofaszvanitt将近 2 年前
3000 word like article :DDDDDDDDDDDDDD
nathias将近 2 年前
a website should be obvious to scroll without scrollbars
LeonB将近 2 年前
The OS gets the scrollbar wrong so often that as a user and developer I’ve found I need to take care of it.<p>It’s fine relying on the “platform” but the platforms are just criminal cartels holding users and apps hostage.<p>Two specific examples, just on scroll bars. I’ve found the platform failing to support dark mode and failing to support mixed high DPI scenarios. Both of these failings result in poor accessibility and real pain for real users.<p>As a lowly app developer I don’t have the resources to do it perfectly for my users. But the OS is failing badly enough that I end up having to do the work. It’s not out of vanity, which is the only reason TFA author can imagine.
评论 #36307305 未加载