Set outline style as a groove with CSS

To set the outline style as a groove, use the outline-style property with the value groove. Under groove, the outline looks as though it is carved into the page.

Syntax

selector {
    outline-style: groove;
}

Example

The following example demonstrates how to apply a groove outline style to a paragraph −

<!DOCTYPE html>
<html>
<head>
<style>
    .groove-outline {
        outline-width: 3px;
        outline-style: groove;
        outline-color: #666;
        padding: 15px;
        margin: 20px;
        font-size: 18px;
    }
</style>
</head>
<body>
    <p class="groove-outline">
        This text has a 3px groove outline that appears carved into the page.
    </p>
</body>
</html>
A paragraph with text appears on the page, surrounded by a carved-in groove outline effect that creates a 3D appearance as if the text is recessed into the surface.

Conclusion

The outline-style: groove property creates a distinctive 3D carved effect around elements. Combine it with outline-width and outline-color for better visual control.

Updated on: 2026-03-15T11:21:05+05:30

283 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements