Bootstrap Vertical Forms

Bootstrap Vertical Forms organize form elements vertically, stacking them on top of each other. This layout is ideal for forms with fewer fields or when vertical alignment is preferred for a cleaner, more organized appearance. 

Example: In this example we creates a Bootstrap-styled container with a green “w3wiki” heading, followed by a vertical form with input fields for username and password, and buttons for login and registration.

HTML
<!DOCTYPE html>
<html lang="en">

<head>
    <title>Bootstrap Vertical Forms</title>
    <meta charset="utf-8">
    <meta name="viewport" 
          content="width=device-width, 
                   initial-scale=1">
    <link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
    <script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js">
    </script>
    <script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js">
    </script>
</head>

<body>
    <div class="container">
        <h4>Bootstrap Vertical Forms</h4>
        <form action="">
            <div class="form-group">
                <label for="id1">User Name</label>
                <input class="form-control" 
                       type="text" 
                       id="id1" 
                       placeholder="Enter your User Name">
            </div>
            <div class="form-group">
                <label for="id2">Password</label>
                <input class="form-control" 
                       type="password" 
                       id="id2" 
                       placeholder="Enter your password">
            </div>
            <div class="container">
                <button type="button" 
                        class="btn btn-success">
                    Login
                </button>
                <button type="button" 
                        class="btn btn-secondary">
                    Register
                </button>
            </div>
        </form>
    </div>
</body>

</html>

Output:


Bootstrap Vertical Forms Example Output


Bootstrap Forms Alignment Types

Bootstrap Forms are pre-styled HTML forms provided by the Bootstrap framework. They streamline the process of creating aesthetically pleasing and responsive forms by offering a range of ready-to-use components, layouts, and styles, ensuring consistency and efficiency in web development.

Bootstrap Forms Types

Bootstrap provides 3 types of form Alignment layouts, namely:

Table of Content

  • Bootstrap Vertical Forms: 
  • Bootstrap Horizontal Forms:
  • Bootstrap Inline Forms:

We’ll look into each of them separately:

Similar Reads

Bootstrap Vertical Forms:

Bootstrap Vertical Forms organize form elements vertically, stacking them on top of each other. This layout is ideal for forms with fewer fields or when vertical alignment is preferred for a cleaner, more organized appearance....

Bootstrap Horizontal Forms:

Bootstrap Horizontal Forms arrange form elements horizontally, making efficient use of horizontal space. This layout is suitable for forms with shorter input fields, labels, and inline elements, providing a more compact and organized appearance....

Bootstrap Inline Forms:

Bootstrap Inline Forms display form elements horizontally on a single line, enhancing readability and compactness. This layout is ideal for forms with minimal input fields and labels, maintaining a clean and concise design....