
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
How to limit input text length using CSS3?
With HTML, you can easily limit input length. However, with CSS3, it will not be possible, since CSS can’t be used to limit the number of input characters. This will cause a functional restriction.
CSS deals with presentation i.e. how your web page will look. This is done with HTML attribute malength, since it’s for behavior.
Let’s see how to do it in HTML −
Example
You can try to run the following code to limit input text length
<!DOCTYPE html> <html> <head> <title>HTML maxlength attribute</title> </head> <body> <form action=""> Student Name<br><input type="text" name="name" maxlength="20"><br><br> <input type="submit" value="Submit"> </form> </body> </html>
- Related Articles
- How to limit text length of EditText in Android?
- How to arrange text in multi-columns using CSS3?
- How to limit the number of characters allowed in form input text field?
- Breaking Overflow Text using CSS3
- Text in Transparent Box using CSS3
- How to get the maximum file name length limit using Python?
- How to limit maximum items on multiple input ()?
- How to limit the length of regression line using ggplot2 in R?
- How to input text in the text box without calling the sendKeys() using Selenium?
- How to create CSS3 Box and Text Shadow Effects?
- How to limit an HTML input box so that it only accepts numeric input?
- How to give a limit to the input field in HTML?
- Handling Text Overflow in CSS3
- How to transform background image using CSS3
- How to Create a Multi-line Text Input (Text Area) In HTML?

Advertisements