Creating an inline form

Let's start by learning how to create an inline form. This is a layout you might want to use in the header of a project or perhaps for a login page. In this case, we're going to align the fields and buttons of the form vertically across the page. For this example, let's create a simple login form with the following code:

<form class="form-inline"> 
  <div class="form-group"> 
    <input type="text" class="form-control" placeholder="Mike Smith"> 
  <div class="form-group"> 
    <input type="email" class="form-control" placeholder=""> 
  <button type="submit" class="btn btn-primary">Login</button> 

There are a few things going on in this form, so let me explain them ...

Get Learning Bootstrap 4 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.