How to create Underline Input Text Field using CSS ? Last Updated : 07 Feb, 2024 Comments Improve Suggest changes Like Article Like Report Input Text Field can be underlined by implementing different approaches to applying a bottom border to an input text field, using various methods such as HTML and CSS. Styling input text fields is a crucial aspect of web development, and adding a bottom border is a common way to enhance the visual appeal of these elements. Table of Content Using CSS border-bottom PropertyUsing CSS border-bottom Property with Pseudo-elementsUnderstanding the text-decoration PropertyUsing CSS border-bottom PropertyThe simplest way to add a bottom-border to an input text field is by using CSS. You can achieve this effect with the border-bottom property. Example: HTML <!DOCTYPE html> <html lang="en"> <head> <title> How to Apply Bottom Border to Input Text Field? </title> <style> body { text-align: center; } input { border: none; border-bottom: 5px solid green; } </style> </head> <body> <form> <label for="password"> Password: </label> <input type="password" id="password" name="password" required> <button type="submit">Submit</button> </form> </body> </html> Output: Using CSS border-bottom Property with Pseudo-elementsYou can use pseudo-elements to target specific parts of an element and style them accordingly. Here, we'll use the ::after pseudo-element to create a bottom border. Example: HTML <!DOCTYPE html> <html lang="en"> <head> <title> How to Apply Bottom Border to Input Text Field? </title> <style> body { text-align: center; } input:hover { border: none; border-bottom: 5px solid green; } </style> </head> <body> <form> <label for="password"> Password: </label> <input type="password" id="password" name="password" required> <button type="submit">Submit</button> </form> </body> </html> Output: Understanding the text-decoration PropertyThe text-decoration property in CSS is used to set or remove decorations from text. In this case, we'll use it to create an underline for an input text field. HTML <!DOCTYPE html> <html lang="en"> <head> <title>Underlined Input Field</title> <style> body { text-align: center; } input#password { border: none; outline: none; padding: 5px; font-size: 16px; border-bottom: 5px solid green; } </style> </head> <body> <form> <label for="password"> Password: </label> <input type="password" id="password" name="password" required> <button type="submit">Submit</button> </form> </body> </html> Output: Comment More infoAdvertise with us Next Article How to create Underline Input Text Field using CSS ? V vkash8574 Follow Improve Article Tags : Web Technologies CSS Geeks Premier League CSS-Questions Geeks Premier League 2023 +1 More Similar Reads How to Underline Text using CSS? To underline a text using CSS, the CSS text-decoration property is used with the value set to underline.Using text-decorationWe use the text-decoration CSS property to underline a text using CSS. The text that is to be underlined is inserted in a <p> tag and the property is applied.Syntaxtext- 1 min read How to Set the Gap Between Text and Underlining using CSS? The gap between text and underlining is the space you can create between the text and underline, making it text easier to read and look better. Using text-underline-offset PropertyTo set the gap between text and its underline in CSS, use the text-underline-offset property. This property defines the 1 min read How to remove underline for anchors tag using CSS? The anchor tag (<a>) is used to define hyperlinks in HTML, Removing the underline from the anchor (<a>) tags in CSS involves setting the text-decoration property to none. This can be done by targeting the anchor elements with a CSS rule like a { text-decoration: none; }, which removes th 2 min read How to add underline to canvas-type text using Fabric.js ? Enhancing text presentation on web canvases using Fabric.js involves various techniques, such as adding underlines for improved visual clarity and emphasis. These methods enable developers to customize text elements effectively, contributing to enhanced user experience and design flexibility in web 2 min read How to remove underline from a:before using CSS ? The a:before is used to create an element before the content of the anchor tag and it displays underlined a:before part by default. To remove the underline from a:before using the text-decoration property of CSS and set element display to inline-block. Syntax: text-decoration:none; display:inline-bl 2 min read How to change the underline color in CSS? In this article, we are going to learn how to change the underline color in CSS, To change the underline color in CSS, use the text-decoration-color property. Set it to the desired color value. Styling is implemented in HTML text to make it catchy and attractive. The text can be made italic, underli 1 min read How to underline all words of a text using jQuery? To underline all words of a text using jQuery, you can wrap each word in a <span> tag and apply the CSS text-decoration property. This approach allows for individual styling of each word within a text element. ApproachCreate a basic structure for the web page. The CSS rule p span text-decorati 2 min read Create OTP Input Field using HTML CSS and JavaScript We will build an OTP (One-Time Password) input box, which is commonly used on many websites. This interactive and engaging UI element allows users to enter their OTP conveniently and efficiently. We will walk through the step-by-step process of creating this functionality using HTML, CSS, and JavaSc 3 min read How to Select Text Input Fields using CSS Selector ? Selecting text input fields using CSS selectors means targeting <input> elements of type text in a form. This allows you to apply specific styles (e.g., font, color, borders) to those fields. This is typically done using the [type="text"] CSS attribute selector.Here we have some CSS selector t 4 min read How to create linear gradient text using HTML and CSS ? The linear-gradient is used to create eye-catching text effects, particularly suitable for dark-themed websites or applications. This method involves filling text with linear-gradient color codes, making it look attractive and bold. Linear-gradient text effects are ideal for dark themes and provide 2 min read Like