Front End Web Development

Variable Order

Css Tricks - Thu, 02/22/2018 - 5:25am

A fascinating little tech demo by Roman Komarov that allows for clickable table sorting entirely in CSS. It's a combination of inline CSS custom properties, the order property, and calc().

This demo sparked a ton of conversation about accessibility, the crux of which is that the reordering is done only visually and not in the source. Which means that someone interacting directly with the source (a screen reader) might be mislead into thinking they've sorted the table when they haven't. Rachel Andrew pointed out that it's actually one of the rare things the spec itself tells you not to do:

Authors must use order only for visual, not logical, reordering of content. Style sheets that use order to perform logical reordering are non-conforming.

As a connoisseur of fine CSS trickery, I applaud the idea. In production, still a job for JavaScript. And about that order property? Is it always a bad idea to use? Amelia Bellamy-Royds has a post with a pretty good use case. And Adrian Roselli's HTML Source Order vs CSS Display Order covers the struggle.

Direct Link to ArticlePermalink

Variable Order is a post from CSS-Tricks

Some Things I Recommend

Css Tricks - Thu, 02/22/2018 - 5:12am

Howdy. I'm taking this week's "Sponsored Post" to give a shout out to some apps, courses, and services that I personally like. These things also have affiliate programs, meaning if you buy the thing, we earn a portion of that sale, which supports this site. That money goes to pay people to write the things we publish. That said, everything on this list is something that I'm happy going on the record endorsing.

  • PixelSnap: A macOS Toolbar app for getting pixel dimensions from anywhere on the screen. Way handier than trying to use ?-?-4 for that.
  • An Introduction to Gutenberg by Joe Casabona: We just had a ShopTalk episode about how Gutenburg (a new editor) is coming to WordPress. There is certainly stuff to learn, and this is a course you can take to do that learning.
  • React for Beginners: Speaking of learning, this Wes Bos course will get you up to speed with React. Wes has loads of other great courses as well, like on Redux, Node, ES6, and CSS Grid.
  • Learn UI Design: Learn how to design effective user interfaces with Erik Kennedy.
  • Club GreenSock: The best animation framework out there. Once you're a member, you get access to use stuff like the MorphSVG plugin and their new GSDevTools.
  • Amazon List: I made a little storefront of some items I love and use all the time.
  • WP DB Migrate Pro: I think this is my favorite WordPress plugin. I like to work on my WordPress sites locally, and I always want a fresh copy of the database from production so I'm designing and developing around reality. This makes it a push-button affair.
  • Jetpack: I'm also a fan of all the things Jetpack does for my WordPress site. It kinda seems like a big scary monolithic plugin, and in a sense it is, but you can easily flip features on and off as you need them. I should do a whole post on what I use, but for starters, Markdown-everywhere, social media posting, commenting improvements, handling subscriptions, increased security, and actually-good related posts.

Some Things I Recommend is a post from CSS-Tricks

The JavaScript Learning Landscape in 2018

Css Tricks - Wed, 02/21/2018 - 4:15am

Raise your hand if this sounds like you:

You’ve been in the tech industry for a number of years, you know HTML and CSS inside-and-out, and you make a good living. But, you have a little voice in the back of your head that keeps whispering, "It’s time for something new, for the next step in your career. You need to learn programming."

Yep, same here.

I’ve served in a variety of roles in the tech industry for close to a decade. I’ve written a bunch of articles on design, coding, HTML, and CSS. Hell, I’ve even written a few books and spoken at conferences around the world. But there’s still that voice that keeps telling me I need to tackle programming; that I’ll never be fulfilled until I learn how to develop my own ideas and projects from scratch. Being a web guy, the obvious language to learn: JavaScript.

Like a lot of people, though, I’m intimidated by the current JavaScript landscape. With the constant influx of new tools, techniques, and frameworks, it’s hard to figure out where and what to start learning. Still, I need to start somewhere. So I thought a review of learning resources and tools would be a good first step.

The Burden of Information

How about this, does this sound familiar, too?

You’ve attempted to learn programming before with a few different languages. You’ve read books, you’ve subscribed to online courses, and you have a bunch of folders littering Dropbox with half-completed code and copied exercises.

Samesies.

I’ve gotten halfway through The Rails Tutorial and Learn Python The Hard Way. My bookshelf is full of massive tomes on everything from ActionScript to Processing. But nothing ever seems to stick.

I can figure out what a PHP file does and understand a bit of jQuery, but if you asked me to sit down and write the most basic of programs, I’d be hard-pressed to do it. After so many failures, I think I’ve figured out the problem.

Any time I start learning something new, I immerse myself as fully as possible in that topic. I buy books, I watch videos, and I listen to podcasts. It’s the same tactic that a lot of companies push as the best way to learn a new topic, whether it’s programming, cooking, or picking up Mandarin in a weekend. Immersion is a key part of learning, apparently.

But the problem is that people (or at least me) have a threshold for how much information they can process before feeling overwhelmed. I call it the "burden of information." Information is wonderful, but too much of it weighs down the mind, leaving you burnt out and hopeless, and leading you to give up and feel like a failure.

I don’t want this attempt to be like all the others. I know that I need to immerse myself in JavaScript but I don’t want sink into the quicksand of the JS world only to suffocate myself. So I decided to review the JavaScript learning landscape and pick out a few resources—but not too many—that I can use to finally scratch the programming itch.

I broke resources out into four categories, based around the different ways that I like to learn (and I suspect others like to learn, too). Those categories are: reading, watching, listening, and, most importantly, doing.

Here’s what I found.

Reading

My favorite way to learn new things is by reading about them. While that mostly means books, I also love filling up my RSS feed with good blogs and my inbox with great newsletters.

Books

Fortunately for me, there are a ton of acclaimed books about JavaScript. Here are some of the most recommended:

When I was attempting to learn Python, my favorite resource was Zed Shaw’s Learn Python The Hard Way. It was a no-BS approach to learning by actually coding. While he has a similar book about JavaScript in the works, it’s not available yet.

The closest I could come to it was Eloquent JavaScript by Marijn Haverbeke. From what I’ve heard, it’s a wonderful introduction to JavaScript and, looking at the contents, it appears to follow a similar approach as Zed’s Hard Way books: starting off with the nuts and bolts of the language and progressively getting more challenging as more advanced concepts and projects are introduced.

All of the other books in my list look excellent but most seem a bit too advanced for where I am right now. The two exceptions are Jon Duckett’s JavaScript and jQuery and Mat Marguis’ JavaScript for Web Designers. I loved Jon’s book on HTML and CSS but don’t feel like the visual approach used in his books will work for more complex topics (at least for me). And Mat’s book looks like it addresses my use case perfectly but seems like it won’t be in-depth enough for longer term learning. Still, as I have most of the other A Book Apart books, I’ll probably supplement Eloquent JavaScript with JavaScript for Web Designers.

I’m sure there are a ton of other fantastic books on JavaScript out there, but those will have to wait until after I finish my chosen book. Remember, I want good information, but not too much of it right away.

Blogs

Holy crap, there are a ton of blogs out there on JavaScript. It actually makes figuring out which ones are good kind of tricky. I’m open to any suggestions you might have (leave them in the comments!) about who I should follow, but my initial take is that these are a good place to start:

There are a bunch more that I came across but most seem too complex at this point in my learning. Or others belong to individuals that talk mostly about their own projects and less about the basics or the process of learning. I’ve bookmarked all of them, though, to dig into once I’m more up-to-speed.

Newsletters

I’m an unabashed lover of HTML newsletters, as evidenced by my previous writing on the subject. So, naturally, I hunted down a couple to subscribe to:

