Here is the code snippet I am currently working with:
HTML
<div class="container">
<div class="limit">
</div>
<div class="dots">
</div>
</div>
CSS
.container
{
background-color:blue;
width:100%;
height:100px;
position:relative;
}
.limit
{
position:relative;
width:500px;
height:100%;
margin:auto;
background-color:green;
}
.dots
{
background-color:red;
position:absolute;
top:40px;
right:20%;
width:200px;
height:20px;
}
I am facing an issue where I am unable to move the .dots
element within the .limit
(which was auto-generated by a plugin). My goal is to position the red element inside the green element dynamically, at any width of the .container
, using pure CSS. Basically, I want the red element to align perfectly within the green element regardless of the container's width. You can see the desired outcome here.
Is there any way to achieve this? I tried using calc function but couldn't get it to work.