Wednesday, January 6, 2016

An Introduction to CSS’s @supports Rule (Feature Queries)

The two general approaches to tackling browsers’ uneven support for the latest technologies are graceful degradation and progressive enhancement.

Graceful degradation leverages advanced technologies to design for sophisticated user experiences and functionality. Users of less capable browsers will still be able to access the website, but will enjoy a decreased level of functionality and browsing experience.

With progressive enhancement, developers establish a baseline by designing for a level of user experience most browsers can support. Their applications provide built-in detection of browsers’ capabilities, which they use to make available more advanced functionality and richer browsing experiences accordingly.

The most widely adopted tool in a progressive enhancement approach is the Modernizr JavaScript library.

Modernizr programmatically checks if a browser supports next generation web technologies and accordingly returns true or false. Armed with this knowledge, you can exploit the new features in supporting browsers, and still have a reliable means of catering to older or noncompatible browsers.

As good as this sounds, something even better has been brewing for some time. You can perform feature detection using native CSS feature queries with the @supports rule.

In this post I’m going to delve deeper into @supports and its associated JavaScript API.

[author_more]

Detecting Browser Features with the @supports Rule

The @supports rule is part of the CSS3 Conditional Rules Specification, which also includes the more widespread @media rule we all use in our responsive design work.

While with media queries you can detect display features like viewport width and height, @supports allows you to check browser support for CSS property/value pairs.

To consider a basic example, let’s say your web page displays a piece of artwork that you’d like to enhance using CSS blending. It’s true, CSS blend modes degrade gracefully in non supporting browsers. However, instead of what the browser displays by default in such cases, you might want to delight users of non supporting browsers by displaying something equally special, if not equally spectacular. This is how you would perform the check for CSS blending in your stylesheet with @supports:

[code language="css"]
@supports (mix-blend-mode: overlay) {

.example {
mix-blend-mode: overlay;
}

}
[/code]

To apply different styles for browsers that don’t have mix-blend-mode support, you would use this syntax:

[code language="css"]
@supports not(mix-blend-mode: overlay) {

.example {
/* alternative styles here */
}

}
[/code]

A few things to note:

  • The condition you’re testing must be inside parentheses. In other words, @supports mix-blend-mode: overlay { ... } is not valid. However, if you add more parentheses than needed, the code will be fine. For instance, @supports ((mix-blend-mode: overlay)) is valid.
  • The condition must include both a property and a value. In the example above, you’re checking for the mix-blend-mode property and the overlay value for that property.
  • Adding a trailing !important on a declaration you’re testing for won’t affect the validity of your code.

Let’s flesh out the examples above with a small demo. Browsers with mix-blend-mode support will apply the styles inside the @supports() { ... } block; other browsers will apply the styles inside the @supports not() { ... } block.

The HTML:

[code language="html"]
<article class="artwork">
<img src="myimg.jpg" alt="cityscape">
</article>
[/code]

The CSS:

[code language="css"]
@supports (mix-blend-mode: overlay) {

.artwork img {
mix-blend-mode: overlay;
}

}

@supports not(mix-blend-mode: overlay) {

.artwork img {
opacity: 0.5;
}

}
[/code]

Check out the demo on CodePen:

Continue reading %An Introduction to CSS’s @supports Rule (Feature Queries)%


by Maria Antonietta Perna via SitePoint

The Evolution Of Search Engine Optimization - #infographic

The History Of Search Engine Optimization - #infographic

“Search Engine Optimization has transformed significantly over the last 10 years.

The growth of the industry has directly impacted the way consumers research and buy, consequently guiding digital marketing decisions. Businesses have learned how to adapt to this rapidly changing marketing environment in order to remain competitive online.

To see where SEO is headed next, we need to look at where it has been.”

This infographic, created by marketing-mojo, illustrates how businesses have been forced to adapt to the rapid changes of the Internet and SEO over the last 10 years and provide a glimpse of where it is headed.

by Guest Author via Digital Information World