But I get the sense that there are more out there that I just couldn’t find. I mean, there’s a newsletter for damned near any topic. With JavaScript being so popular, there have to be more than the two newsletters I found above. If you have any tips, send them my way via the comments below.

Watching

Another good way to learn is by watching others do the thing you want to do. But this is almost always secondary to me reading to learn. Still, when I get stuck on a topic or want to dig deeper into certain aspects of coding, watching videos will be a good way to do it.

For the most part, there are two categories of videos online: courses and standalone videos (mostly on YouTube). There are a ton of options for both, but these are the best from what I can tell:

I’ve heard amazing things about Wes Bos’ courses, so I’m going to dig into those at some point. The same goes for both The Coding Train and Fun Fun Function. But again, I don’t want to be overwhelmed, so I’m planning on setting all of those aside for after I work my way through *Eloquent JavaScript*.

Listening

Podcasts are an excellent way to learn about concepts and immerse yourself in a particular culture without needing to be actively tied to a screen. Basically a good way to keep learning while I get the dishes done or pick up after my kids.

But, like with email newsletters, I found it difficult to track down good JavaScript podcasts. Looking around, it seems like there are a ton out there but most are inactive and outdated. I came up with the list below but I’m hoping that y’all can point out a few more to add to my podcasts feed.

Doing

The last, and arguably most important, part of learning JavaScript is the actual doing part: writing code, getting it to work, and repeating.

Like I mentioned at the beginning, I’ve been writing HTML and CSS (and playing around with other technologies) for years, so I’m a bit biased on some of my tools. I mostly work with Sublime Text on my Mac, so I plan on sticking to that for writing code locally. But, as I’ve been working more on my iPad Pro lately, I’d like to augment Sublime Text with a few additional tools for writing and testing code while I’m learning.

The main one will be CodePen. I’ve been a Pro subscriber for a while and find that it’s tremendously useful for writing code no matter what platform I’m using. Since it works in the browser, it’s easy to pop open a pen on my iPad while I’m hanging out at the coffee shop and have a full-fledged JS development environment ready to go. It also has a few features that I’m sure will come in handy at some point: private pens and collections for when I want to keep embarrassing code secret, projects for when I want to work on more substantial stuff and have it hosted somewhere without any pain, and collaboration mode for if I ever need to tap some friends to help me out with some tricky code in realtime.

I looked at other tools like JSFiddle and JSBin, but I’m comfortable in CodePen and their features are killer, so I’m sticking with it.

One other online tool that I plan on using at some point is Glitch. It's a relatively new tool for writing code and sharing it online and has a wonderfully eclectic community that’s built up around it. While I think most of my coding will be done in CodePen or locally in Sublime Text, I think Glitch will be vital when it comes time to learn about more complex things like interacting with APIs, making weird bots, and testing out some of those scary frameworks.

My Learning Plan

So, taking into account all of the resources above, here’s what I’m planning on doing to learn the basics of JavaScript over the next few months:

  • Work through Eloquent JavaScript
  • Code locally in Sublime Text but primarily online with CodePen
  • Keep up with news via the blogs, newsletters, and podcasts I found
  • Dive into JavaScript 30 and ES6 for Everyone after I’m done with Eloquent JavaScript
  • Start working through the videos and books listed above after I’m done with Wes Bos’ tutorials
  • Build some (hopefully) cool stuff in the process

One of the most important aspects of learning, though, is getting feedback on what you’re actually doing. For that, I’m going to be calling on a few friends and anyone reading this who wants to pitch in.

I’ve set up a new collection on CodePen to house my JavaScript projects throughout the learning process. I’ll keep that collection public so that anyone can see what I’m doing, fork examples, and school me on the best way to do things. If that sounds like your bag, then follow along on CodePen.

Finally, if you have any other resources or strong opinions on the ones I’ve listed above, let me know in the comments below. I’m sure a lot of you have been through a similar learning process and have some amazing tips you can share. I’d love to hear from you, so drop some knowledge right here on CSS-Tricks or email me.

The JavaScript Learning Landscape in 2018 is a post from CSS-Tricks

Gotchas When Publishing Modules in npm and Bower

Css Tricks - Tue, 02/20/2018 - 4:21am

Bower and npm are de-facto the package managers of the web. I doubt there are many front-end developers out there who haven’t heard of them or used them to manage dependencies.

Whilst many of us use them as consumers, one day you might decide to share a project of your own and become a contributor! This happened to me recently. I had the experience of publishing my open-source library on npm and Bower.

Although their official docs were quite good, I still ended up struggling with three little known gotchas. I won’t focus on the basics in this post. You can always find and read about them. I’ll instead focus on the gotchas.

Nowadays, it looks like even Bower tells people not to use Bower. However, in 2018, there are still many projects that depend on it. The state of JavaScript in 2017 survey shows that around 24% of surveyed developers still use Bower as a package manager. Therefore, I think it might take a little while before we see the end of Bower, which means it's probably still worth supporting it to cover legacy-package-managed projects. I feel the pain of those of you working on a legacy project—that’s why I chose to publish my open source module there, too.

My hope is that after this you’ll be one step ahead when you decide to share your code with the world. Without any further ado, here are some gotchas I've come across when managing packages.

Removing a Package From npm

Why bother spending hours choosing a name, when you can focus on shipping the features first? In my first experience with npm, I was unfortunate to leave the name of my project "test-something."

Guess what? A few days later, I found out that the un-publish option in the npm public registry is only allowed with versions published in the last 24 hours. If you are trying to un-publish a version published more than a day ago then you must contact support.

They state that it is generally considered bad practice to delete a library that other people depend on. I understand that but I’m 100% sure that no projects depend on a package called "test something."

I was about to leave things alone, but my test package was going to be visible forever in my shiny npm user profile. Dislike!

I contacted support and they handled my request within the very same day. They still didn’t want to completely un-publish it but they did transfer it to the @npm user account and deprecated it with a deprecation note. This removed it from my profile (woohoo!) and from the search results. However, if someone knows the exact URL (or name) they can still install it. While that's not totally ideal, the deprecation note will still be an alert that the package is no longer supported.

I think this might be related to the 11 lines of code, that Azer Koçulu deleted from npm and which kind of broke the internet for a moment. Safety first.

The moral of the story: make sure to choose your package name wisely!

Exporting Modules

Another gotcha I encountered was how to export my module. I wanted to do it in a universal way so that anyone can import it to the browser in any of the three most popular approaches. For example...

...with ES6:

// If a transpiler is configured (like webpack, Babel, Traceur Compiler or Rollup): import MyModule from 'my-module';

...with CommonJS:

// If a module loader is configured (like RequireJS, Browserify or Neuter): const MyModule = require('my-module');

...or by referencing the script file in the HTML:

<script ="/node_modules/my-module/index.js"></script>

What I was actually looking for is the Universal Module Definition pattern. It's a pattern that provides a clean way to expose your module to different environments that consume modules in a variety of ways.

This pattern has a couple of variations, depending on what you really need. However, modules written this way are capable of working everywhere, be it in the client, on the server or elsewhere.

The standard pattern is:

