HubSpot Engineering

Latest posts

Writing lately

Flatten the Web with This Bookmarklet

In this post

In some ways, a flat UI represents less information than one with depth. The ultimate extension of this is this quick bookmarklet which can make many websites "flat" just by adding a bit of CSS (skip down for the source):

Drag This To Your Bookmarks Bar

#Some Examples

#GitHub

Github

#Twitter

Twitter

The bookmarklet works in part by removing background images. Websites need to define a good background color behind their images, if they don't, you might see some unexpected things:

#Pandora

Pandora’s web player flattened by the bookmarklet, with nothing but mustard yellow behind the Norah Jones Radio title.

#Source

JavaScript
var d = document.createElement('div');d.innerHTML = '\    <style>\        *:not(.icon):not(i), *:not(.icon):not(i):after, *:not(.icon):not(i):before {\            box-shadow: none !important;\            text-shadow: none !important;\            background-image: none !important;\        }\        *:not(.icon):not(i) {\            border-color: transparent !important;\        }\    </style>\';document.body.appendChild(d);

Follow @adamfschwartz on Twitter

Newsletter

For Agents

View Markdown

Share

More posts

Moving Mountains: How We Migrated from Enzyme to React Testing Library

How we migrated 76,000 tests from Enzyme to React Testing Library, modernizing our stack and allowing teams to ship changes with more confidence.

A Tech Guide to Web Accessibility: Why It Matters and How to Improve It

Web accessibility is a crucial aspect of building modern websites and applications, which helps ensure that people with disabilities have access to the same information and services as people without disabilities.

Immutability and Its (Potential) Impact on Performance

We recently encountered a performance bug that challenged the use of immutability in our frontend applications.