This Week in Mobile Web Development (#89)

Read this on the Web

Mobile Web Weekly January 6, 2016   #89
Brian Rinaldi recommends
The Phablet Era — According to Fred Wilson, people are converging on a single device format, the so-called phablet, and it has repercussions on how they use their devices.
AVC
Brian Rinaldi recommends
Putting My Patterns through Their Paces — Ethan Marcotte advocates a more device-agnostic and layered design process for building responsive sites.
24 ways
Holly Schinsky recommends
Why I Released an Ionic 2 & Angular 2 Application — Josh explains the reasons he decided to use the alpha version of Ionic 2 (dependent on the beta Angular 2) to develop and release his latest mobile app.
Josh Morony
This issue is sponsored by imgix
Decrease Page Weight and Load Times with Responsive Images — With imgix, integrating responsive images into your stack could not be easier. imgix can connect to an S3 bucket to resize, process, and serve images via CDN. Learn how to improve your images in less than 30 minutes.
imgix

Holly Schinsky recommends
Using Socket.IO and Cordova to Create a Real Time Chat App — A tutorial on building a real-time chat app with Cordova and Socket.IO.
SitePoint
Holly Schinsky recommends
What's New in Foundation 6? — Foundation is a family of responsive front-end frameworks that make it easy to design beautiful responsive websites, apps and emails.
SitePoint
Brian Rinaldi recommends
Flip that App! Hybrid Mobile to JavaScript Native — Jen Looper explains the process of converting a existing hybrid mobile app to a JavaScript native app built with NativeScript.
Telerik Developer Network
Brian Rinaldi recommends
An Introduction to Cordova: Basics — The first part of a series introduces Cordova and how to get set up and started.
Nettuts+
Holly Schinsky recommends
Set Up Push Notification for Cordova/Phonegap App on the Parse.com Platform — How to set up your PhoneGap app to support push notifications with the Parse.com platform.
Gaurav Butola
Brian Rinaldi recommends
A Few Predictions in Mobility for 2016 — Daniel Levy shares his personal predictions for the coming year including his belief that hybrid will lose further momentum.
Telerik Blogs
Brian Rinaldi recommends
Microsoft delays its Windows 10 Mobile upgrade to early 2016 — The upgrade for existing Lumia devices from Windows 8.1 to Windows 10 is being pushed back.
The Verge
Brian Rinaldi recommends
Using Ionic Creator with MobileFirst 7.1 — How to integrate the output from Ionic Creator into IBM’s cloud app development platform.
Raymond Camden
Brian Rinaldi recommends
Average Page Weight Increased Another 16% in 2015 — Dave Buckler cites data from HTTP Archive to report that average page weight increased 16% to 2,262KB in 2015.
SitePoint
Brian Rinaldi recommends
Use Font Awesome Glyph Icons With NativeScript — The steps to add Font Awesome to a JavaScript native project using NativeScript.
Nic Raboy
Holly Schinsky recommends
The 21-Step Checklist for Bulletproof Mobile User Onboarding — Why the user onboarding experience should be a primary focus during your mobile app development and useful tips to ensure your users keep coming back.
SitePoint
Brian Rinaldi recommends
What Happened In 2015 — One of Fred Wilson’s reflections on 2015 includes the end of the mobile app gold rush, with 8 of the top 9 apps being owned by Facebook and Google.
AVC
Holly Schinsky recommends
ionic-flat-colors: SCSS with New Options of Flat Colors for Ionic Components — A new library providing flat color palette options for your Ionic apps. Be sure to check out the documentation page for examples of the colors and styled components.
Matheus Cruz Rocha
Job listing
Mobile Software Engineer with MyDrive, London — We need a smart engineer with 3+ years experience to develop the future of Telematics through customer facing mobile technologies. You will be commercially experienced in developing either iOS or Android and ready to get stuck in as part of a great team here at MyDrive.
MyDrive Solutions

Job listing
New Year, New Job — Say hello to 2016 and goodbye to the headache of looking for a new job. Hired makes finding your dream job easier than ever before. What are you waiting for?
Hired.com

Curated by Brian Rinaldi and Holly Schinsky for Cooper Press.
Cooper Press is located at Office 30, Fairfield Enterprise Centre, Louth, LN11 0LS, UK
Update your email address
or stop receiving MWW here


by via Mobile Web Weekly

2015's best front-end Web technology/dev links

A look back at the most popular links of 2015
Read this e-mail on the Web
HTML 5 Weekly
Issue 221 — January 6, 2016

A special issue looking back at the best of 2015.

I hope you've had a great holiday season. As everyone is still warming up to 2016, we thought we'd look back at the most popular things we linked to in 2015. Enjoy! :-)
- Peter Cooper, Editor