(function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['dependency'], factory); } else if (typeof module === 'object' && module.exports) { // Node. Does not work with strict CommonJS, but // only CommonJS-like environments that support module.exports, // like Node. module.exports = factory(require('dependency')); } else { // Browser globals (root is window) root.returnExports = factory(root.dependency); } }(this, function (dependency) { // Use dependency in some fashion. return { // Your module goes here }; }));

If you're using Grunt, Gulp or webpack, you'll find that there is a plugin that can wrap your modules like this for you. Plus, it's in the core of webpack already!

Managing Distribution Files

This one was really tricky.

I am building a package for npm and Bower. I followed the pattern to keep the working files (ES6) in the src/ package directory and build my distribution files (ES5, compiled with Babel) in the dist/ directory.

I ignore the entire dist/ folder in the .gitignore file. You know the drill: source control should only contain source. If it's generated from the source, it doesn't belong there—it should be generated by your build process instead.

On the one hand (npm), I have a .npmignore which does exactly the opposite and ignores src/ instead of dist/. On npm, I only want my distribution files. That works out perfectly well.

On the other hand (Bower), the dist/ folder is missing in the repository and, therefore, the Bower package doesn't include it. You see, Bower tracks your publicly available Git endpoint only. By pushing Git tags you release a new version on the Bower registry. Yes, it can ignore files, but they are related only to the files in your repository.

So, how can I publish the ignored by git dist/ folder contents on Bower?

I'm not sure it's possible to do. The only workaround I found is to commit the distribution files in the repository. If you really want to keep those distribution files out of the repo, the trick is to commit them right before you release a tag. Release a tag. Remove them.

There is one more use case that gives me some peace of mind. Imagine somebody downloads a ZIP of your repository and drops it into their project. They won’t need your fancy build step. The production source is already there. All right, maybe that’s not so bad after all.

Wrapping Up

Both npm and Bower continue to be widely used and helpful ways to manage project dependencies, even if Bower is bowing out. While they're great at what they do, being the owner and a contributor to a package listed in either package directory presents some challenges for us and I hope the ones I've outlined here help save other some time and possible headache.

Do you know any other ways to handle the gotchas covered here? Or have stumbled into gotchas of your own? Let me know in the comments!

Gotchas When Publishing Modules in npm and Bower is a post from CSS-Tricks

Linkbait 37

QuirksBlog - Tue, 02/20/2018 - 1:46am

We are an equal opportunity linkbait. Last week we bashed Facebook; this week we bash Google.

  • Tim Kadlec on AMP — again.

    The web community has stated over and over again that we’re not comfortable with Google incentivizing the use of AMP with search engine carrots. In response, Google has provided yet another search engine carrot for AMP.
    This wouldn’t bother me if AMP was open about what it is: a tool for folks to optimize their search engine placement. But of course, that’s not the claim. The claim is that AMP is “for the open web.”

    The fact that Google tries to use our ideology is one thing. The fact that we continue to fall for it is quite another.

    Why a subset of HTML you ask? Well, mostly because web developers suck at their jobs and have loaded the web with a ton of JavaScript no one wants. Can't fault Google for wanting to change that. That part I can support. The less JavaScript the better.

    And here we’re back smack bang in the middle of the problem. Today’s average web developer doesn’t have the faintest clue what he’s doing and can’t do it anyway without sixteen libraries and frameworks. Solve that problem and AMP goes away.
    (Masculine pronoun used deliberately, and if there were a white pronoun I’d also have used it. I more and more think that frameworks and libraries are the things mediocre white men need to survive in today’s front-end world.)
  • It’s useful to post a repeat link to an older The Register article that calls for killing AMP before it kills us.

    Except that, hilariously, to create an AMP page you have to load a, wait for it, yes a JavaScript file from Google. Pinboard founder Maciej Ceg?owski already recreated the Google AMP demo page without the Google AMP JavaScript and, unsurprisingly, it's faster than Google's version.

    and

    If we reject AMP, AMP dies.

    In order to reject AMP we need to tone down significantly on the frameworks. Could happen, but right now it’s not happening.
  • Ferdy Christiant agrees with the performance findings. He studied AMP’s performance profile (supposedly its biggest advantage) and found that his test AMP page is not noticeably faster than a regular web page. Also, he found that AMP is effectively preloading assets for a better perceived performance. If your goal is to improve perceived performance, this is a clever idea. Ferdy adds, however, that this gives Google, owner of the world’s most important search, an unfair advantage, especially since it does not run this preloading trick on non-AMP pages, while I suppose it could if it wanted to.
  • Luke Stevens feels Google is forking the web. This is reinforced by the news that AMP will now get a JavaScript component as well; something that was purposely omitted so far. But it will of course be a special type of JavaScript that (only?) offers simple DOM methods that are ’sanitized” by the AMP app itself.
    In other words, a subset of JavaScript that will (surprise!) turn out to be not enough for AMP developers, who will either demand more and thus import the web’s performance problems to AMP, or leave AMP altogether, which leads to a win for the web.
    In any case, it makes it less and less clear what AMP is supposed to be a solution to. And people have tried and failed to fork the web so often that I am not terribly worried right now.
  • Mike Monteiro calls for some sort of licensing for designers. This is an interesting idea, but from experience with attempting the same on the front-end side I’ll warn him it’s an uphill battle. On the other hand, my attempt was more than ten years ago, and meanwhile the world has changed.
    While discussing this article I had an idea: how would designers and back-end developers feel about front-end certification? Would they think it’s a good idea?
    Designers who agree with Mike should ask themselves something similar: would developers care? Possibly, I’d say.
  • Patterns for writing manageable CSS without a framework. Simple, solid, sensible advice for managing your CSS. From a purely visual standpoint you can achieve the same by using a CSS framework, but

    My preference for manually writing layout styles is to reduce dependencies, write less-complicated markup (not littered with wrappers and generic class names), and retain the greatest control possible. By writing my own layout system, I can make exceptions for certain cases without relying on “overrides”. When there are edge cases, exceptions can be easily made without hideous hacks upon CSS written by someone else.

    Makes sense.
  • Turns out Mozilla created a JSON feed for browser compatibility data. Interesting idea; I toyed with it ages ago but was too lazy busy to actually implement it.
    As far as I know, except for individual MDN pages, there is no interface yet where you can easily access the information (yeah, I know I could write one myself, but time constraints, and my profound lack of experience with GitHub).
    Still, excellent idea, as long as the data is valid. I occasionally have beef with MDN data, and I also think they do not cover enough browsers. UC and Opera Mini, for instance, are missing. World wide web, remember?
    (Via Jens Grochtdreis)
  • A very neat trick: CSS-only sortable tables. Say again? CSS only? Yup.
    How? By clever use of CSS variables. Read and make your head explode with possibilities.
  • For the mobile history buffs among us: a long look back at the fall of Nokia during the tenure of Stephen Elop, drawn mainly from Finnish inside sources.
  • Have a tip for the next Linkbait? Or a comment on this one? Let me know (or here or here).

The Red Reveal: Illusions on the Web

Css Tricks - Mon, 02/19/2018 - 10:24am

In part one of a series of posts about optical illusions on the web, Dan Wilson looks at how to create the “Red Reveal” that he happens to describe like this:

Growing up, my family played a lot of board games. Several games such as Outburst, Password, and Clue Jr. included something that amazed me at the time — a red lens and cards with some light blue text that was obscured by a myriad of red lines. When you put the red lens over the card, the text would magically appear.

Here’s one example of that effect from a nifty Pen:

I’d also recommend reading part two in this series, Barrier Grid Animation, which uses a bunch of CSS techniques to trick your eye into seeing an animation of several static images.

Direct Link to ArticlePermalink

The Red Reveal: Illusions on the Web is a post from CSS-Tricks

My Talk Writing Process

Css Tricks - Mon, 02/19/2018 - 4:11am

Some people have a talk preparation process that is super organized and runs like a well-oiled machine. Mine, on the other hand, is a bit messy, but it works for me. Even when a talk looks polished and put together on stage, it doesn’t mean the process to get it there was that way too.

Me on stage at An Event Apart.

When putting together a new talk recently, I noticed there was most definitely a pattern to how my talks take shape. Here’s how the talk-making process goes for me:

The Research Phase

True to the nature of research, all my talks start by collecting articles, books, videos, and other things that relate to the topic of the talk. At this point in the talk development process, I usually only have a general topic idea instead of a fully fleshed out point-of-view or main message. That means I end up collecting things that might only be tangentially related to the topic and going down some strange topical rabbit holes.

I'll save all these as a collection of bookmarks but usually also in a Google Doc with notes or quotes from the piece that seem most relevant. That makes it easier to keep a high-level view of what I've collected, and even discover interesting threads that connect some of the seemingly unrelated sources.

This initial phase is intentionally fuzzy on focus. Only a small percentage of the research I collect actually makes it to the end talk content. Sometimes the things that don't make it spark ideas for other talks, or just gets filed away in my brain for future (hopefully interesting) things.

Outlining: The Giant Mess Phase

There's probably a smarter sounding name for this phase, but for every talk I've done, there's always a point where I step back and think, "Holy crap this is all a giant mess! What am I even doing with all this!?" So, that's what I'll call this phase. This is the phase where I make a general outline for the talk (again in a Google Doc or Word file) and start fitting my thoughts, examples or demos, and relevant research into it.

I outline the major points I think the talk should make and try to fit them into some sort of narrative order. These tend to change and morph a bit as the talk takes shape, but that's OK because I'm still in the giant mess phase.

At the top of my document I have a three-part block that helps keep me focused:

What is the main question this talk answers (or the main problem it addresses)?

What is the main message of this talk?

Three points that support the main message:

(I started doing this on advice from Bill Smartt, and it’s been a huge help ever since.)

A talk outline for a 30 min talk complete with comments to myself.

The rest of the document addresses the body of the talk with each main point as a headline and some notes underneath it. Personally, I don't write out talks word-for-word and memorize them. I do write out an introduction and conclusion to make sure I'm setting up the topic and summarizing it well, but the rest of the notes are bulleted lists of points to make and references supporting examples, demos, or references. I leave space at the bottom of the document for random thoughts and notes as well as probably a few too many comments to myself on possible changes to make or different directions to take. Points that don't fit into the main narrative get moved down to this section too.

Once I feel like I have a cohesive outline, or at least one that isn't a total mess, I move on to making some visuals.

The Editing Phase A recent talk with all the edited-out slides shown ghosted out. Those slides never made it to the final talk.

This is the point where I start making slides and such based on the outline. Some people leave slides to the very last thing, but I leave them more to the almost last thing and do some of my thinking and organizing while I build up the slide deck.

I'll make slides for each point in the outline, take screen recordings of demos or examples, and start piecing things together in order. I tend to think of my talks in sections at this point and, as I create the slides for each section, I'll try talking through them out loud to see how they flow. (It’s amazing how different things sound when you say them out loud!)

There is a lot of rearranging and cutting out during this phase to work towards something that feels cohesive. I keep working on adding, deleting, and rearranging slides until I've got visuals for the full narrative of my outline. Sometimes things fall into place quickly, but for most talks this part can take a while.

At this point I almost always have far too much content. I'll run through what I have for the talk in 10 to 15 minute chunks, editing down and solidifying points until I've got something that fits neatly into the required time length. Most times this means a 30 minutes and 45-60 minute version of the talk depending on the format of the event where it's being given.

The same talk without the slides that have been edited out. Rehearsing: The Talking to Myself Phase

Rehearsing is so important but it can also be very awkward. It seems like everyone has a different strategy for rehearsing talks, which totally makes sense. I have a really hard time rehearsing talks in their entirety when I'm standing in my office talking to the wall or to the dog, so I tend to rehearse in 15 or 30 minute chunks; practicing the first half then taking a break to do some other things and coming back to run through the second half. That way I know I have a handle on all the material, but haven’t driven myself (or the dog) up a wall with all that talking to no one in particular.

Ah, that familiar presenter notes view. I like a giant notes window even though I rarely actually read them while I’m on stage. They're a "just in case" kind of thing.

As often as possible I'll try to give a new talk to a few friends or at a meetup before doing it on stage for the first time. Having a real live human audience can really help show which points are strong and which might need a bit more work to get across well. I also always run through the "final" talk from start-to-finish at least once in the 24 hours before I’ll be on stage to make sure all the content is fresh in my mind.

A Talk is Never Really Done

Seriously. They really never are. The funny thing about talks is that when you give them more than once, they're rarely exactly the same. (Yes, it is totally fine to do the same talk more than once.) There is always something to improve, something to add, or new points or examples to add to the narrative.

I usually make notes for myself on what worked or what didn't right after getting off stage. That’s a good time to recall which parts of the talk felt like they could use some work, but it’s not such a good time to actually make any edits. I'll go back to those notes a few days later (having some space here is really helpful) and make adjustments as needed. Also, if I come across other relevant examples or research at any point in time, I'll try to add them into the talk for the next time around.

You Do You

If there’s one thing I’ve learned working on talks and talking to other speakers about their process, it’s that no two people work the same way. Everyone has their own way of putting together talks that they’ve customized for their own habits and preferences. If your talk development process looks nothing like mine, that’s totally fine. And if you haven’t found a process that works for you yet, keep experimenting with different techniques. You’ll find one that works for you!

For more on how to get a talk together, check out these other articles too:

My Talk Writing Process is a post from CSS-Tricks

Shipping system fonts to GitHub.com

Css Tricks - Fri, 02/16/2018 - 9:46am

System font stacks got hot about a year ago, no doubt influenced by Mark Otto's work putting them live on GitHub.

The why, to me, feels like (1) yay performance and (2) the site looks like the rest of the operating system. But to Mark:

Helvetica was created in 1957 when the personal computer was a pipe dream. Arial was created in 1982 and is available on 95% of computers across the web. Millions, if not billions, of web pages currently use this severely dated font stack to serve much younger content to much younger browsers and devices.

As display quality improves, so too must our use of those displays. System fonts like Apple’s San Francisco and Microsoft’s Segoe aim to do just that, taking advantage of retina screens, dynamic kerning, additional font-weights, and improved readability. If operating systems can take advantage of these changes, so too can our CSS.

I also like the team’s idea of adding emoji fonts at the end of the font declaration so that you have the best support possible for those too:

p { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; }

Direct Link to ArticlePermalink

Shipping system fonts to GitHub.com is a post from CSS-Tricks

CSS Basics: Fallback Font Stacks for More Robust Web Typography

Css Tricks - Fri, 02/16/2018 - 5:05am

In CSS, you might see a ruleset like this:

html { font-family: Lato, "Lucida Grande", Tahoma, Sans-Serif; }

What the heck, right? Why don't I just tell it what font I want to use and that's that? The whole idea here is fallbacks. The browser will try to use the font you specified first (Lato, in this case), but if it doesn't have that font available, it will keep going down that list. So to be really verbose here, what that rule is saying is:

  1. I'd like to use the Lato font here, please.
  2. If you don't have that, try "Lucida Grande" next.
  3. If you don't have that, try Tahoma.
  4. All else fails, use whatever you've got for the generic keyword Sans-Serif

So in what situation would a browser not have the font you're asking for? That's pretty common. There are only a handful of fonts that are considered "web safe"—meaning that it's likely most computers visiting your site have that font installed and so the browser can use it. Think: Arial, Times New Roman, Courier, Georgia, Verdana, and a handful of others.

But most websites, these days, use custom web fonts. They load up a font as a resource (just as a website loads CSS itself as a resource, or an image, or JavaScript), then that font is available to use. The widely popular Google Fonts makes that pretty clear:

Load this font first, then you can use it in CSS.

Even when you load a font in this way, it's still possible that the font doesn't load. While Google is a generally very reliable host, you don't control their servers; they do. Even more commonly, poor network connections may prevent a font from loading. In any font loading failure scenario, that's another situation where a fallback font stack comes in handy.

Say I'm using the custom font Merriweather, and I set up my font stack like this:

html { font-family: Merriweather, Impact, Serif; }

If Merriweather fails to load (or does load, but loads in such a way that it pops into place after it does—also known as FOUT), we'd see something like this:

A fallback font, in this case Impact, is seen. It's incredibly awkward and doesn't match the desired look at all.

Better to have your font fall back to something close to your top choice than to something totally unrelated! There is a fantastic tool by Monica Dinculescu call Font style matcher where you can play with fallbacks (that's how I made that GIF above).

In the example above, we can see that Georgia is a much nicer fallback font than Impact is! The example is a little bit more fancy than just changing the font though. A couple of other settings were changed to make them match as closely as they are. To take advantage of that, you're in font loading territory, which gets a bit complex. Your best bet there is consulting Zach Leatherman's A Comprehensive Guide to Font Loading. In any case, picking a nice fallback font alone is worth doing.

Individual Characters

An interesting note about fallback fonts is that it's not all-or-nothing. Individual characters in a font can fall down the stack if the specified font doesn't have that character available.

As an extreme example, I'll load the custom font Source Code Pro from Google Fonts but I'll force it to only contain a handful of letters.

You can see in the first sentence how the fallback fonts took over and the end result wasn't disastrous (like the second sentence) even though the custom font didn't have some of the characters available. This will be more likely to happen with things like uncommon ASCII characters or even accented characters like ü, ?, or ñ.

As some side fun, here's using that character fallback ability of CSS to do something unique:

See the Pen Ransom Note With Google Font Subsets by Heydon (@heydon) on CodePen.

More Reading

CSS Basics: Fallback Font Stacks for More Robust Web Typography is a post from CSS-Tricks

Your Sketch library is not a design system redux

Css Tricks - Thu, 02/15/2018 - 3:31pm

I really like this post by Brad Frost about what is and isn’t a design system, particularly when he de-emphasizes the importance of tools when it comes to that sort of work :

...components living inside static design tools like Sketch isn’t itself a design system. Pardon my clickbait. Perhaps a better title would have been “Your Sketch library is not a(n entire) design system.”

No doubt tools like Sketch are super valuable, and having a set of reusable components inside them helps design teams establish thoughtful and consistent UIs. However, a Sketch library is just one piece of the design system puzzle. A design system also can include other puzzle pieces like:

  • Design principles
  • UX guidelines
  • Development guidelines
  • Coded UI components
  • Component guidelines, usage, and details
  • Page templates
  • User flows
  • Design tools
  • Dev tooling
  • Code repositories
  • Voice and tone guidelines
  • Implementation guides
  • Contribution processes
  • Team structure
  • Resources (internal and external)
  • Other guidelines/resources/tools/process

I’ve been mulling this post over the past couple of days and I’ve started to think of design systems as much more than a suite of tools. In fact, I’m starting to think that folks who work on design systems should start to de-emphasize how important specific tools are and focus much more on the community-building aspects of the work instead.

Direct Link to ArticlePermalink

Your Sketch library is not a design system redux is a post from CSS-Tricks

?Wix.com: Make the Web Your Playground

Css Tricks - Thu, 02/15/2018 - 7:34am

(This is a sponsored post.)

Here's something you should consider having: your own professional website. The only thing you'll need to get started is your imagination, a little free time, and an innovative website builder.

Wix is the world's most technologically advanced website builder. Sign up for Wix, choose a template, and start customizing it. Whether you’re a novice, a business owner, a sophisticated designer, or a professional website builder, you’ll have full control of your website - from design prototyping to production.

Wix takes care of all the heavy lifting. You get reliable, safe, secure hosting that you'll never need to worry about. You get a custom domain name and email. To get started, all you need is a computer and a little time.

Don't underestimate what you can do with Wix. There are all kinds of advanced design features and functionality if that's something you need. The web is your playground. We’ve come along way from the website building platforms of the 90s. Now, you can create any kind of website you want and even collaborate with friends or coworkers.

Save yourself some time and head over to Wix.com to get started.

Direct Link to ArticlePermalink

?Wix.com: Make the Web Your Playground is a post from CSS-Tricks

CSS Basics: Styling Links Like a Boss

Css Tricks - Thu, 02/15/2018 - 4:45am

The web was founded on links. The idea that we can click/tap a link and navigate from one web page to another is how surfin' the web become a household phrase.

Links in HTML even look different from regular text without any CSS styling at all.

See the Pen Default Link by CSS-Tricks (@css-tricks) on CodePen.

They are blue (purple if visited). They are underlined. That's a link in it's purest form.

But what if we want to change things up a bit? Perhaps blue doesn't work with your website's design. Maybe you have an aversion to underlines. Whatever the reason, CSS lets us style links just we can any other element. All we need to do is target the <a> element in our stylesheet.

Want to use a different font, change the color, remove the underline and make it all uppercase? Sure, why not?

a { color: red; text-decoration: none; text-transform: uppercase; }

See the Pen Link With Some Style by Geoff Graham (@geoffgraham) on CodePen.

Now we're cooking with gas! But why stop there? Let's look at a few other ways we can style links to complete the experience.

Style Each Link State

Links have different states, meaning they adapt when we interact with them on a webpage. There are three additional states of a link that are worth considering anytime we change the default style of links:

  • Hover (:hover): When the mouse cursor is place on top of the link without a click
  • Visited (:visited): The appearance of a link that the user has clicked on the page before when the mouse cursor is not on top of it
  • Active (:active): When the link is in the process of being clicked. It might be super quick, but this is when the mouse button has been depressed and before the click is over.

Here is the same link we have been looking at. First, try hovering your mouse on top of it without clicking and notice that it becomes underlined. Then, click on the link, but leave your mouse button clicked down for a little bit to see how the active style changes the color of the link to black. Finally, let up on the mouse button and the link should turn purple before it's technically been visited.

See the Pen Link With Styled States by Geoff Graham (@geoffgraham) on CodePen.

Links seem like a simple concept, but boy do they have a lot going on—and CSS gives us some incredible power to customize the experience!

Links as Buttons

While there is some debate about it, we can use CSS to make a text link look like a button.

Like other HTML elements, CSS can add background colors and padding to links that allow us to create the appearance of a button. Here's our link using those techniques:

a { background-color: red; color: white; padding: 1em 1.5em; text-decoration: none; text-transform: uppercase; }

See the Pen Link as a Button by CSS-Tricks (@css-tricks) on CodePen.

Great! Now, let's use the state-altering powers we learned in the last section to make our faux-button more interactive. We'll make the button dark gray on hover, black on active, and light gray on visit:

a { background-color: red; color: white; padding: 1em 1.5em; text-decoration: none; text-transform: uppercase; } a:hover { background-color: #555; } a:active { background-color: black; } a:visited { background-color: #ccc; }

See the Pen Link as a Button With Styled States by Geoff Graham (@geoffgraham) on CodePen.

Styling a link as a button and taking advantage of the states allows us to make some pretty cool effects. For example, let's create a button with some depth that appears to get pressed when it's active and pop back up when the click is done.

See the Pen Link as a 3D Button by Geoff Graham (@geoffgraham) on CodePen.

Oh, and Cursors!

We've gone into pretty great depth on style links, but there is one more component to them that we cannot ignore: the cursor.

The cursor indicates the position of the mouse on the screen. We're pretty used to the standard black arrow:

The standard mouse cursor arrow

We can change the arrow to a hand pointer on it's hover (:hover) state so that it's easier to see that the link indicates it is an interactive element:

Using cursor:
pointer; provides an interactive cue. a:hover { cursor: pointer; }

See the Pen Link as a 3D Button With Pointer by Geoff Graham (@geoffgraham) on CodePen.

Whew, that's much nicer! Now, we have a pretty fancy link that looks like a button with proper interactive cues.

Leveling Up

We've covered quite a bit of ground here, but it merely scratches the surface of how we can control the style of links. If you're ready to level up, then here are a few resources you can jump into from here:

  • Mailto Links - A good reference for linking up email addresses instead of webpages.
  • The Current State of Telephone Links - Did you know you can link a phone number? Well, here's how.
  • Cursor - The CSS-Tricks reference guide for customizing the cursor.
  • When to Use the Button Element - If you're wondering about the difference between a link button and a traditional form button, then this is a good overview with suggestions for which is better for specific contexts.
  • Button Maker - A free resource for generating the CSS for link buttons.

CSS Basics: Styling Links Like a Boss is a post from CSS-Tricks

CSS Basics: Using Multiple Backgrounds

Css Tricks - Wed, 02/14/2018 - 10:53am

With CSS, you can control the background of elements. You can set a background-color to fill it with a solid color, a background-image to fill it with (you guessed it) an image, or even both:

body { background-color: red; background-image: url(pattern.png); }

Here's an example where I'm using an SVG image file as the background, embedded right in the CSS as a data URL.

See the Pen background color and image together by Chris Coyier (@chriscoyier) on CodePen.

That's just a single image there, repeated, but we can actually set multiple background images if we want. We do that by separating the values with commas.

body { background-image: url(image-one.jpg), url(image-two.jpg); }

If we leave it like that, image-one.jpg will repeat and entirely cover image-two.jpg. But we can control them individually as well, with other background properties.

body { background-image: url(image-one.jpg), url(image-two.jpg); background-position: top right, /* this positions the first image */ bottom left; /* this positions the second image */ background-repeat: no-repeat; /* this applies to both images */ }

See how background-position also has comma-separated values? Those will apply individually to each image respectively. And then how background-repeat has only one value? We could have done two values in the same way, but by using just one value, it applies to both.

Here's an example using four separate images, one in each corner, offset by a smidge:

See the Pen Example of multiple backgrounds by Chris Coyier (@chriscoyier) on CodePen.

It's too bad you can't rotate or flip background images or else we could have used just one. We can rotate and flip entire elements (or psuedo elements) though, so in cases like that, we can get away with using a single image!

See the Pen Flipping Image So You Can Use Just One by Chris Coyier (@chriscoyier) on CodePen.

Just a few other things to be aware of here:

  1. The stacking order of multiple background is "first is on top."
  2. Gradients are applied through background-image, so they can be used as part of all this. For example, you could set a transparent gradient over a raster image.

See the Pen Tinted Image w/ Multiple Backgrounds by Chris Coyier (@chriscoyier) on CodePen.

CSS Basics: Using Multiple Backgrounds is a post from CSS-Tricks

CSS Basics: The Second “S” in CSS

Css Tricks - Wed, 02/14/2018 - 4:14am

CSS is an abbreviation for Cascading Style Sheets.

While most of the discussion about CSS on the web (or even here on CSS-Tricks) is centered around writing styles and how the cascade affects them, what we don't talk a whole lot about is the sheet part of the language. So let's give that lonely second "S" a little bit of the spotlight and understand what we mean when we say CSS is a style sheet.

The Sheet Contains the Styles

The cascade describes how styles interact with one another. The styles make up the actual code. Then there's the sheet that contains that code. Like a sheet of paper that we write on, the "sheet" of CSS is the digital file where styles are coded.

If we were to illustrate this, the relationship between the three sort of forms a cascade:

The sheet holds the styles.

There can be multiple sheets all continuing multiple styles all associated with one HTML document. The combination of those and the processes of figuring out what styles take precedence to style what elements is called the cascade (That first "C" in CSS).

The Sheet is a Digital File

The sheet is such a special thing that it's been given its own file extension: .css. You have the power to create these files on your own. Creating a CSS file can be done in any text editor. They are literally text files. Not "rich text" documents or Word documents, but plain ol' text.

If you're on Mac, then you can fire up TextEdit to start writing CSS. Just make sure it's in "Plain Text" mode.

If you're on Windows, the default Notepad app is the equivalent. Heck, you can type styles in just about any plain text editor to write CSS, even if that's not what it says it was designed to do.

Whatever tool you use, the key is to save your document as a .css file. This can usually be done by simply add that to your file name when saving. Here's how that looks in TextEdit:

Seriously, the choice of which text editor to use for writing CSS is totally up to you. There are many, many to choose from, but here are a few popular ones:

You might reach for one of those because they'll do handy things for you like syntax highlight the code (colorize different parts to help it be easier to understand what is what).

Hey look I made some files completely from scratch with my text editor:

Those files are 100% valid in any web browser, new or old. We've quite literally just made a website.

The Sheet is Linked Up to the HTML

We do need to connect the HTML and CSS though. As in make sure the styles we wrote in our sheet get loaded onto the web page.

A webpage without CSS is pretty barebones:

See the Pen Style-less Webpage by Geoff Graham (@geoffgraham) on CodePen.

Once we link up the CSS file, voila!

See the Pen Webpage With Styles by Geoff Graham (@geoffgraham) on CodePen.

How did that happen? if you look at the top of any webpage, there's going to be a <head> tag that contains information about the HTML document:

<!DOCTYPE html> <html> <head> <!-- a bunch of other stuff --> </head> <body> <!-- the page content --> </body> </html>

Even though the code inside the <head> might look odd, there is typically one line (or more, if we're using multiple stylesheets) that references the sheet. It looks something like this:

<head> <link rel="stylesheet" type="text/css" href="styles.css" /> </head>

This line tells the web browser as it reads this HTML file:

  1. I'd like to link up a style sheet
  2. Here's where it is located

You can name the sheet whatever you want:

  • styles.css
  • global.css
  • seriously-whatever-you-want.css

The important thing is to give the correct location of the CSS file, whether that's on your web server, a CDN or some other server altogether.

Here are a few examples:

<head> <!-- CSS on my server in the top level directory --> <link rel="stylesheet" type="text/css" href="styles.css"> <!-- CSS on my server in another directory --> <link rel="stylesheet" type="text/css" href="/css/styles.css"> <!-- CSS on another server --> <link rel="stylesheet" type="text/css" href="https://some-other-site/path/to/styles.css"> </head> The Sheet is Not Required for HTML

You saw the example of a barebones web page above. No web page is required to use a stylesheet.

Also, we can technically write CSS directly in the HTML using the HTML style attribute. This is called inline styling and it goes a little something like this if you imagine you're looking at the code of an HTML file:

<h1 style="font-size: 24px; line-height: 36px; color: #333333">A Headline</h1> <p style="font-size: 16px; line-height: 24px; color: #000000;">Some paragraph content.</p> <!-- and so on -->

While that's possible, there are three serious strikes against writing styles this way:

  1. If you decide to use a stylesheet later, it is extremely difficult to override inline styles with the styles in the HTML. Inline styles take priority over styles in a sheet.
  2. Maintaining all of those styles is tough if you need to make a "quick" change and it makes the HTML hard to read.
  3. There's something weird about saying we're writing CSS inline when there really is no cascade or sheet. All we're really writing are styles.

There is a second way to write CSS in the HTML and that's directly in the <head> in a <style> block:

<head> <style> h1 { color: #333; font-size: 24px; line-height: 36px; } p { color: #000; font-size: 16px; line-height: 24px; } </style> </head>

That does indeed make the HTML easier to read, already making it better than inline styling. Still, it's hard to manage all styles this way because it has to be managed on each and every webpage of a site, meaning one "quick" change might have to be done several times, depending on how many pages we're dealing with.

An external sheet that can be called once in the <head> is usually your best bet.

The Sheet is Important

I hope that you're starting to see the importance of the sheet by this point. It's a core part of writing CSS. Without it, styles would be difficult to manage, HTML would get cluttered, and the cascade would be nonexistent in at least one case.

The sheet is the core component of CSS. Sure, it often appears to play second fiddle to the first "S" but perhaps that's because we all have an quiet understanding of its importance.

Leveling Up

Now that you're equipped with information about stylesheets, here are more resources you jump into to get a deeper understanding for how CSS behaves:

CSS Basics: The Second “S” in CSS is a post from CSS-Tricks

Observable

Css Tricks - Tue, 02/13/2018 - 10:05am

Observable launched a couple of weeks ago. As far as I understand, it’s sort of like a mix between CodePen and Medium where you create "notebooks" for exploring data, making nifty visualizations.

Check out this collection of visualizations using map integrations as an example. The entries are not only nice demos of the libraries or technology being used (i.e. D3, Google Maps, Leaflet, etc.), but also make for some interesting infographics in themselves.

In a note about this interesting new format, founder Mike Bostock describes a notebook as “an interactive, editable document defined by code. It’s a computer program, but one that’s designed to be easier to read and write by humans.”

All of this stuff riffs on a lot of Mike’s previous work which is definitely worth exploring further if you’re a fan of complex visualizations on the web.

Direct Link to ArticlePermalink

Observable is a post from CSS-Tricks

CSS Grid Layout Module Level 2

Css Tricks - Tue, 02/13/2018 - 10:05am

The second iteration of CSS Grid is already in the works and the public editor's draft was released last week! While it is by no means the final W3C recommendation, this draft is the start of discussions around big concepts many of us have been wanting to see since the first level was released, including subgrids:

In some cases it might be necessary for the contents of multiple grid items to align to each other. A grid container that is itself a grid item can defer the definition of its rows and columns to its parent grid container, making it a subgrid. In this case, the grid items of the subgrid participate in sizing the grid of the parent grid container, allowing the contents of both grids to align.

The currently defined characters of subgrid items are particularly interesting because they illustrate the differences between a subgrid and its parent grid. For example:

The subgrid is always stretched in both dimensions in its subgridded dimension(s): the align-self/justify-self properties on it are ignored, as are any specified width/height constraints.

In addition to subgrids, aspect-ratio-controlled gutters and conformance are also defined in the draft and worth a read. It's great to see so much momentum around grids!

Direct Link to ArticlePermalink

CSS Grid Layout Module Level 2 is a post from CSS-Tricks

CSS Basics: Using Fallback Colors

Css Tricks - Tue, 02/13/2018 - 4:25am

Something you very much want to avoid in web design is unreadable text. That can happen when the background color of an element is too close or exactly the color of the text. For instance:

.header { background-color: white; color: white; }

Which could lead to text that's there, but invisible.

This is ... very bad.

You'd never do that on purpose of course! The trouble is it can sneak up on you. For one thing, the default background-color is transparent, so without setting any background the background of an element is probably white.

More commonly, you're using a background-image that makes the background a different color, and you're setting white text on top of that.

header { background-image: url(plants.jpg); color: white; }

Under perfect circumstances, this is all good:

But let's take a look at what it looks like while the website is loading over a very common "Slow 3G" internet connection:

There's no reason our dear visitor needs to wait to discover the incredible savings awaiting them this Sunday! Fortunately, a tiny bit of CSS solves this.

header { background-color: black; background-image: url(plants.jpg); color: white; }

The black background color will ensure the white text will be visible while the image loads (or if it never loads at all!). Getting slightly fancier, we could use a color used in the image. I like a little app called Frank DeLoupe for helping me pluck a color from anywhere on my screen. Then I'll use that color as the fallback color using the shorthand syntax for backgrounds:

header { background: #334C23 url(plants.jpg); color: white; }

Much much better.

This kind of thing takes very little effort, improves your design's resiliency and UX, and I think you'll find becomes are part of your CSS muscle memory the more you write CSS.

Another related topic here, since we're working with a photograph, is the idea of a "Progressive JPG." Photoshop has the ability to save a JPG in this format. This changes how the displays as it's coming across the network. Here's a comparison video:

A low-res version of the image loads into place first, and it becomes higher quality as more of the image loads.

Perhaps a more desirable loading experience, but not a replacement for a fallback color.

Leveling up!

Images are one of the heaviest parts of websites, and loading techniques for them are a big topic in web performance. Here are some more related to things to think about:

CSS Basics: Using Fallback Colors is a post from CSS-Tricks

Linkbait 36

QuirksBlog - Tue, 02/13/2018 - 12:32am

Facebook-bashing edition. (I’m merely quoting other people’s bashing, mind you.)

  • An overview of browser testing services because you deserve to test on IE9 and older Chromes.
  • Ada built a game in a week using tools currently available on the web. She wrote a report, and introduces many new tools in the process.
  • Bad if true: W3C uses browser detects.

    Are you aware that since Edge enabled Upgrade-Insecure-Request on our internal builds, we cannot reach any spec because we get redirected from https to http, which we upgrade to https, and loop? If we masquerade our user agent to Chrome's one all works fine.

  • Something that interests me a lot lately: Teaching CSS Grid to newcomers. Well, not specifically Grid in my case, but this article has some excellent ideas and notions about why techies find CSS so complicated, and how to explain it to them.

    Water, for explaining the cascading, global nature of CSS versus the modular, encapsulated nature of most traditional programming languages. Like, traditional programming paradigms treat functions discretely, like stones you can pick up, but CSS is like water, which flows and cannot be controlled, only shaped.

    And the author, Hui Jing Chen, is coming to speak at CSS Day, which is also kind of cool because I can quiz her in person.
  • High drama in time-honoured American fashion about Facebook having a terrible two years. Facebook once was Shiny and Golden; now it’s Hideous and Dark. The truth lies somewhere in the middle, but this article ignores that for obvious clickbait reasons.
    Much more important is the fact that Facebook-bashing has now reached serious momentum. I think that’s healthy. See also the next few items.
  • A study of fake news sites in France and Italy. It turns out the problem is somewhat less serious than was assumed; the fake news sites themselves see only very modest numbers of visitors (the most popular reached 3.5% of the online population). The real problem lies with Facebook, where some fake news items generate more interactions that real news items.
    Facebook is the problem (and Twitter, too, I suppose, but to a lesser degree). That’s something I already assumed, but it’s very good to have it confirmed by research.
    So what are we going to do about it? Block Facebook? It’s too early for that, but the option must be on some internal lists higher up in the EU. If Facebook refuses to take action, we should.
  • An anti-capitalist look at tech’s trust problem.

    But tech appears to have no net positive uses whatsoever. Can it?

    This is somewhat disingenious: we have become accustomed to tech benefits, and the problem is more that its rate of benefit production has fallen while we’ve become more aware of its drawbacks. Still, close off the Internet and you’ll have a much worse popular revolt on your hands.
    Don’t get me wrong — I think the tech giants being taken down a notch is a good thing, but as technologists we have to be careful to define what tech we need to ditch: ads and their tracking mechanisms, the artificial stupidity that selects your Facebook/Google news — as well as, on the non-tech side, the inability to pay for services such as Facebook and Twitter.

    Tech’s challenge was never to remake capitalism all over again?—?only harder, crueller, meaner, even more harmful. It was to shift beyond it.

    I don’t buy this — at least, not entirely. Big tech and the neoliberal movement were born simultaneously in the early nineties, and early tech served as a shining example of neoliberalism while gladly accepting the money. I don’t think tech was ever meant to shift beyond capitalism — the only example I can think of is everything on the web being free of charge, and that was the worst mistake tech ever made, causing, among other things, ad tracking and fake news spread by Facebook’s artificial stupidity.
    Still, food for thought.
  • Remember Facebook Instant Articles that was going to revolutionise news content online? It turns out that more than half of the original 2015 partners have meanwhile abandoned it — and these are not the smallest names in newspaper publishing, either. Apparently it doesn’t work. Also, Facebooks’s announce algorithm change I mentioned in 34 is not going to help here.
  • Unilever is threatening to pull its ads from Facebook and Google (Guardian; NRC) because those companies do not remove posts that “create division in society and promote anger and hate.”
    Unilever is in fact not the first food/personal care multinational to do so: big competitor Procter & Gamble did the same about a year ago. Also in that last article: the tech giants have a trust problem right now, while trust in traditional journalism is increasing.
  • How the EU is exporting its data and privacy regulations to the rest of the world. It’s the EU that’s setting the standard here; not the US, which is more meh about regulations and privacy, especially under the current administration.
    Having sane leaders is a major competitive advantage right now.
    On the other hand, the EU regulations are more-or-less forced onto some countries, who could do with a little less neocolonial paternalism. On the gripping hand, the most important quoted example of such countries, South Africa, is not one that has a great trust in its own government, with Zuma about to resign. So maybe an enforced bit of regulation would be good for it nonetheless?
    Conundrums, conundrums.
  • According to Google, 1% of publishers will be affected by the upcoming selective Chrome ad blocker. To be honest I didn’t know Google was working on this, and I think it’s a good idea — especially in order to force internet advertisers to adapt or die.
  • An older game, but a rather good one, on the evolution of trust. Makes you play the game in order to understand trust/distrust strategies.
  • How to build a horse with various programming languages. JavaScript: the backbone came out angular, so the horse is paralyzed. Perfect summary.
  • Your users are irrational. Interesting read about how people can trick our fast intuitive brain into doing things without thinking, or, even more interesting, how to get our fast intuitive brain to start up our slow logical brain. And how all that applies to designing websites or apps.
  • Something that interests me as a conference organiser: Name badges, the unsung conference heroes. We did some thinking about name badges years ago (see the summary), but this article contains several interesting new ideas, notably adding interests to the badge in order to facilitate conversations.
  • Have a tip for the next Linkbait? Or a comment on this one? Let me know (or here or here).

Web Animation Workshops Dates for 2018 Announced

Css Tricks - Mon, 02/12/2018 - 7:38am

"I'm getting a raise!"

This was my favorite quote from last year's Web Animation Workshops, as Val and I covered performance, tooling, and creating animations for SVG, CSS, JS and React.

Now we're gearing up for another round of Web Animation Workshops in 2018! But we're only offering two workshops this time since both of us have moved away from full-time consulting.

The aim of these workshops is to level up your animation skills in just two days and equip you with a full understanding of animation concepts without having to rely on copying and pasting code from other people in your web applications.

These are the dates and locations:

  • Chicago: March 19 - 20
  • Brighton, UK: July 9 - 10

We're already out of early bird tickets for Chicago and space is limited, so grab yours quickly before they sell out.

We'll see you there!

Direct Link to ArticlePermalink

Web Animation Workshops Dates for 2018 Announced is a post from CSS-Tricks

CSS Basics: The Syntax That Matters & The Syntax That Doesn’t

Css Tricks - Mon, 02/12/2018 - 4:28am

When you're starting to play around with CSS at the very beginning, like any other language, you have to get used to the syntax. Like any syntax, there are a bunch of little things you need to know. Some characters and the placement of them is very important and required for the CSS to work correctly. And some characters are more about clean looking code and generally followed standards but don't matter for the CSS to work.

First, so we have the terminology down:

A CSS ruleset consists of a selector and delcaration(s) wrapped in curly braces. Important: Braces

All CSS rulesets must have opening and closing curly braces:

braces.header { padding: 20px;}.header padding: 20px;}.header { padding: 20px;}.header padding: 20px;

If you miss the opening brace, CSS will keep reading as if the next bit of text is still part of the selector. Then it's likely to find a character like : which are invalid as part of a selector and break. Breaking likely means it will screw up itself and the next ruleset, and recover after that.

Missing a closing brace is a bit worse in that it's likely to mess up the rest of the entire CSS file unless it somehow finds a double closing brace and can resolve that first missing one.

Overall point: braces are very important!

Preprocessing languages like Sass and Less offer a syntax feature called nesting. This can be convenient, but note that when these preprocessors run and produce CSS, that nesting is removed because CSS by itself doesn't support that. If you copy nested CSS into regular CSS, you'll have problems with the braces.

Sometimes Important: Spaces

There are just a few places that spaces are important in CSS. One of the most imortant is in selectors. One space in a selector means you're selecting descendants of the previous part of the selector. The selector body p means "select p elements that are descendants of the body element". That space means a lot. Hopefully it's clearly different than bodyp which won't select anything (there is no <bodyp> element). But it's not different from body p. Multiple spaces mean the same as one space.

spacesbody ul libodyulli.header .title.header .title.header .title.header.title??=

You can't put spaces in properties, function names, or anywhere you name things. Adding spaces in those situations effectively changes the names, breaking them.

spaces-3background-image: url(tiger.jpg);background - image: url(tiger.jpg);background-image: url (tiger.jpg);@keyframes goRoundAndRound { }@keyframes go-round-and-round { }@keyframes go round and round { }:root { --theme main: red; --theme-second: red;}body { background: var(--theme main); background: var(--theme-second);}

Other than that, spacing doesn't matter much in CSS.

spaces_1.header { padding: 20px;}.header { padding:20px; } .header {padding: 20px; }.header{padding: 20px; }.header{ padding: 20px;}.header{padding:20px;}

I'd encourage you to be consistent with your spacing, and produce clean and readable CSS. You might want to reference some CSS style guides out there for some formatting best practices.

Even the !important rule in CSS, which comes after a the value in a delcaration like body { background: white !important; } doesn't have any spacing requirements. It could have any amount of space before it, or none.

The removing of space in CSS is actually a best practice for performance, so you might notice that when peeking at the raw CSS of websites in production.

You're better off leaving that minification of CSS to a tool that processes your CSS for you, leaving the original alone. We'll have to cover the options for that in other post.

Mostly Important: Semicolons

Each declaration in a ruleset (a property and value pair) ends in a semicolon. That semicolon is required, otherwise CSS will keep reading the next property as if it's part of the value of the previous declaration.

semicolons.header { padding: 20px; max-width: 600px; background: black; color: white}.header { padding: 20px; max-width: 600px background: black; color: white;}

You can leave off the semicolon on the last declaration in a ruleset. I'd warn that doing so manually will cause more trouble than it's worth, and best left to minification tools.

Important: Avoiding Stray Characters

This is important in any language. Every character in code matters, so random other characters will almost certainly break things.

extra-chars.header { padding: 20px;}.header { { padding: 20px;}.header { padding: ~20px;}.header { /padding: 20px;}

Not Important: Line Breaks

A line break is treated like any other white space in CSS, so feel free to use them as needed, as long as it doesn't break any other spacing rule like we talked about above.

line-breaks.bar { background-image: url(texture.png), url(tiger.jpg); }.button::after { content: ">";} .header { box-shadow: 0 0 5px rgba(0, 0, 0, 0.5), 20px 2px 5px -5px rgba(0, 0, 0, 0.5);}

All in all, CSS syntax isn't so hard. Good luck!

CSS Basics: The Syntax That Matters & The Syntax That Doesn’t is a post from CSS-Tricks

Syndicate content
©2003 - Present Akamai Design & Development.