How To Make An Input Appear Rounded in HTML?
Last Updated :
25 Oct, 2024
To make an input field appear rounded in HTML, you can use the CSS border-radius property. The border-radius property allows you to round the corners of an input box, and you can adjust the value to make the corners more or less rounded.
Using border-radius
The simplest way to create a rounded input field is to apply the border-radius CSS property to an <input> element. The higher the value, the more rounded the corners will be.
Syntax
input {
border-radius: 15px;
}
Where border-radius can accept values in different formats like pixels (px), percentages (%), or other units. For a fully circular input, you typically apply a high border radius, such as 50%.
Example
HTML
<head>
<style>
input {
border-radius: 15px;
padding: 10px;
border: 2px solid #ccc;
width: 250px;
}
</style>
</head>
<body>
<h2 style="color: green;">GeeksforGeeks</h2>
<input type="text" placeholder="Enter text">
</body>
Output
Make An Input Appear Rounded in HTMLIn this example, setting border-radius: 15px makes the input field's corners rounded. You can increase the value for a more circular appearance or decrease it for slightly rounded corners.
Alternative Approaches to Make an Input Rounded
If you want a perfectly circular input, especially for buttons or image inputs, set the border-radius to 50%. This approach works best when the input has equal width and height.
Example
HTML
<style>
.circular-input {
width: 50px;
height: 50px;
/* Makes the input circular */
border-radius: 50%;
border: 1px solid #ccc;
text-align: center;
}
</style>
<input type="text" class="circular-input" placeholder="A">
In this case, border-radius: 50% turns the square input into a circle, provided the width and height are equal.
Using Different Values for Each Corner
You can apply different border-radius values to each corner for custom shapes.
Example
HTML
<style>
.custom-rounded {
width: 200px;
padding: 10px;
/* Different radius for each corner */
border-radius: 20px 5px 30px 10px;
border: 1px solid #ccc;
}
</style>
<input type="text" class="custom-rounded"
placeholder="Custom rounded input">
This example uses four values to specify different rounding for each corner: top-left, top-right, bottom-right, and bottom-left.
Which Approach is Better in Different Cases?
- Standard Rounded Input (border-radius: 15px): Use this for most form elements where you want a subtle rounded effect.
- Circular Input (border-radius: 50%): Best for creating circular buttons, profile picture inputs, or custom-shaped elements.
- Custom Corner Rounding: Ideal when designing more creative input styles with unique shapes.
Similar Reads
HTML Tutorial HTML stands for HyperText Markup Language. It is the standard language used to create and structure content on the web. It tells the web browser how to display text, links, images, and other forms of multimedia on a webpage. HTML sets up the basic structure of a website, and then CSS and JavaScript
11 min read
HTML Interview Questions and Answers HTML (HyperText Markup Language) is the foundational language for creating web pages and web applications. Whether you're a fresher or an experienced professional, preparing for an HTML interview requires a solid understanding of both basic and advanced concepts. Below is a curated list of 50+ HTML
14 min read
HTML Introduction HTML stands for Hyper Text Markup Language, which is the core language used to structure content on the web. It organizes text, images, links, and media using tags and elements that browsers can interpret. As of 2025, over 95% of websites rely on HTML alongside CSS and JavaScript, making it a fundam
6 min read
HTML Tags - A to Z List HTML Tags are fundamental elements used to structure and format content on web pages. They provide instructions to web browsers on how to render text, images, links, and other media.HTML tags are enclosed in angle brackets < > and usually come in pairs: an opening tag and a closing tag. The cl
15+ min read
30+ Web Development Projects with Source Code [2025] Web development is one of the most in-demand career paths in the IT industry, experiencing consistent growth of around 20â25% annually. Whether you're a student starting out or an experienced professional looking to switch or advance your career, it's essential to go beyond theory and demonstrate yo
4 min read
Frontend Developer Interview Questions and Answers Frontend development is an important part of web applications, and it is used to build dynamic and user-friendly web applications with an interactive user interface (UI). Many companies are hiring skilled Frontend developers with expertise in HTML, CSS, JavaScript, and modern frameworks and librarie
15+ min read
HTML DOCTYPE Declaration HTML DOCTYPE (Document Type Declaration) is an instruction that appears at the beginning of an HTML document, before the <html> tag.Its primary role is to tell the web browser which version of HTML the page is written in, ensuring that the browser renders the content correctly. It is not an HT
4 min read
HTML Forms HTML forms, defined using the <form> Tags are essential for collecting user input on web pages. They incorporate a variety of interactive controls such as text fields, numeric inputs, email fields, password fields, checkboxes, radio buttons, and submit buttons. Over 85% of websites rely on for
5 min read
HTML Tables HTML (HyperText Markup Language) is the standard markup language used to create and structure web pages. It defines the layout of a webpage using elements and tags, allowing for the display of text, images, links, and multimedia content. As the foundation of nearly all websites, HTML is used in over
10 min read
HTML Basics HTML (HyperText Markup Language) is the standard markup language used to create and structure web pages. It defines the layout of a webpage using elements and tags, allowing for the display of text, images, links, and multimedia content. As the foundation of nearly all websites, HTML is used in over
7 min read