We earn commission when you buy through affiliate links.

This does not influence our reviews or recommendations.Learn more.

For instance, we can have a sign-up/login button surrounded by a double border.

double-border-1

Why double border?

you’ve got the option to use the following ways to create the double border in CSS.

Using border-style Property

Theborder-styleproperty sets the style of the four borders of an element.

border-property

We use the double keyword to set the style in this case.

When we use the double keyword, automatic padding is created between the two borders.

For demonstration purposes, we will set the border width to 15px.

linear-gradient-function

We will also pick our border color to be red and indicate the border style as double.

The result is a gradual transition between two colors along a straight line.

We use the keywordtoto mark the starting point of the gradient line.

outline

If the order is unspecified, the default value isto bottom.

The code below gives our box a 7px border width.

We can then specify the linear gradient on the background property of each side of the box.

Box-Shadow

Using Outline Property

Anoutlineis a line drawn outside the border of an element.

This achieves the double border effect, and we can use an outline and a single border.

We must use outline-offset to add a space between the border and outline properties.

Background-Clip

you’ve got the option to have multiple box-shadow effects separated by commas.

HTML:

Using background-clip Property

Thebackground-clipProperty determines how far the background should extend within an element.

The extension can be on the border-box, padding-box, or content-box.

pseudo-property

You must combine double border property with other CSS properties to get the best out of it.

Its cart button has a double border CSS for visual aesthetics and prompts users to act.

The double borders appear when a user hovers over the cart button.

Amazon-1

The borders are also visible when you hover over Amazons navigation menu.

Mailchimpis an email marketing service that allows users to create, launch and track campaigns.

Its website uses double border effects on various sections.

amazon-double-border

The sign-up and login buttons have double borders to create a sense of urgency as users browse through.

The border on the bottom side of these buttons thickens as a user passes a cursor through them.

The choice of approach will depend on what you want to achieve with the double border and your preferences.

Mailchimp

you could check out these CSS resources to understand Cascading Style Sheets in detail.