Advent of CSS / 08 

Tags :

I discovered the Advent of CSS 2021 a bit late, but decided to give it a try anyway. This entry was retro-posted.

Day 08 / Weather Forecast

In this project, we’re creating a weather forecast.

7 days weather forecast with symbols illustrating the weather, temperature, precipirtation and low temperature
The weather forecast brief

See the Pen Advent of CSS / 08 by David Roessli (@davidroessli) on CodePen.

 

Loved using custom properties here! (Thanks again to @leaverou and @5t3ph for their smashing workshops!).

I should have used svg fragments, or sprites to lighten the markup though… which would fix the svg mix-blend-mode:multiply issue. It works fine in Safari 15…

Plain HTML and CSS used.

Update 2022-01-12 : included all the svg images inline. It solves the mix-blend-mode:multiply issue. I still wonder why it wasn’t the case in Safari… Having a gigantic blob of svg code at the end of the file isn’t very elegant. I need to figure out a better way to do this.

@chriscoyier sugested to use svg as an external resource in “SVG use with External Source” back in 2014 as well as @sarasoueidan in “An Overview of SVG Sprite Creation Techniques”. This is definitively the way to go, but remember that you can reference the sprite as an external URL, but only same-domain.

<!-- `<use>` shape defined ON THIS PAGE somewhere else -->  
<svg viewBox="0 0 100 100">  
   <use xlink:href="#icon-1"></use>  
</svg>  

<!-- `<use>` shape defined in an EXTERNAL RESOURCE -->  
<svg viewBox="0 0 100 100">  
   <use xlink:href="defs.svg#icon-1"></use>  
</svg>

Read more about “Accessible SVG Icons with Inline Sprites” by Marco Hengstenberg (@nice2meatu).

Posted a response ? — Webmention it

This site uses webmentions. If you've posted a response and need to manually notify me, you can enter the URL of your response below.

Want more ? — prev/next entries