Search
Bundling JavaScript for Performance: Best Practices
24.1.2020
Performance advice from David Calhoun on how many scripts to load on a page for best performance:
[...] some of your vendor dependencies probably change slower than others. react and react-dom probably change the slowest, and their versions are always paired together, so they...
What’s the Difference Between Width/Height in CSS and Width/Height HTML attributes?
24.1.2020
Some HTML elements accept width and height as attributes. Some do not. For example:
<!-- valid, works, is a good idea --<img width="500" height="400" src="..." alt="..."<iframe width="600" height="400" src="..."</iframe<svg width="20" height="20"</svg<!-- not valid...
Searching the Jamstack
22.1.2020
Here's Raymon Camden on adding site search functionality to a site that is statically hosted. A classic trick! Just shoot 'em to Google and scope the results to your site:
<form action="https://www.google.com/search" method="get"<input type="search" name="q"...
JAMstack vs. Jamstack
21.1.2020
It's just a word to evoke the idea that serving as much as you can statically while using client-side code and hitting serverless APIs for any needs after that.
The "official website" changed their language from JAMstack (evoking the JavaScript, APIs, and Markup acronym) to Jamstack. It's nothing...
A Web Component with Different HTML for Desktop and Mobile
16.1.2020
Christian Schaefer has a great big write-up about dealing with web advertisements. The whole thing is interesting, first documenting all the challenges that ads present, and then presenting modern solutions to each of them.
One code snippet that caught my eye was a simple way to design a component...
Debunking the Myth: Accessibility and React
15.1.2020
I find it notable when the blog of a major accessibility-focused company like Deque publishes an article called Debunking the Myth: Accessibility and React. Mark Steadman is essentially saying if a site has bad accessibility, it ain't React... it's you. The tools are there to achieve good...
Snowpack
14.1.2020
Snowpack. Love that name. This is the new thing from the Pika people, who are on to something. It's a bundler alternative, in a sense. It runs over packages you pull from npm to make sure that they are ES module-compatible (native imports).
This is how I digest it. When you write a line of code...
Water.css
11.1.2020
It's notable that Water.css was the #1 clicked thing from Louis Lazaris' Web Tools Weekly in 2019. It's from a 13-year old developer named Felix!
It's just a little bit of CSS you apply to class-free semantic HTML to give it nice basic responsive styles — the perfect kind of thing for a...
A Use Case for a Parent Selector
31.12.2019
Having a "parent selector" in CSS is mentioned regularly as something CSS could really use. I feel like I've had that thought plenty of times myself, but then when I ask my brain for a use case, I find it hard to think of one. Well, I just had one so I thought I'd document it here.
A classic...
The Order of CSS Classes in HTML Doesn’t Matter
17.12.2019
That’s right! And I can prove it, too. Let’s look at some CSS first:
.a {
color: red;
}
.b {
color: blue;
}
And now let’s look at some markup:
<div class="a b">Here’s some text</div>
The text is going to be blue because .b is defined last in the CSS, right? But what if we...
Quoting in HTML: Quotations, Citations, and Blockquotes
10.12.2019
It’s all too common to see the incorrect HTML used for quotes in markup. In this article, let’s dig into all this, looking at different situations and different HTML tags to handle those situations.
There are three major HTML elements involved...
Dark Mode Favicons
4.12.2019
Oooo! A bonafide trick from Thomas Steiner. Chrome will soon be supporting SVG favicons (e.g. <link rel="icon" href="/icon.svg">). And you can embed CSS within an SVG with a <style> element. That CSS can use a perfers-color-sceme media query, and as a result, a favicon that supports...
Finally, it Will Be Easy to Change the Color of List Bullets
14.11.2019
In my germinating years, the general advice was this:
<ul>
<li><span>List item</span></li>
<!-- ... -->
</ul>
li { color: red; } /* bullet */
li span (color: black; } /* text */
Not terrible, but not great. You're "resetting" everything...
Collective #565
14.11.2019
Next-generation web styling * Sketch 60 * The 2019 Web Almanac * Markup from hell * Video Game Console Logos
Collective #565 was written by Pedro Botelho and published on Codrops
Some Things You Oughta Know When Working with Viewport Units
6.11.2019
David Chanin has a quickie article summarizing a problem with setting an element's height to 100vh in mobile browsers and then also positioning something on the bottom of that.
Summarized in this graphic:
The trouble is that Chrome isn't taking the address bar (browser chrome) into account when...
Float Element in the Middle of a Paragraph
4.11.2019
Say you want to have an image (or any other element) visually float left into a paragraph of text. But like... in the middle of the paragraph, not right at the top. It's doable, but it's certainly in the realm of CSS trickery!
One thing you can do is slap the image right in the middle of...
What I Like About Writing Styles with Svelte
23.10.2019
There’s been a lot of well-deserved hype around Svelte recently, with the project accumulating over 24,000 GitHub stars. Arguably the simplest JavaScript framework out there, Svelte was written by Rich Harris, the developer behind Rollup. There’s a lot to like about Svelte (performance, built-in...
Making Tables Responsive With Minimal CSS
17.10.2019
Here’s a fabulous CSS trick from Bradley Taunt in which he shows how to make tables work on mobile with just a little bit of extra code. He styles each table row into a card that looks something like this:
See the Pen
Responsive Tables #2.5: Flexbox by Bradley Taunt (@bradleytaunt)
...
The `hidden` Attribute is Visibly Weak
16.10.2019
There is an HTML attribute that does exactly what you think it should do:
<div>I'm visible</div>
<div hidden>I'm hidden</div>
It even has great browser support. Is it useful? Uhm. Maybe. Not really.
Adam Laki likes the semantics of it:
If we use the hidden...
A Snippet to See all SVGs in a Sprite
8.10.2019
I think of an SVG sprite as this:
<svg display="none">
<symbol id="icon-one"> ... <symbol>
<symbol id="icon-two"> ... <symbol>
<symbol id="icon-three"> ... <symbol>
</svg>
I was long a fan of that approach for icon systems...