Bonnes Pratiques Web & Cloud
58.8K views | +0 today
Follow
Bonnes Pratiques Web & Cloud
Administration cloud et développement web
Curated by Mickael Ruau
Your new post is loading...
Your new post is loading...

Popular Tags

Current selected tag: 'fallback'. Clear
Scooped by Mickael Ruau
Scoop.it!

How @supports Works

How @supports Works | Bonnes Pratiques Web & Cloud | Scoop.it

CSS has natural fallback mechanisms such that if the browser doesn't understand a property:value combination, then it will ignore it and use something declared before it if there is anything, thanks to the cascade. Sometimes that can be used to deal with fallbacks and the end result is a bit less verbose. I'm certainly not a it's-gotta-be-the-same-in-every-browser kinda guy, but I'm also not a write-elaborate-fallbacks-to-get-close kinda guy either. I generally prefer a situation where a natural failure of a property:value doesn't do anything drastic to destroy functionality.

That said, @supports certainly has use cases! And as I found out while putting this post together, plenty of people use it for plenty of interesting situations.

No comment yet.
Scooped by Mickael Ruau
Scoop.it!

Introduction to variable fonts on the web  |  Web Fundamentals  | 

Introduction to variable fonts on the web  |  Web Fundamentals  |  | Bonnes Pratiques Web & Cloud | Scoop.it
We will look at what variable fonts are, how we can use them in our work.
Mickael Ruau's insight:

Fallbacks and browser support

Current support is limited, but variable fonts will work today out of the box in Chrome and Safari, with support coming soon to Edge 17 and Firefox. See caniuse.com for more details.

It is possible to use @supports in you CSS to create a viable fallback:

 
@supports (font-variations-settings: 'wdth' 200) {
 
@font-face {
   
/* https://github.com/TypeNetwork/Amstelvar */
    font
-family: AmstelvarAlpha;
    src
: url('../fonts/AmstelvarAlpha-VF.ttf');
    font
-weight: normal;
    font
-style: normal;
 
}

 
#font-amstelvar {
    font
-family: AmstelvarAlpha;
    font
-variation-settings: 'wdth' 400, 'wght' 98;
 
}
}
No comment yet.
Scooped by Mickael Ruau
Scoop.it!

Feature Detection in Browsers, Shims and Polyfills

Detect browser capabilities and features instead of detecting the browser itself. Feature detection is better than browser sniffing.

No comment yet.
Scooped by Mickael Ruau
Scoop.it!

How to Build a Responsive Website That Supports Older Browsers

How to Build a Responsive Website That Supports Older Browsers | Bonnes Pratiques Web & Cloud | Scoop.it
Responsive websites have became increasingly important over the years. Unfortunately, we still need to make older browsers support responsive websites due to various reasons once in a while, and searching around for the correct way of doing it can take up some of your precious time. This article is designed to help you answer the question on supporting responsive websites on older browsers.
No comment yet.
Scooped by Mickael Ruau
Scoop.it!

15 Best Web Safe HTML & CSS Fonts - WebsiteSetup.org

15 Best Web Safe HTML & CSS Fonts - WebsiteSetup.org | Bonnes Pratiques Web & Cloud | Scoop.it

Choose any font like Open Sans or Droid Serif or Lato. Generate the code and paste in your document’s <Head>. And you’re all set to reference it in CSS!

That took all of 60 seconds. And it was completely free. (Thanks, Google.)

So what could go wrong?

Not everyone will have access to that same font. Which means you got a problem. Because that beautiful font you just chose is going to show up as something random for your visitors.

But not if you create a fallback with a web safe alternative. Here’s how it works.

No comment yet.
Scooped by Mickael Ruau
Scoop.it!

Howler.js, une bibliothèque audio pour le web moderne

Howler.js est une bibliothèque JavaScript prenant en charge l'API Web Audio et procurant un mécanisme de secours (fallback) pour HTML5 Audio . Howler.js vise à simplifier les efforts de développement multi-plateformes avec l'audio en JavaScript.
No comment yet.
Scooped by Mickael Ruau
Scoop.it!

Conditional stylesheets vs CSS hacks? Answer: Neither! - Paul Irish

Conditional stylesheets vs CSS hacks? Answer: Neither! - Paul Irish | Bonnes Pratiques Web & Cloud | Scoop.it

There are a few problems with it though:

  • Conditional stylesheets mean 1 or 2 additional HTTP requests to download
  • As they are in the the <head>, the rendering of the page waits until they’re totally loaded.
  • Also - Yahoo’s internal coding best practices do not recommend conditional stylesheets
  • It can separate a single CSS rule into multiple files. I’ve spent a lot of time wondering “Where the eff is that rule coming from!?” when it turned out to be tucked away in a conditional stylesheet.
Mickael Ruau's insight:

Throw it on the html tag

Here is the new recommendation, and the one that’s in use in the HTML5 Boilerplate.

1 2 3 4 5 <!--[if lt IE 7 ]> <html class="ie6"> <![endif]--> <!--[if IE 7 ]> <html class="ie7"> <![endif]--> <!--[if IE 8 ]> <html class="ie8"> <![endif]--> <!--[if IE 9 ]> <html class="ie9"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->

Why?

  • This fixes a file blocking issue discovered by Stoyan Stefanov and Markus Leptien.
  • It avoids an empty comment that also fixes the above issue.
  • CMSes like Wordpress and Drupal use the body class more heavily. This makes integrating there a touch simpler
  • It doesn’t validate in html4 but is fine in html5. Deal with it.
  • It plays nicely with a technique to kick off your page-specific javascript based on your markup.
  • It uses the same element as Modernizr (and Dojo). That feels nice.

I left an empty class in there because you’ll probably be putting a no-js in there or something else. If not, delete.

 

(...)

Here is the current iteration that we have in the HTML5 Boilerplate. We actually tried to reduce it down to just a single .oldIE class for IE ≤8 (to use with safe css hacks), but that didn’t fly. Anyway, our current version..
1 2 3 4 <!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class=""> <!--<![endif]-->
No comment yet.
Scooped by Mickael Ruau
Scoop.it!

HTML5 Cross Browser Polyfills · Modernizr/Modernizr Wiki ·

HTML5 Cross Browser Polyfills · Modernizr/Modernizr Wiki · | Bonnes Pratiques Web & Cloud | Scoop.it
 

The No-Nonsense Guide to HTML5 Fallbacks

So here we're collecting all the shims, fallbacks, and polyfills in order to implant HTML5 functionality in browsers that don't natively support them.

The general idea is that: We, as developers, should be able to develop with the HTML5 APIs, and scripts can create the methods and objects that should exist. Developing in this future-proof way means as users upgrade, your code doesn't have to change but users will move to the better, native experience cleanly.

No comment yet.
Scooped by Mickael Ruau
Scoop.it!

HTML5 Please - Use the new and shiny responsibly

HTML5 Please - Use the new and shiny responsibly | Bonnes Pratiques Web & Cloud | Scoop.it
Look up HTML5, CSS3, etc features, know if they are ready for use, and if so find out how you should use them – with polyfills, fallbacks or as they are.
No comment yet.