Search

Nalezeno "css-tricks": 2942

When a Line Doesn’t Break


We expect a line to break when the text on that line reaches the parent box boundaries. We see this every time we create a paragraph, just like this one. When the parent box doesn’t have enough room for the next word in a line, it breaks it and moves down to the next line and repeats that...

How-to guide for creating edge-to-edge color bars that work with a grid


Hard-stop gradients are one of my favorite CSS tricks. Here, Marcel Moreau combines that idea with CSS grid to solve an issue that’s otherwise a pain in the butt. Say you have like a 300px right sidebar on a desktop layout with a unique background color. Easy enough. But then say you want...

A Complete Guide to Dark Mode on the Web


“Dark mode” is defined as a color scheme that uses light-colored text and other UI elements on a dark-colored background. Dark mode, dark theme, black mode, night mode… they all refer to and mean the same thing: a mostly-dark interface rather than a mostly-light interface. The post A Complete...

New in Chrome: CSS Overview


Here’s a fancy new experimental feature in Chrome! Now, we can get an overview of the CSS used on a site, from how many colors there are to the number of unused declarations… even down to the total number of defined media queries. Again, this is an experimental feature. Not only does that...

Global and Component Style Settings with CSS Variables


The title of this Sara Soueidan article speaks to me. I’m a big fan of the idea that some CSS is best applied globally, and some CSS is best applied scoped to a component. I’m less interested in how that is done and more interested in just seeing that conceptual approach used in some...

Responsive Styling Using Attribute Selectors


One of the challenges we face when implementing class-based atomic styling is that it often depends on a specific breakpoint for context. <div class="span-12"</div<!-- we want this for small screens  --<div class="span-6"</div<!-- we want this for medium screens --<div...

Five 5-minute Videos from Ethan on Design & Accessibility


Ethan: I’ve been working with Aquent Gymnasium to produce a series of five short tutorial videos, which have been launching over the course of this past week. Since the last video just went live, I’m thrilled to share the whole list with you: • Introduction to using VoiceOver on macOS•...

When Sass and New CSS Features Collide


Recently, CSS has added a lot of new cool features such as custom properties and new functions. While these things can make our lives a lot easier, they can also end up interacting with preprocessors, like Sass, in funny ways. So this is going to be a post about the issues I’ve encountered...

Styling Layout Wrappers In CSS


Two things that strike me often about the web are how many ways there are to go about the same thing and how many considerations go into even the most seemingly simple things. Working with wrapper elements is definitely on both those lists. Wrappers (or containers or whatever) are so common...

Book: The Greatest CSS Tricks Vol. I


Ya know, for a site called “CSS-Tricks” that I’ve run for well over a decade, it’s a little funny we’ve never done a book under that name. I’ve written a book about WordPress and SVG, but never CSS! Well, allow me to change that. I’ve been working on...

Quick Tips for High Contrast Mode


Sarah Higley has some CSS tricks up her sleeve for dealing with High Contrast Mode on Windows, which I learned is referred to as WHCM. Here’s the first trick: […] if the default CSS outline property doesn’t give you the visual effect you want [in WHCM] for focus states...

The Return of the 90s Web


One of my forever-lessons here on CSS-Tricks is that having your own website and blogging on it is a good idea. It’s probably one of the best decisions I’ve ever made, as it’s been a direct source of fun, career development and, eventually, income. I always chuckle at little...

In Defense of a Fussy Website


The other day, I was doom-scrolling Twitter and saw a delightful article titled “The Case for Fussy Breakfasts.” I love food — especially breakfast — and since the pandemic hit I’ve been using my breaks in between meetings (or, shh, sometimes in meetings) to make a full bacon, poached...

Line-Animated Hamburger Menu


This kind of SVG + CSS animation trickery is catnip to me. Mikael Ainalem shares how to draw a hamburger icon (the “three lines” thing you’re well familiar with), but then animate it in a way that is surprising and fun by controlling the SVG properties in CSS. CodePen Embed...

Grid for layout, flexbox for components


When should we reach for CSS grid and when should we use flexbox? Rachel Andrew wrote about this very conundrum way back in 2016: Flexbox is essentially for laying out items in a single dimension – in a row OR a column. Grid is for layout of items in two dimensions – rows AND columns. Ahmad...

The Mad Magazine Fold-In Effect in CSS


This was always my favorite thing in Mad magazine. One page (the inside of the back cover, I think) was covered in a zany illustration. You folded that page in thirds, covering up the middle-third of that image, and a new image would form because the illustration was designed to perfectly line...

Some Typography Links


I just can’t stop opening excellent typography-related articles, which means I need to subject you to blog posts that round them up so I can clean up my open tabs. Vistaserve is “a grass-roots web hosting initiative hailing from Thornbury, Australia. Inspired by the quirky web of...

The Analytics That Matter


I’ve long been skeptical of quoting global browser usage percentages to justify their usage of browser features. It doesn’t matter what global usage of a browser is, other than nerdy cocktail party fodder. The usage that matters is what users on your site are using, and that can...

How to Disable Code: The Developer’s Production Kill Switch


The following is a guest post written by Carlos Schults. Being able to disable code in production is a power that many developers aren’t aware of. And that’s a shame. The ability to switch off some portions—or even complete features—of the codebase can dramatically improve the software development...

Hide Scrollbars During an Animation


CSS still can’t animate to auto dimensions. .dropdown { transition: 0.2s; height: 0; } .dropdown.open { /* the height will change, but it won't animate. */ height: auto; } There is JavaScript trickery you can try. Brandon Smith outlined several techniques here a little while back....

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