Remy Sharp
A ton of useful insights, tips, videos, and more, on debugging issues in Web apps, front end development, etc.


Louis Lazaris
A followup to a previously successful 12 Little-Known CSS Facts.


Mozilla Hacks
A good introduction to the ‘Fetch API’, an API that aims to fix many of the problems with XMLHttpRequest (the core Ajax technology).


Grapecity  Sponsored
Learn Angular 2 concepts and understand how to use JavaScript controls in your AngularJS application. Follow Wijmo’s progress as they migrate their Angular 1 directives to Angular 2 components. Download and run Wijmo’s Angular 2 Explorer.

Grapecity

Ashley Nolan
Analysis of 1044 survey responses on CSS preprocessors, task runners, libraries.


Sam Dutton
A look at how to write clean, concise HTML with the goal of having it load more quickly across a variety of devices.


Addy Osmani
You can use Material Design Lite to bring a Material Design look and feel to your sites. It doesn’t rely on any JS frameworks and is optimized for cross-device use.


Bobby Grace
An eight part CSS guide providing some structure for writing CSS.


Mozilla Hacks
Web Components were first introduced to the world at Google IO 2012 but are still considered on the cutting edge. Wilson Page of Mozilla looks at what Web Components are, why they’re useful, and why they’re still not everywhere.


Jobs

  • Principal Web Developer (Bristol, UK)Join MixRadio if you are an expert web developer with superior front-end skills. Help us improve our speed of execution and architecture. Use ReactJS and ES2015 on cross-disciplined teams to deliver the next best music streaming service. MixRadio
  • Give back to the developer community - apply to teach today.Actively seeking web developers to join our tight knit family of passionate teachers and earn royalties. Pluralsight
  • Get 10 offers from top tech companies in one week.Indeed Prime is an elite new program from Indeed.com that presents in-demand tech talent like you to top employers. Indeed Prime opens the door to exciting career opportunities with one simple application. Join today! Indeed

In brief

Curated by Peter Cooper and published by Cooper Press.
Want to post a job? E-mail us or use our self-serve system.

Unsubscribe : Change email address : Read this issue on the Web

Published by Cooper Press Ltd. Office 30, Lincoln Way, Louth, LN11 0LS, UK


by via HTML5 Weekly

Setting up PHP 7 Servers with Laravel Forge and DigitalOcean

One of the most popular requests in our end-year reader-satisfaction survey was more PHP 7 content. In this quick guide, we’ll cover two ways to bring a PHP 7 server online on DigitalOcean - a popular VPS provider.

We’ll use two approaches, the latter of which will be applicable to any Ubuntu installation whereas the former will only work on DigitalOcean. If you don’t have a DigitalOcean account but would like to follow along, feel free to grab two free months via this ref code.

DigitalOcean logo

PHP 7 Locally

If you’d like to develop with PHP 7 locally, use our Homestead Improved - it’s already running PHP 7 by default. What’s more, it’s almost the exact same setup you’ll end up with by using Laravel Forge below.

Continue reading %Setting up PHP 7 Servers with Laravel Forge and DigitalOcean%


by Bruno Skvorc via SitePoint

Classie – Class Helper Functions

Classie is a lightweight script that allows you to add, remove, toggle, and check for classes in the DOM easily.


by via jQuery-Plugins.net RSS Feed

Creating Mobile Money Solutions for the Developing World

The notion of living an adult life without a bank account or computer may seem like an archaic notion for those of us living in the developed world. Yet for people in many parts of the world, the mobile phone is a lifeline to participation in financial daily life. This article explore the reality of coinless currencies using mobile platforms and discusses the challenges for entrepreneurs who might want to explore the sector.

Continue reading %Creating Mobile Money Solutions for the Developing World%


by Cate Lawrence via SitePoint