I am trying to avoid float (or find an alternative) to move the toolbar div to the right of the page while keeping its size the size of its contents.
So, if I simply added:
float:right;
To the below .toolbar I would have what looks like what I want, which is basically a container that takes up the SIZE of its items (from display:inline-flex) that is aligned to the right of the page.
However, I don't want to float it to the right (It works, but I hear you should avoid it and I am looking for an alternative to float).
I did try using margin-left: auto; but couldn't figure that one out (unless I took off the flex:inline-flex which I need for the parent size.
Any thoughts?
.page {
padding: 20px;
}
.toolbar {
background: lightgray;
border: 1px solid black;
padding: 5px;
display: inline-flex;
flex-direction: row;
justify-content: flex-end;
}
.item {
background: azure;
border: 1px solid black;
padding: 3px;
margin: 3px;
}
.switchbox {
display: inline-block;
}
<div class="page">
<div class="toolbar">
<div class="item switchbox">Switchbox Component</div>
<button class="item button">Submit</button>
</div>
</div>