Tillitsdone
down Scroll to discover

CSS outline-style Customizing Element Outlines

Learn how to use the CSS outline-style property to customize the appearance of an element's outline.

Options include auto, none, dotted, dashed, solid, double, groove, ridge, inset, and outset.
thumbnail

Introduction

The outline-style property in CSS lets you customize the appearance of an element’s outline. Unlike borders, outlines don’t take up space and are drawn outside the element’s border, making them perfect for adding emphasis without affecting layout.

This property offers various styles like dotted, dashed, solid, double, groove, ridge, inset, and outset. These styles help you create visually appealing and user-friendly designs.

Specification

The outline-style property is part of the CSS Basic User Interface Module Level 4 specification. It defines how an element’s outline looks, which is often used to indicate focus or attention.

The specification includes values like auto, none, dotted, dashed, solid, double, groove, ridge, inset, and outset. Each value provides a unique visual effect, helping you create customized and appealing outlines.

Syntax

The outline-style property in CSS defines the style of an element’s outline. Here’s the basic syntax:

outline-style: keyword-value;

Keyword Values

  • auto: The browser chooses a custom outline style.
  • none: No outline is shown.
  • dotted: The outline is a series of dots.
  • dashed: The outline is a series of short dashes.
  • solid: The outline is a single, continuous line.
  • double: The outline has two parallel lines.
  • groove: The outline looks carved into the page.
  • ridge: The outline looks raised from the page.
  • inset: The outline makes the element look embedded.
  • outset: The outline makes the element look raised out of the page.

Global Values

  • inherit: The element inherits the outline-style from its parent.
  • initial: Sets the property to its default value.
  • revert: Resets the property to the browser’s default.
  • revert-layer: Resets the property to the user-agent stylesheet value.
  • unset: Acts as inherit if inherited, otherwise acts as initial.

Example

Here’s how to use the outline-style property in CSS:

.element {
outline-style: dotted;
}

In this example, the element with the class .element will have a dotted outline.

Values

The outline-style property provides various values to customize the appearance of an element’s outline. Here’s a detailed explanation:

  • auto: The browser chooses a custom outline style.
  • none: No outline is shown.
  • dotted: The outline is a series of dots.
  • dashed: The outline is a series of short dashes.
  • solid: The outline is a single, continuous line.
  • double: The outline has two parallel lines.
  • groove: The outline looks carved into the page.
  • ridge: The outline looks raised from the page.
  • inset: The outline makes the element look embedded.
  • outset: The outline makes the element look raised out of the page.
  • initial: Sets the property to its default value.
  • inherit: The element inherits the outline-style from its parent.
  • revert: Resets the property to the browser’s default.
  • revert-layer: Resets the property to the user-agent stylesheet value.
  • unset: Acts as inherit if inherited, otherwise acts as initial.

Examples

Here are some examples to illustrate how the outline-style property works:

Setting Outline Style to Auto

<div class="auto">Outline Demo</div>
.auto {
outline-style: auto;
}
/* To make the Demo clearer */
* {
outline-width: 10px;
padding: 15px;
}

Setting Outline Style to Dotted and Dashed

<div class="dotted">
<p class="dashed">Outline Demo</p>
</div>
.dotted {
outline-style: dotted;
}
.dashed {
outline-style: dashed;
}
/* To make the Demo clearer */
* {
outline-width: 10px;
padding: 15px;
}

Setting Outline Style to Solid and Double

<div class="solid">
<p class="double">Outline Demo</p>
</div>
.solid {
outline-style: solid;
}
.double {
outline-style: double;
}
/* To make the Demo clearer */
* {
outline-width: 10px;
padding: 15px;
}

Setting Outline Style to Groove and Ridge

<div class="groove">
<p class="ridge">Outline Demo</p>
</div>
.groove {
outline-style: groove;
}
.ridge {
outline-style: ridge;
}
/* To make the Demo clearer */
* {
outline-width: 10px;
padding: 15px;
}

Setting Outline Style to Inset and Outset

<div class="inset">
<p class="outset">Outline Demo</p>
</div>
.inset {
outline-style: inset;
}
.outset {
outline-style: outset;
}
/* To make the Demo clearer */
* {
outline-width: 10px;
padding: 15px;
}

Formal Definition

The outline-style property in CSS defines the style of an element’s outline. Here’s the formal definition:

Property Nameoutline-style
Initial Valuenone
Applies ToAll elements
InheritedNo
Computed ValueAs specified
Animation TypeBy computed value type

Formal Syntax

The formal syntax for the outline-style property is:

outline-style = auto | none | dotted | dashed | solid | double | groove | ridge | inset | outset | inherit | initial | revert | revert-layer | unset;

Browser Compatibility

The outline-style property is widely supported across all major web browsers, ensuring consistent and visually appealing designs.

