Search

Nalezeno "Article": 1993

Can JavaScript Detect the Browser’s Zoom Level?


No, not really. My first guess was that this was intentionally not exposed in browsers because browsers intentionally don’t want us fighting it — or making well-intentioned but bad-outcome decisions based on that info. But I don’t see any evidence of that. StackOverflow answers paint...

Creating Playful Effects With CSS Text Shadows


Let’s have a look at how we can use the CSS text-shadow property to create truly 3D-looking text. You might think of text-shadow as being able to apply blurred, gradient-looking color behind text, and you would be right! But just like box-shadow, you can control how blurred the shadow is, including...

Front-End Challenges


My favorite way to level up as a front-end developer is to do the work. Literally just build websites. If you can do it for money, great, you should. If the websites you make can help yourself or anyone else you care about, then that’s also great. In lieu of that, you can also make things...

Pseudo-Randomly Adding Illustrations with CSS


Between each post of Eric Meyer’s blog there’s this rather lovely illustration that can randomly be one of these five options: Eric made each illustration into a separate background image then switches out that image with the nth-of-type CSS property, like this: .entry:nth-of-type(2n+1)::before...

Better Form Inputs for Better Mobile User Experiences


Here’s one simple, practical way to make apps perform better on mobile devices: always configure HTML input fields with the correct type, inputmode, and autocomplete attributes. While these three attributes are often discussed in isolation, they make the most sense in the context of mobile user...

Thank You, Christopher Schmitt


It’s incredibly sad that Christopher Schmitt passed away last week¹. I keep thinking about how Christopher was one of the best dudes I knew. Just incredibly kind and thoughtful all the way through. I know everyone says that about people after they pass, but I really mean it here. I’m...

Creating Color Themes With Custom Properties, HSL, and a Little calc()


Before the advent of CSS custom properties (we might call them “variables” in this article as that’s the spirit of them), implementing multiple color schemes on the same website usually meant writing separate stylesheets. Definitely not the most maintainable thing in the world. Nowadays, though,...

Jetpack Instant Search!


Jetpack has had a search feature for a while. Flip it on, and it replaces your built-in WordPress search (which is functional, but not particularly good) with an Elasticsearch-powered solution that is faster and has better results. I’ve been using that for quite a while here on CSS-Tricks...

CSS Scrollbar With Progress Meter


Scrollbars are natural progress meters. How far the scrollbar is down or across is how much progress has been made scrolling through that element (often the entire page). But, they are more like progress indicators than meters, if you think of a meter as something that “fills up” as...

Create a Responsive CSS Motion Path? Sure We Can!


There was a discussion recently on the Animation at Work Slack: how could you make a CSS motion path responsive? What techniques would be work? This got me thinking. A CSS motion path allows us to animate elements along custom user-defined paths. Those paths follow the same structure as SVG paths....

How the Vue Composition API Replaces Vue Mixins


Looking to share code between your Vue components? If you’re familiar with Vue 2, you’ve probably used a mixin for this purpose. But the new Composition API, which is available now as a plugin for Vue 2 and an upcoming feature of Vue 3, provides a much better solution. In this article...

Using CSS to Set Text Inside a Circle


You want to set some text inside the shape of a circle with HTML and CSS? That’s crazy talk, right? Not really! Thanks to shape-outside and some pure CSS trickery it is possible to do exactly that.  However, this can be a fiddly layout option. We have to take lots of different things into...

No-Class CSS Frameworks


I linked up Water.css not long ago as an interesting sort of CSS framework. No classes. No <h2 class="is-title">. You just use semantic HTML and get styles. Is that going to “scale” very far? Probably not, but it sure is handy for styling things quickly, where — of course...

Styling in the Shadow DOM With CSS Shadow Parts 


Safari 13.1 just shipped support for CSS Shadow Parts. That means the ::part() selector is now supported in Chrome, Edge, Opera, Safari, and Firefox. We’ll see why it’s useful, but first a recap on shadow DOM encapsulation… The benefits of shadow DOM encapsulation I work at giffgaff where we have...

Thinking in Behaviors, Not Screen Sizes


Chase McCoy wrote a nifty post about the “gap problem” when making a grid of items. His argument might be summarized like this: how should we space elements with margins in CSS? He notes that the gap property isn’t quite ready for prime time when it comes to using it with flexbox, like this: .grid...

Tips for Writing Animation Code Efficiently


I’ve been coding web animations and helping others do the same for years now. However, I have yet to see a concise list of tips focused on how to efficiently build animations, so here you go! I will be using the GreenSock Animation Platform (GSAP). It provides a simple, readable API and solves...

CSS Foldable Display Polyfill


Foldable phones are starting to be a thing. Early days, for sure, but some are already shipping, and they definitely have web browsers on them. Stands to reason that, as web designers, we are going to want to know where that fold is so we can design screens that fit onto the top half and bottom...

Creating Scheduled Push Notifications


Scheduled is the key word there — that’s a fairly new thing! When a push notification is scheduled (i.e. “Take your pill” or “You’ve got a flight in 3 hours”) that means it can be shown to the user even if they’ve gone offline. That’s an improvement from the past where push notification...

How to Re-Create a Nifty Netflix Animation in CSS


The design for Netflix’s browse page has remained pretty similar for a few years now. One mainstay component is the preview slider that allows users to scroll through content and hover on items to see a preview. One unique characteristic of the UI is its hover behavior. When a show preview...

CSS Findings From The New Facebook Design


Ahmad Shadeed digs around the new Facebook’s front-end code. One that stood out to me: .element { inset: 4px 0; /* Which is equivalent to: top: 4px, bottom: 4px, left: 0, right: 0 */ } Whaaat? This is the first I’ve heard of the inset property. Ahmad said he saw it working...

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