Style Input Fields of a form with CSS


To style the input field of a form, you can try to run the following code. Style the <input>:

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         input {
            width: 100%;
         }
      </style>
   </head>
   <body>
      <p>Fill the below form,</p>
      <form>
         <label for = "subject">Subject</label>
         <input type = "text" id = "subject" name = "sub">
         <label for = "student">Student</label>
         <input type = "text" id = "student" name = "stu">
      </form>
   </body>
</html>

Updated on: 23-Jun-2020

245 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements