这里是 Frontend Focus 的中文翻译项目,每周在 己思 平台首发。
翻译及校对:richshaw2015,Yully Che
Remember the recent debate around CSS versioning and whether we should have a ‘CSS 4’ for marketing reasons? Here’s a good account from the W3C of just how CSS feature releases have worked up until this point. This piece also asks about the motives behind defining CSS versions for developers: How would it be defined in a useful way? How often should a new version be defined? And who could even define it?
来源:Bert Bos (W3C)
Ensuring your sites are equally available to all is irrefutably the moral and right-minded approach to development (and it’s increasingly also a legal requirement too). Here, Bruce runs through over a dozen accessibility matters that you can address including technical, design and copywriting issues.
来源:Bruce Lawson
calc()
完全指南CSS has a special calc()
function for doing basic math — here, Chris Coyier runs through “just about everything there is to know” about it. A detailed guide with plenty of code snippet examples.
html {
--H: 100;
--S: 100%;
--L: 50%;
}
.el {
background: hsl(
calc(var(--H) + 20),
calc(var(--S) - 10%),
calc(var(--L) + 30%)
)
}
来源:CSS Tricks
A new podcast from the Chrome Developers team all about CSS. In the first episode Una Kravets and Adam Argyle discuss the CSS box model.
来源:Google podcast
The web turned 31 last week, a good reason to revisit Tim Berners-Lee’s original proposal for the Web.
“The goal of the Web is to serve humanity. We build it now so that those who come to it later will be able to create things that we cannot ourselves imagine.”
Sir Tim Berners Lee, computer scientist and inventor of the World Wide Web.
来源:Coralie Mercier
:nth-of-class
选择符This isn’t a real selector, but Bram Van Damme looks at some possible shortcomings with nth-child
, leading to the conclusion that maybe we do need something like :nth-of-class
.
来源:Bram Van Damme
A look through some of the most interesting new media queries in the Media Query Level 5 spec, and how to use them.
@media (light-level: dim) {
:root {
--text-color: white;
--background-color: black;
}
}
@media (inverted-colors) {
img { filter: invert(1); }
* { box-shadow: none !important; text-shadow: none !important; }
}
@media (prefers-color-scheme: dark) {
body { background: #1e1e1e; color: white; }
}
@custom-media --medium-devices (min-width: 50rem);
@custom-media --large-landscape (min-width: 70rem) and (orientation: landscape);
@media (--medium-devices) {
.container { max-width: 40rem; }
}
来源:Kristofer Selbekk
A comprehensive look at concepts in box alignment in CSS, which are useful for learning both Flexbox and Grid.
来源:Ahmad Shadeed
Snackbars (those little ‘toast’ notification messages) are a popular way to inform users about something they just did, but Adam thinks they can cause lots of problems for users. Here he explains why that is and what to use instead.
来源:Adam Silver
AnimeJS is a JavaScript animation library with various features like SVG morphing animations and CSS animations. Here’s a look at how to use it.
anime({
targets: ".cool-svg path",
duration: 1000,
easing: "easeInOutSine",
d: [
{
value:
"M53,234c143.452,-81.953,313.407,-167.554,430,-107c116.592,45.554,70.404,361.126,236,472c235.595,95.873,447.977,-197.535,477,-306"
},
{
value:
"M53,434c143.452,181.953,213.407,267.554,330,107c56.592,-125.554,70.404,-161.126,236,-172c235.595,-55.873,447.977,-197.535,500,206"
}
]
});
来源:Developer Bacon
A straightforward tutorial showing how to add a scroll to your page without having to rely on JavaScript libraries.
来源:Nada Rifki
来源:Luke Harrison
<article itemscope itemtype="http://schema.org/BlogPosting">
<header>
<h1 itemprop="headline">My Blog Post Title</h1>
<p itemprop="description">A little extra on what this post is about</p>
<ul>
<li>
Written by
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">Scott</span>
</span>
</li>
<li>
<time datetime="2020-01-09" itemprop="dateCreated pubdate datePublished">
January 9th, 2020
</time>
</li>
</ul>
</header>
<img src="article-image.jpg" alt="" itemprop="image" />
<div itemprop="articleBody">
<p>
Lorem ipsum dolor sit ame, consectetur adipiscing elit. Donec a quam rhoncus, tincidunt ipsum non, ultricies augue…
</p>
<!-- … -->
</div>
</article>
来源:Scott Vinkle
This is quite the achievement in realistic CSS art — and you can tweak it. Open up the editor view and alter the color of the sun for your very own personalised sunset.
来源:Ben Evans
If you need to identify performance issues with your site this list of tools is a good place to start.
来源:Shawn Wang
This is a smart looking native Mac/Windows app to collect, customize, and manage all your icons.
来源:Iconset Creative
A browser-based tool for making “9-patch” border patterns. Chris Coyier has done an accompanying write up on this.
.broider {
border-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAAB0klEQVR4Xu3bUa7CMAwF0XT/iwZV4oO2QGR5LMV03h967cU5cUkJsI0xHuP4t50ezx5Gz48ef37+7Pmz8UT/f6hnx8sWGD0/erygkykWFAb6e9Doa4bH/xCILkBiTgQEhVtEUEFhATjODhUUFoDj7FBBYQE4zg4VFBaA4+zQG4JmN1NgskvcZT+0+gmz+YJmBU/nCyooK9Cqo8YY6MKMhr3mRVC2QdMf+sHl/F6V7dA8d+kVVHHJ54fcOEFQePIEFRQWgOPs0Dxou/fy+SHXJggK+woqKCxQGeeiBOsKKigsAMcRXwmHS+odJyg8f4IKCgvAccQqX7phC4/3Uxxav6D532kdJklQQfEXgeUueXyEzQLdbYInTFBBYQE4zg6FQfHbpsr62mUT96HtBl1ZsKCwrrtNgsICcJwdKigsAMe5KAkKC8BxdqigsAAcV9Gh6IYtPN49rrQ+Qf3hV7pn7dA04TGgHLT0CQCM1eu77IeuXvDq9QkKXDVfIzpsjrTr0MoJu112xX3o7RDfBywoPP2CCgoLwHF2qKCwABxnhwoKC8BxdqigsAAcZ4cWgK62+ZCtJ3p+9PjzFFy+cJsNhOc4/SFadDzR4wWdzLigMBAK+gR/OGBBOfNrrwAAAABJRU5ErkJggg==") 28 / 28px / 0 round;
border-width: 28px;
border-style: solid;
}
来源:Max Bittker
This typeface from IBM presents a neutral and friendly style across the entire family (made up of a Sans, Sans Condensed, Mono, and Serif variants). The Mono is well suited to displaying code snippets.
译者注:如需了解,请查看原文。
译者注:如需了解,请查看原文。
Copyright © 2015-2022 BY-NC-ND 4.0