I have a situation where I need to align the end of a position absolute element with the end of a relative element, but the relative element's width is not fixed and may vary based on content.
https://i.sstatic.net/L2sLP.jpg
This scenario arises as I am creating a custom dropdown menu. The relative element serves as the label displaying the selected text, while the position absolute element represents the dropdown itself.
<div class="container">
<div class="text">Text from list</div>
<ul class="list">...</ul>
</div>
The image provided illustrates the desired alignment. How can I achieve this using only CSS?