Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1326

Making all buttons the same width when buttons are stacked for mobile and when buttons are nested two levels under parent

$
0
0

Using Flexbox, how can I configure the buttons so that they're all the same width when flex-direction: column is applied for mobile? It would typically be simple, however, the buttons are two levels beneath the parent and I can't change the HTML markup. Here's a demo with the HTML and CSS below:

.multi-cta-group {  border: 1px solid gray;  display: flex;  align-items: center;  flex-direction: column;  justify-content: center;  gap: 16px;  margin: 20px;  padding: 20px;}.multi-cta-container {  border: 1px solid red;  flex: 1;}.multi-cta-container a {  border: 1px solid lime;  flex: 1;}
<div class="multi-cta-group"><div class="multi-cta-container"><a href="#" class="btn btn-primary">CTA label for video</a></div><div class="multi-cta-container"><a href="#" class="btn btn-primary">Shop</a></div><div class="multi-cta-container"><a href="#" class="btn btn-primary">Learn more</a></div><div class="multi-cta-container"><a href="#" class="btn btn-primary">Subscribe now</a></div></div>

Viewing all articles
Browse latest Browse all 1326

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>