惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
L
LINUX DO - 最新话题
P
Proofpoint News Feed
Cyberwarzone
Cyberwarzone
Know Your Adversary
Know Your Adversary
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
Lohrmann on Cybersecurity
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Security Latest
Security Latest
T
The Exploit Database - CXSecurity.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy & Cybersecurity Law Blog
K
Kaspersky official blog
The Last Watchdog
The Last Watchdog
Webroot Blog
Webroot Blog
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
C
Cyber Attacks, Cyber Crime and Cyber Security
WordPress大学
WordPress大学
L
LINUX DO - 热门话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
V
Visual Studio Blog
O
OpenAI News
AI
AI
Hacker News: Ask HN
Hacker News: Ask HN
V2EX - 技术
V2EX - 技术
GbyAI
GbyAI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Simon Willison's Weblog
Simon Willison's Weblog
S
Schneier on Security
Spread Privacy
Spread Privacy
Y
Y Combinator Blog
I
InfoQ
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
F
Fortinet All Blogs
C
CERT Recently Published Vulnerability Notes
T
The Blog of Author Tim Ferriss
C
Check Point Blog
Apple Machine Learning Research
Apple Machine Learning Research
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
N
News and Events Feed by Topic
Project Zero
Project Zero
小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
B
Blog
G
Google Developers Blog

Bryan Robinson's Blog

Does our technology still work for us? Product pricing, dev bad habits, and the role of the pit of success Astro Server Island for latest Bluesky post (heavily cached!) Type-safe environment variables in Astro 5.0 New Website, but really is it? Netlify Durable Cache: Caching for a third-party world Introducing the Hygraph Astro Content Loader Integrating Astro.js Starlight Documentation into a Next.js Project Using Proxies Jamstack is meaningless 😱 Book Release: Eleventy by Example – Learn 11ty with 5 in-depth projects 11ty Second 11ty: Creating Template Filters 11ty Second 11ty: Global Data files (JS and JSON) 11ty second 11ty: The Render Plugin Part 1 Help needed: Netlify Frontend environment variables with Astro.js Quick experiment with the Slinkity 11ty plugin Creating a dynamic color converter with 11ty Serverless Using 11ty JavaScript Data files to mix Markdown and CMS content into one collection How to show your template code in 11ty blog posts New City, New Job, New Content Using Nunjucks Climbing the 11ty Performance leaderboard with Cloudinary, critical CSS and more Three JAMstack movements to watch in 2020 Create a Codepen promo watermark with no additional HTML, CSS or JS 3 underused CSS features to learn for 2020 Use CSS Subgrid to layout full-width content stripes in an article template Adapt client-side JavaScript for use in 11ty (Eleventy) data files CSS Gap creates a bright future for margins in Flex as well as Grid Create your first CSS Custom Properties (Variables) Use CSS Grid to create a self-centering full-width element Creating an 11ty Plugin - SVG Embed Tool Now offering design and code reviews at PeerReviews.dev Routing contact-form emails to different addresses with Netlify, Zapier and SendGrid Create an Eleventy (11ty) theme based on a free HTML template Client work and the JAMstack Grid vs. Flex: A Tale of a "Simple" Promo Space Using Eleventy The Tech Barrier to Entry What Can We Learn from CERN Let Practical CSS Grid - Launching My First Course Build Trust on the Web incorporating User Worries with your User Stories 2019 The Year of Markup-First Development Refactoring CSS into a Sass mixin Starting a new journey with Code Contemporary Dynamic Static Sites with Netlify and iOS Shortcuts Top 3 uses for the ::before and ::after CSS pseudo elements How To: Use CSS Grid to Mix and Match Design Patterns Use CSS ::before and ::after for simple, spicy image overlays Modern CSS: Four Things Every Developer and Designer Should Know About CSS 3 Strategies for Getting Started with CSS Grid CSS Tip: Use rotate() and skew() together to introduce some clean punk rock to your CSS The 5 Stages of Grid Love How To: A CSS-Only Mobile Off Canvas Navigation How To: Use CSS Grid Layout to Make a Simple, Fluid Card Grid Make a More Flexible Cover Screen with CSS Grid Can CSS Grid open up interesting CMS Layout options? Firefox 52 to Introduce New Box-Alignment Values Start Exploring the Magic of CSS Grid Layout I Converted My Blog to CSS Grid Layout and Regret Nothing Feature Queries are on the Rise CSS Shapes — Let the Text Flow Around You Flexbox -- Let Memorializing Prince and Print vs. The Web I went to Italy and noticed UX fails How to Get Designers to Contribute in Open Source The True Gift of Your Former Code
Falling Forward — Rethinking Progressive Enhancement, Graceful Degradation and Developer Morality
2017-01-18 · via Bryan Robinson's Blog

Forget what you know about Graceful Degradation. Forget what you know about Developer Convenience. Forget what you know about Progressive Enhancement.

Instead of arguing over these terms, we should focus on how to change our culture. Create “fallforwards” not “fallbacks.”

In some ways this post is a semantic argument. Yet, it is an important one. 

Lera Boroditsky, an assistant professor at Stanford, wrote an article on the effects of language on cognitive reasoning.

For those of us who studied philosophy and linguistics in college, this comes as no surprise. Yet, the depth of this influence bias is amazing.

