How do I keep two side-by-side div elements the same height?

Flexbox With flexbox it’s a single declaration: .row { display: flex; /* equal height of the children */ } .col { flex: 1; /* additionally, equal width */ padding: 1em; border: solid; } <div class=”row”> <div class=”col”>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</div> <div class=”col”>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad omnis … Read more

Flex / Grid layouts not working on button or fieldset elements

The Problem In some browsers the <button> element doesn’t accept changes to its display value, beyond switching between block and inline-block. This means that a <button> element cannot be a flex or grid container, or a <table>, either. In addition to <button> elements, you may find this constraint applying to <fieldset> and <legend> elements, as … Read more

Bootstrap align navbar items to the right

Bootstrap 5 (update 2021) In Bootstrap 5 (see this question), ml-auto has been replaced with ms-auto to represent start instead of left. Since the Navbar is still based on flexbox, auto margins OR flexbox utility classes are still used to align Navbar content. For example, use me-auto… <nav class=”navbar navbar-expand-lg navbar-light bg-light”> <div class=”container-fluid”> <a … Read more

What are the differences between flex-basis and width?

Consider flex-direction The first thing that comes to mind when reading your question is that flex-basis doesn’t always apply to width. When flex-direction is row, flex-basis controls width. But when flex-direction is column, flex-basis controls height. Key Differences Here are some important differences between flex-basis and width / height: flex-basis applies only to flex items. … Read more