Search

Nalezeno "QR code": 1615

Moving from Vanilla JavaScript to a Reusable Vue Component


I recently wrote an article explaining how you can create a countdown timer using HTML, CSS and JavaScript. Now, let’s look at how we can make that a reusable component by porting it into Vue using basic features that the framework provides. Why do this...

Lazy Object Initialization


The Firefox DevTools underlying code, which is written with JavaScript and HTML, is a complex application. Due to the complexity and amount of work going on, the DevTools team has done everything they can to load as little as possible. Furthermore the team has a system of lazily importing...

Listen to your web pages


A clever idea from Tom Hicks combining MutationObserver (which can "observe" changes to elements like when their attributes, text, or children change) and the Web Audio API for creating sounds. Plop this code into the console on a page where you'd like to listen to essentially any DOM change...

Creating a Details Element That Opens But Never Closes


The <details> and <summary> elements in HTML are useful for making content toggles for bits of text. By default, you see the <summary> element with a toggle triangle (▶︎) next to it. Click that to expand the rest of the text inside the <details> element. But...

While You Weren’t Looking, CSS Gradients Got Better


One thing that caught my eye on the list of features for Lea Verou's conic-gradient() polyfill was the last item: Supports double position syntax (two positions for the same color stop, as a shortcut for two consecutive color stops with the same color) Surprisingly, I recently discovered most...

Why JavaScript is Eating HTML


Web development is always changing. One trend in particular has become very popular lately, and it fundamentally goes against the conventional wisdom about how a web page should be made. It is exciting for some but frustrating for others, and the reasons for both are difficult to explain. A...

The Unseen Performance Costs of Modern CSS-in-JS Libraries


This article is full of a bunch of data from Aggelos Arvanitakis. But lemme just focus on his final bit of advice: Investigate whether a zero-runtime CSS-in-JS library can work for your project. Sometimes we tend to prefer writing CSS in JS for the DX (developer experience) it offers, without...

Toward Responsive Elements


Hot news from Brian Kardell, regarding what we've been referring to as "container queries", the most hotly requested feature in CSS: There does seem to be some general agreement on at least one part of what I am going to call instead "Responsive Design for Components" and that is that flipping...

The Hooks of React Router


React Router 5 embraces the power of hooks and has introduced four different hooks to help with routing. You will find this article useful if you are looking for a quick primer on the new patterns of React Router. But before we look at hooks, we will start off with a new route rendering...

Override window.alert


For years the only bit of feedback web developers could get was via alert("{str}") calls. These days we have the web console but, in rare cases, we don’t have a console and alert calls are our only window into a value at a given time. One problem: if an alert sneaks into production code, your...

Helping Browsers Optimize With The CSS Contain Property


There is a growing number of things that we have to do to help the browser achieve for peak performance. Responsive image syntax has several. For example, needing to tell the browser how large the image will be in our layout with the sizes attribute and how big the images are with w descriptors....

Guillermo’s 2019 in Review


Of all the tech-focused year-in-review posts I read, Guillermo Rauch's is my favorite. There is a lot in there, jumping from topics like modern architectures, high-fiving specific apps, and philosophical movements. I'll pick one quote about the rise of "deploy previews": A salient feature is...

Custom Styling Form Inputs With Modern CSS Features


It’s entirely possible to build custom checkboxes, radio buttons, and toggle switches these days, while staying semantic and accessible. We don’t even need a single line of JavaScript or extra HTML elements! It’s actually gotten easier lately than it has been in the past. Let’s take a look. Here’s...

Getting Fancy with position: sticky;


Mike Solomon worked on a fancy scrollytelling post for Esquire and blogged about it. It has GIFs of each step along the way of figuring out not just position: sticky; but also using negative margins, wrapper divs, backgrounds, and even a smidge of JavaScript measuring to get it all right. What...

Native Image Lazy Loading in Chrome Is Way Too Eager


Interesting research from Aaron Peters on <img loading="lazy" ... >: On my 13 inch macbook, with Dock positioned on the left, the viewport height in Chrome is 786 pixels so images with loading="lazy" that are more than 4x the viewport down the page are eagerly fetched by Chrome...

Select an Element with a Non-Empty Attribute


Short answer: [data-foo]:not([data-foo=""] { Longer answer (same conclusion, just an explanation on why we might need this): Say you have an element that you style with a special data-attribute: <div data-highlight="product"</div You want to target that element and do special things when...

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace