Thẻ textarea được sử dụng khi bạn cần nhập nhiều dòng văn bản. Bạn có thể chạy mã sau để làm việc với textarea trong Form Bootstrap:
Ví dụ
<!DOCTYPE html> <html> <head> <title>Form Bootstrap</title> <meta name = "viewport" content="width = device-width, initial-scale = 1"> <link rel = "stylesheet" href = "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src = "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> </head> <body> <form role = "form"> <div class = "form-group"> <label for = "name">Người chơi</label> <input type = "text" class = "form-control" placeholder = "Tên người chơi"> </div> <div class = "form-group"> <label for = "name">Xếp hạng</label> <input type = "text" class = "form-control" placeholder = "Xếp hạng người chơi"> </div> <div class = "form-group"> <label for = "name">Chi tiết người chơi</label> <textarea class = "form-control" rows = "3" placeholder = "Chi tiết người chơi"></textarea> </div> </form> </body> </html>
Lớp .form-control áp dụng kiểu dáng chuẩn Bootstrap cho textarea, bao gồm chiều rộng 100%, padding, border và hiệu ứng focus.