Search
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...
Now You See It
16.12.2019
I recently accepted a teaching position at a local college here in SoCal where I'll be spouting off whatever I know (or more likely don't know!) about HTML and CSS. It's suffice to say I was all ears (well, actually eyes) when Rachel Andrew recently published a post on teaching CSS.
The display...
Making a Better Custom Select Element
11.12.2019
We just covered The Current State of Styling Selects in 2019, but we didn't get nearly as far and fancy as Julie Grundy gets here. There is a decent chunk of JavaScript that powers it, so I'm still very much eyeballing browsers' recent interest in giving us more powerful selects in (presumably)...
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...
Playing Sounds with CSS
25.11.2019
CSS is the domain of styling, layout, and presentation. It is full of colors, sizes, and animations. But did you know that it could also control when a sound plays on a web page?
This article is about a little trick to pull that off. It’s actually a strict implementation of the HTML and CSS,...
We are Programmers
22.11.2019
Building websites is programming. Writing HTML and CSS is programming. I am a programmer, and if you're here, reading CSS-Tricks, chances are you're a programmer, too.
The thing is, the details in programming layout with CSS are different, for example, than the details in programming API endpoints...
Real-Time Google Search Results API with serpstack (Sponsored)
19.11.2019
In my early web days, I was interested in scraping and collecting data based on the results of Google searches. Scraping Google was easier in those days but now Google search results are so dynamic that you can’t rely on getting the same HTML or data structure back. Add in CAPTCHAs, rate...
The Best Cocktail in Town
18.11.2019
I admit I've held in a lot of pent-up frustration about the direction web development has taken the past few years. There is the complexity. It requires a steep learning curve. It focuses more on more configuration than it does development.
That's not exactly great news for folks like me...
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...
Pac-Man… in CSS!
11.11.2019
You all know famous Pac-Man video game, right? The game is fun and building an animated Pac-Man character in HTML and CSS is just as fun! I’ll show you how to create one while leveraging the powers of the clip-path property.
See the Pen
Animated Pac-Man by Maks Akymenko (@maximakymenko)
...
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...
Why Are Accessible Websites so Hard to Build?
23.10.2019
I was chatting with some front-end folks the other day about why so many companies struggle at making accessible websites. Why are accessible websites so hard to build? We learn about HTML, we make sure things are semantic and — voila! @— we have an accessible website. During the course...
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...
Firefox Kiosk Mode
16.10.2019
As someone who loves the HTML and web APIs, I want to see them used in all different types of devices and mediums. Being that I work for the amazing Mozilla Corporation, seeing Firefox and the gecko web engine thrive in those spaces is important to me. Firefox was recently featured in the Firefox...
The Teletype Text Element Lives On… at Least on This Site
11.10.2019
It was this: <tt>
I say "was" because it's deprecated. It may still "work" (like everybody's favorite <marquee> in some browsers), but it could stop working anytime, they say. The whole purpose of it was to display text in a monospace font, like the way Teletype machines used...
Wufoo Cracks the Code for Forms So You Don’t Have To
8.10.2019
There was a lot of buzz about forms last week when Jason Grisby pointed to a missing pattern attribute on Chipotle's order form that could have been used to help-through millions of dollars in orders. Adrian Roselli followed that up with the common mistake of forgetting for and id attributes...
Some Hands-On with the HTML Dialog Element
7.10.2019
This is me looking at the HTML <dialog> element for the first time. I've been aware of it for a while, but haven't taken it for a spin yet. It has some pretty cool and compelling features. I can't decide for you if you should use it in production on your sites, but I'd think it's starting...
The Many Ways to Link Up Shapes and Images with HTML and CSS
1.10.2019
Different website designs often call for a shape other than a square or rectangle to respond to a click event. Perhaps your site has some kind of tilted or curved banner where the click area would be awkwardly large as a straight rectangle. Or you have a large uniquely shaped logo where you only...