BrowserVersionRelease Date
Google Chrome1.0Dec 2008
Firefox1.5Nov 2005
IE / Edge8.0Mar 2009
Opera7.0Jan 2003
Safari1.2Feb 2004

See Also

To boost your CSS and web development skills, check out these useful resources:

  • [outline]WebsiteUrl: Learn about the shorthand property for setting all outline properties at once.
  • [outline-width]WebsiteUrl: Explore how to set the width of an element’s outline.
  • [outline-color]WebsiteUrl: Discover how to set the color of an element’s outline.
  • [outline-offset]WebsiteUrl: Understand how to set the space between an element’s outline and its edge.
  • [CSS Basic User Interface Module Level 4]WebsiteUrl: Dive into the official specification for more detailed information on the outline-style property.
  • [MDN Web Docs]WebsiteUrl: Access comprehensive guides and tutorials on CSS and web development.
icons/logo-tid.svg Latest Blogs
Discover our top articles, selected to support the growth of your business.
https://imgproxy-landing-page.tillitsdone.com/sig/rs:fit:1200:630/plain/https%3A%2F%2Fcms-r2.tillitsdone.com%2Fwp-content-prod%2Fuploads%2F2025%2F04%2FTill-its-done_SEO_R04_apr_1440x967.jpg@webp Mobile Application คืออะไร สร้างอย่างไร Mobile Application เป็นซอฟต์แวร์ที่สำคัญในชีวิตประจำวัน ซึ่งสำคัญทั้งสำหรับผู้ใช้งานและธุรกิจ โดยมีการพัฒนาหลายประเภท เพื่อรองรับความต้องการที่หลากหลายในปัจจุบัน image_generation/Debug-TailwindCSS-with-DevTools-1732752708935-cdd0a53458db0224ae03d6d0b9599879.png Debug TailwindCSS Issues with Browser DevTools Learn practical techniques for debugging TailwindCSS using browser DevTools. Master the cascade, understand style overrides, and solve common responsive design issues efficiently. image_generation/Jest-Coverage-Reports-Guide-1732733982763-bc09ffcd377b2159e9e17e9d31cc1515.png Using Jest's Coverage Reports for Better Tests Learn how to leverage Jest's coverage reports to write more effective tests, understand coverage metrics, and set meaningful thresholds to maintain high-quality code in your projects. image_generation/TypeScript-Dynamic-Typing-Guide-1732730343665-165af096cc3ac42cdd09fdc9db8939fd.png Dynamic Typing in TypeScript: Tips and Tricks Dive into advanced TypeScript techniques including type inference, assertions, guards, and generic types. Learn how to write more flexible and maintainable TypeScript code with practical examples. image_generation/Flutter-Firebase-Security-Guide-1732785226182-31fd359bc2d1d780b44cb5bb56f8d5e2.png Securing Flutter Apps with Firebase Security Learn how to implement robust security rules in your Flutter applications using Firebase Firestore. Discover best practices, common patterns, and advanced techniques for data protection. image_generation/AstroJS-WordPress-Contact-Forms-1732707848460-eb31a02c72fe24946242670b10dec77d.png Create AstroJS Contact Forms with WordPress Learn how to build a modern contact form by integrating AstroJS with WordPress API. This guide covers setup, implementation, security, and best practices for seamless form handling.
icons/logo-tid.svg

Talk with CEO

Ready to bring your web/app to life or boost your team with expert Thai developers?
Contact us today to discuss your needs, and let’s create tailored solutions to achieve your goals. We’re here to help at every step!
🖐️ Contact us
Let's keep in Touch
Thank you for your interest in Tillitsdone! Whether you have a question about our services, want to discuss a potential project, or simply want to say hello, we're here and ready to assist you.
We'll be right here with you every step of the way.
Contact Information
rick@tillitsdone.com+66824564755
Find All the Ways to Get in Touch with Tillitsdone - We're Just a Click, Call, or Message Away. We'll Be Right Here, Ready to Respond and Start a Conversation About Your Needs.
Address
9 Phahonyothin Rd, Khlong Nueng, Khlong Luang District, Pathum Thani, Bangkok Thailand
Visit Tillitsdone at Our Physical Location - We'd Love to Welcome You to Our Creative Space. We'll Be Right Here, Ready to Show You Around and Discuss Your Ideas in Person.
Social media
Connect with Tillitsdone on Various Social Platforms - Stay Updated and Engage with Our Latest Projects and Insights. We'll Be Right Here, Sharing Our Journey and Ready to Interact with You.
We anticipate your communication and look forward to discussing how we can contribute to your business's success.
We'll be here, prepared to commence this promising collaboration.
Frequently Asked Questions
Explore frequently asked questions about our products and services.
Whether you're curious about features, warranties, or shopping policies, we provide comprehensive answers to assist you.