Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> CSS

Thiết lập viền cho input form với CSS

Để đặt viền cho input form, hãy sử dụng thuộc tính CSS border.

Ví dụ

Bạn có thể chạy mã sau để thêm viền:

<!DOCTYPE html>
<html>
  <head>
    <style>
      input[type="text"] {
        width: 100%;
        padding: 10px 15px;
        margin: 5px 0;
        box-sizing: border-box;
        border: 3px inset orange;
      }
    </style>
  </head>
  <body>
    <p>Điền form bên dưới,</p>
    <form>
      <label for="subject">Môn học</label>
      <input type="text" id="subject" name="sub">
      <label for="student">Học sinh</label>
      <input type="text" id="student" name="stu">
    </form>
  </body>
</html>