I have a container with several button style anchor tags (it may have more or fewer buttons):
<div class="menu-container">
<div class="button-container">
<a href="#/Action1" class="button">Action1</a>
<a href="#/Action2" class="button">Action2</a>
<a href="#/Action3" class="button">Action3</a>
<a href="#/Action4" class="button">Action4</a>
<a href="#/Action5" class="button">Action5</a>
</div>
</div>
How do I style this with CSS to have these buttons listed as a grid with a maximum number of 4 columns? I tried with display:inline-blockand float:left, but to no avail.
I know that I need to set the width for the container, but I can’t, but all the anchor tags are inside the container. And this should be dynamic, as there can be more or less buttons ...
What I'm trying to achieve is something like:

source
share