I want to display this dark magenta colored box to the far right and also I want that dark magenta colored box to shrink and grow in small/big devices.
Output
body {
background-color: rgb(79, 211, 79);
}
.cols{
display: flex;
flex-basis: auto;
flex: 1;
flex-grow: 2em;
gap: 2em;
flex-shrink: 1;
justify-content: flex-start;
}
.far-right{
margin-left: auto;
flex-grow: 1em;
flex-shrink: 1em;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="index.css">
<script src="index.js"></script>
</head>
<body>
<div class="bg">
<div class="cols">
<div style="background-color: crimson; width: 150px; height: 150px;"></div>
<div style="background-color: rgb(31, 27, 221); width: 150px; height: 150px;"></div>
<div id="far-right">
<div style="background-color: rgb(146, 3, 148); width: 150px; height: 150px;"></div>
</div>
</div>
</div>
</body>
</html>