Quick tips

7 posts
  • Quick tip

    Hide and Debug Empty Elements with CSS

    A tiny tip today, but a good one: use the :empty pseudo-class to hide pesky empty elements (commonly found in user-generated content).

    Read more

  • Quick tip

    Preventing Scroll “Bounce” with CSS

    When you scroll rapidly to the top or bottom of a webpage you might notice a “bounce” effect, where the browser momentarily allows you to scroll beyond the uppermost or lowermost point, before bouncing you to correct position.

    Read more

  • Quick tip

    Handling Null, Undefined and Zero Values in JavaScript

    In JS, it’s easy to get caught out when determining if a variable is null, undefined, or has a value of zero. I do a lot of data visualisation, and quite often I’ll need to filter out null values from an array of data.

    Read more

  • Quick tip

    Testing Colour Accessibility with Dev Tools

    I often use the WebAIM colour contrast checker to check my colours against WCAG (Web Content Accessibility Guidelines) standards while building websites. Recently I noticed a handy feature in Firefox dev tools to make checking for sufficient colour contrast really easy.

    Read more

  • Quick tip

    Quick Tip: Negative Animation Delay

    Here’s a tiny CSS tip for making staggered animations feel waaaay more natural: Negative animation delay. I’ve seen this idea shared by master CSS animators Jhey and Amit on separate occasions, and it’s such a neat little trick that it’s worth recording here!

    Read more

  • Quick tip

    Quick Tip: You Might Not Need Calc()

    Did you know, if you use CSS math functions like min(), max() and clamp() and you’re calculating any one of the arguments, you don’t need calc()? I think it was Ahmad Shadeed who mentioned this on Twitter the other day, but I could be wrong.

    Read more

  • Quick tip

    Quick Tip: Style Pseudo-elements with Javascript Using Custom Properties

    In Javascript we have a few ways of selecting elements, but we can’t directly target pseudo-elements. Something like this, for instance, won’t work, and will return null:

    Read more