Lesson: Responsive Design with Bootstrap
Create a Block Element Bootstrap Button
button elements with a class of
btn are only as wide as the text that they contain. For example:
This button would only be as wide as the word "Submit".
By making them block elements with the additional class of
btn-block, your button will stretch to fill your page's entire horizontal space and any elements following it will flow onto a "new line" below the block.
<button class="btn btn-block">Submit</button>
This button would take up 100% of the available width.
Note that these buttons still need the
btn-block class to your Bootstrap button.
The content on this page is licensed under Attribution-ShareAlike 4.0 International. Original authors: freeCodeCamp, the content was modified.