Articles Tagged
Using the `outline` Property as a Collapsable Border
The outline
property in CSS draws a line around the outside of an element. This is quite similar to the border
property, the main exception being that outline
isn’t a part of the box model. It is often used for …
How to Add a Double Border to SVG Shapes
Let’s say someone asks you to add a double border to some random geometric SVG shapes. For some reason, you can’t use any graphic editor — they need to be generated at runtime — so you have to solve it …
Animating a CSS Gradient Border
This little trick for gradient borders is super useful:
.border-gradient {
border: 5px solid;
border-image-slice: 1;
border-image-source: linear-gradient(to left, #743ad5, #d53a9d);
}
Here’s some basic demos from our article on the subject. Sephanie Eckles was sharing around the idea …
How to Add Text in Borders Using Basic HTML Elements
Some HTML elements come with preset designs, like the inconveniently small squares of <input type="checkbox">
elements, the limited-color bars of <meter>
elements, and the “something about them bothers me” arrows of the <details>
elements. We can style them to match …
More Control Over CSS Borders With background-image
You can make a typical CSS border
dashed or dotted. For example:
.box {
border: 1px dashed black;
border: 3px dotted red;
}
You don’t have all that much control over how big or long the dashes or gaps are. …
Blurred Borders in CSS
Say we want to target an element and just visually blur the border of it. There is no simple, single built-in web platform feature we can reach for. But we can get it done with a little CSS trickery.…
Stacked “Borders”
A little while back, I was in the process of adding focus styles to An Event Apart’s web site. Part of that was applying different focus effects in different areas of the design, like white rings in the header and …
Gradient Borders in CSS
Let’s say you need a gradient border around an element. My mind goes like this:
- There is no simple obvious CSS API for this.
- I’ll just make a wrapper element with a
linear-gradient
background, then an inner element will block