How to Add a Rounded Border with CSS ? Last Updated : 17 Oct, 2024 Comments Improve Suggest changes Like Article Like Report A rounded border in CSS gives elements smooth, curved corners instead of sharp ones. It enhances design aesthetics and is achieved using the border-radius property. This allows developers to control the curvature, creating visually appealing and modern web layouts easily.Using the border-radius property, you can easily add rounded borders to various HTML elements, enhancing their appearance and creating a more visually appealing layout.Syntaxborder-radius: 1-4 length|% / 1-4 length|%|initial|inheritExample 1: Applying Rounded Borders to a divIn this example, we applies rounded borders to a div using the .RoundedBorder class. It sets a blue background, adjusts border radius to 75px, and centers the text with padding, width, and height. html <!DOCTYPE html> <html> <head> <style> .RoundedBorder { border-radius: 75px 75px; background: blue; padding: 16px; text-align: center; width: 300px; height: 120px; } </style> </head> <body> <h2> Adding Rounded Borders with CSS </h2> <div class="RoundedBorder"> <h4> Rounded corners Borders </h4> </div> </body> </html> Output:rounded border with CSS Example OutputExample 2: Applying Rounded Borders to a buttonIn this example, we will apply rounded borders to a button element. We are setting the height and width to be same and then setting the border-radius to 50% to get the button completely rounded. HTML <!DOCTYPE html> <html> <head> <style> .btn { border-radius: 50%; background: rgb(2, 138, 43); color: #fff; padding: 2px; text-align: center; width: 75px; height: 75px; border: solid 1px transparent; } </style> </head> <body> <h2> Adding rounded border to a button </h2> <button class="btn">Submit</button> </body> </html> Output: rounded border to a button Comment More infoAdvertise with us Next Article How to Add a Rounded Border with CSS ? M manaschhabra2 Follow Improve Article Tags : Web Technologies CSS CSS-Questions Similar Reads How to Set Border Width in CSS? The CSS border-width property is used to set the border of an element. This property allows you to specify the width of the border for all four sides of an element or individually for each side. Here, we will cover all possible approaches with detailed explanations and code examples. Table of Conten 3 min read How to Set Border Opacity with CSS ? Border opacity in CSS controls the transparency of an elementâs border. While there's no direct property for border opacity, you can achieve it by using color functions like rgba() or hsla(), which allow you to specify the opacity of the border color.Syntaxborderborder: 1px solid rgba(255, 0, 0, 0.5 2 min read How to Add an Iframe Border using CSS ? This article will show you how to add a border to the iframe element using CSS. An inline frame is used to embed another document within the current HTML document. To add the iframe border, we will use the CSS border property. Syntax:<!-- CSS border to the iframe --><style> iframe { bord 1 min read How to Create a Rounded Card in Tailwind CSS ? A rounded card is a design used in web development, featuring rounded corners and typically containing content or information within a defined boundary. To create a rounded card in Tailwind CSS, use the rounded utility class along with the bg-white and shadow-md classes for a clean, rounded look. Sy 2 min read How to make rounded corner using CSS ? Creating rounded corners is a popular design technique in web development that enhances the visual appeal of web elements. The CSS border-radius property allows you to easily set the radius of an element's corners, making them rounded. In this article, we will explore how to use the border-radius pr 3 min read Like