Skip to main content
CSS-Tricks
  • Articles
  • Videos
  • Almanac
  • Newsletter
  • Guides
  • DigitalOcean
  • DO Community
Search

Articles Tagged
border

13 Articles
{
,

}
Direct link to the article Using the `outline` Property as a Collapsable Border
border border-collapse outline

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 …

Avatar of Carter Li
Carter Li on Jun 18, 2021
Direct link to the article How to Add a Double Border to SVG Shapes
border shapes SVG

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 …

Avatar of Mariana Beldi
Mariana Beldi on Apr 21, 2021
Direct link to the article Animating a CSS Gradient Border
@property border css animation gradients

Animating a CSS Gradient Border

Direct Link

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 …

Avatar of Chris Coyier
Shared by Chris Coyier on Feb 8, 2021
Direct link to the article How to Add Text in Borders Using Basic HTML Elements
border fieldset forms legend

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 …

Avatar of Preethi
Preethi on Dec 1, 2020
Direct link to the article More Control Over CSS Borders With background-image
background-image border

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. …

Avatar of Chris Coyier
Chris Coyier on Aug 7, 2020
Direct link to the article Blurred Borders in CSS
border filter

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.…

Avatar of Ana Tudor
Ana Tudor on Mar 20, 2019 (Updated on Mar 21, 2019)
Direct link to the article Stacked “Borders”
border border-image

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 …

Avatar of Eric Meyer
Eric Meyer on Mar 19, 2019
Direct link to the article Gradient Borders in CSS
border border-image gradients

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
…
Avatar of Chris Coyier
Chris Coyier on Dec 28, 2018 (Updated on Sep 30, 2022)
Direct link to the article How Do You Put a Border on Three Sides of an Element?
border

How Do You Put a Border on Three Sides of an Element?

I saw a little conversation about this the other day and figured it would be fun to look at all the different ways to do it. None of them are particularly tricky, but perhaps you’ll favor one over another for …

Avatar of Chris Coyier
Chris Coyier on Oct 3, 2018
Direct link to the article Decorating lines of text with box-decoration-break
border box-decoration-break text-decoration

Decorating lines of text with box-decoration-break

An institution’s motto, an artist’s intro, a company’s tagline, a community’s principle, a service’s greeting… all of them have one thing in common: they’re one brief paragraph displayed on a website’s home page — or at least the about page!…

Avatar of Preethi
Preethi on May 8, 2018 (Updated on May 9, 2018)
Direct link to the article Animating Border
animating border animation border

Animating Border

Transitioning border for a hover state. Simple, right? You might be unpleasantly surprised.

The Challenge

The challenge is simple: building a button with an expanding border on hover.

This article will focus on genuine CSS tricks that would be easy …

Avatar of Stephen Shaw
Stephen Shaw on Dec 5, 2017 (Updated on Dec 6, 2017)
  • 1
  • 2
  • Older

CSS-Tricks is powered by DigitalOcean.

Keep up to date on web dev

with our hand-crafted newsletter

DigitalOcean
  • DigitalOcean
  • DigitalOcean Community
  • About DigitalOcean
  • Legal
  • Agency Coaching
  • Free Credit Offer
CSS-Tricks
  • Email
  • Guest Writing
  • Book
  • Advertising
Follow
  • Mastodon
  • Twitter
  • Instagram
  • YouTube
  • CodePen
  • iTunes
  • RSS
Back to Top