Technology News

Resources aren’t requested by CSS, but by the DOM

This is a good tweet from Harry:

I like it because, as he says, it’s the correct way to think about it. It helps form a mental model of how websites work.

Just to spell it out a bit more…

/* Just because I'm in the CSS, doesn't mean I'll load! In order for `myfont.woff2` to load, a selector needs to set `font-family: 'MyWebFont';` AND something in the DOM needs to match that selector for that file to be requested.
*/
@font-face { font-family: 'MyWebFont'; src: url('myfont.woff2') format('woff2');
} /* Just because I'm in the CSS, doesn't mean I'll load! In order for `whatever.jpg` to load, the selector `.some-element` needs to be in the DOM. */
.some-element { background-image: url(whatever.jpg);
}
Elon Musk’s problematic plan for “full self-driving” Teslas
Cartona gets $4.5M pre-Series A to connect retailers with suppliers in Egypt

Related Articles

9 Best Free CSS Flexbox Tutorials

9-best-free-css-flexbox-tutorials
Every modern website needs to be mobile friendly. You can accomplish this by using responsive techniques, one of which is the CSS flexbox feature. Flexbox lets you define layout elements…

Show, Don’t Tell

Show, Don’t Tell
How much time do you spend designing the content presentation for your websites? When you write a new blog post or create a new page, are you thinking about just…

10 Beautiful Examples of iOS 11 App Design

10-beautiful-examples-of-ios-11-app-design
With iOS 11 having now been officially rolled out across Apple devices, we are beginning to see some beautiful examples of what can be achieved using the revised design language.…

How to Navigate the 2025 Identity Threat Landscape

Exploring the Potential of the Metaverse: A New World Awaits
Identity is at the center of the fight against adversaries. As threat actors weaponize legitimate credentials and sell access to the highest bidders, organizations must proactively detect and secure exposed…