I am having an issue aligning an element with flexbox. I know how to align elements in center, right or left. But what I'd like to do is to align an element only 30% away from the right border. How can we control the exact distance between the element and the edge of the container with flexbox? Something like the offset with bootstrap?
I have seen tricks where all elements are aligned to the be flex start and the last element to have margin-left: auto.. but that only aligns it to the far right.
I tried to set margin-right: 30% but on mobile devices it causes issues with other elements aligned to the left.
.container {
display: flex;
height: 50px;
}
.aligned {
margin-left: auto;
margin-right: 30%;
}
<div class="container">
<div class="aligned">
<button>Click me</button>
</div>
</div>