This seems obvious in some cases. A language that often genders its vocabulary will have children that recognize their gender earlier (page 65 in the reference). In other cases it can be astounding. A 5-year-old girl living in an Australian Aboriginal community could discern cardinal directions. Intelligent adults in Western cultures struggle to gain a sense of direction. 

The languages of these cultures actively shapes comprehension.

The girl from the example speaks a language with no relative spatial terms. Instead of an object being to the left of someone, it’s to the southwest. 

The linguistic need turns into an intellectual need: keeping track of directions. The brain forges the neural pathways necessary to accomplish this need.

As it turns out, a semantic argument can be very important for creating culture shift.

In our world of web development, we talk a lot about fallbacks.

We use this word to mean “when this feature we’re using is not available to a user, how should our application behave?” 

If JavaScript is disabled, what should this animation that depends on it do? If a browser doesn’t support object-fit, should the image squish or hold its aspect ratio?

Why does it matter if we use this word?

Most definitions of “fallback” refer to “retreat” or “emergency” or other negative words. If our language is negative, we may end with a negative opinion of those we support.

Or at the very least, we may view them with less sympathy.

We shouldn’t retreat from these users. We should support them and then push forward into a new and awesome future.

Is this different than “Progressive Enhancement?” No, not really. This is more about ditching the negative connotations.

Let’s get started. As an example, let’s take a simple design form: an article list.

Our first step is simple, clean markup. This, out of the box, works on all browsers and devices. Each article has a headline, description and link.

<section class="grid">
    <article class="item primary">
        <time class="date">12 Jan, 2017</time>
        <h2>Start Exploring the Magic of CSS Grid Layout</h2>
        <p class="description">Grid is an amazing new CSS Specification coming to major browsers in 2017. When it’s ready for use in production, it’s going to drastically change the way we do layout on the web. Currently, there’s...</p>
        <a href="http://bryanlrobinson.com/blog/2017/01/12/simple-grid-examples/" class="button">Read More</a>
    </article>
</section>

Plain HTML

Not exactly revolutionary.

Next, we add simple styling, clean the margins and make it look good on mobile.

    .grid {
        margin: 10px 0;
    }

    .grid .item {
        box-sizing: border-box;
        margin: 0px 10px 10px;
        padding: 5vw;
        background-color: $brand-light;
    }

With some simple styling

These styles should be basic. Strive to add visual hierarchy and weight with spacing, colors and small images and clean the reading experience.

When we’ve got more screen real estate than mobile, we expand into layout. In our case, a two-by-two card view would be nice on tablet. As we approach bigger sizes, though, the width of these boxes is too wide for our content.

In this example, we use media queries to affect the flex-basis to adjust the size of these boxes.

@media (min-width: 480px) {
    .grid {
        display: flex;
        flex-wrap: wrap;
    }
    .grid .item {
        margin: 0 5px 10px;
        flex: 1 calc(50% - 10px);
    }
}
@media (min-width: 768px) and (max-width: 1228px) {
    .grid .item {
        flex-basis: calc(33% - 10px);
    }
}
@media (min-width: 1228px) {
    .grid .item {
        flex-basis: calc(25% - 10px);
    }
}

A collage of sizes

If this sounds like “mobile-first design,” you’re right. Mobile is a very restrictive place for design. It’s also very restrictive for powerful hardware available cheap. This means we need to put a premium on the content, not the “design.”

Once we get our simple layout done, we can expand on the layout. In our example, we have a perfectly nice layout for articles. We have served our audience. Now, let’s have fun.

CSS Grid Layout is something I’ve written about recently. I’ve even begun using it to lay out pages on this site.

Let’s make an impactful layout for our articles using some fun new code.

@supports (grid-auto-rows: 1px) {
    @media (min-width: 1100px) {
        .grid {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
            grid-template-areas: "main   main main    second   third fourth"
                                  "main   main main    fifth    fifth fifth"
                                  "promo  promo promo  promo    promo promo"
                                  "sixth sixth seventh seventh eighth eighth"
                                  "sixth sixth seventh seventh ninth  tenth";
        }
        .grid .item {
            display: flex;
            flex-direction: column;
            justify-content: center;
            padding: 20px;

            &:nth-child(1) { grid-area: main; }
            &:nth-child(2) { grid-area: second; }
            &:nth-child(3) { grid-area: third; }
            &:nth-child(4) { grid-area: fourth; }
            &:nth-child(5) { grid-area: fifth; }
            &:nth-child(6) { grid-area: sixth; }
            &:nth-child(7) { grid-area: seventh; }
            &:nth-child(8) { grid-area: eighth; }
            &:nth-child(9) { grid-area: ninth;}
            &:nth-child(10) { grid-area: tenth; }
            &.promo { grid-area: promo; }
        }
    }
}

img

In the code above, I’m using CSS Feature Queries to identify if a browser supports Grid before using it. By utilizing grid-auto-rows and not just display: grid, I can have Edge ignore it for now, but begin seeing it when it updates in 2017.

With an idea of fallbacks, a developer might try to have Grid be the main layout engine. They might then fallback to flexbox using an @supports not (display: grid) query.

The problem is Internet Explorer doesn’t understand Feature Queries. This means your handcrafted fallback will fail, as well.

This is not a new concept. Call it Progressive Enhancement. Call it Moral Development. Call it Defensive Coding. Just don’t call it a Fallback. Support your users and fall forward into new design and code.