I'm looking for a way to achieve what twitter does in their messenger regarding the border-radius
. To make it simpler to explain I'll first add some photos:
Image with border-bottom-left-radius
set:
Image without border-bottom-left-radius
:
Any idea on how twitter dynamically sets the border-radius
(in this case border-bottom-left-radius
) based on the width of the text message attached to it?
.image {
border-radius: 1.25rem 1.25rem 0 1.25rem;
display: block;
margin-left: auto;
width: 70%;
}
.text {
border-radius: 0 0 0 1.25rem;
float: right;
background-color: rgb(230, 236, 240);
height: 40px;
max-width: 70%;
padding-top: 5px;
}
.divider {
display:block;
margin-top: 80px;
}
<img class="image" src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Miscanti_Lagoon_near_San_Pedro_de_Atacama_Chile_Luca_Galuzzi_2006.jpg/512px-Miscanti_Lagoon_near_San_Pedro_de_Atacama_Chile_Luca_Galuzzi_2006.jpg" />
<div class="text">
<span>This is the text</span>
</div>
<div class="divider"></div>
<img class="image" src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Miscanti_Lagoon_near_San_Pedro_de_Atacama_Chile_Luca_Galuzzi_2006.jpg/512px-Miscanti_Lagoon_near_San_Pedro_de_Atacama_Chile_Luca_Galuzzi_2006.jpg" />
<div class="text">
<span>This is just a relatively longer text for the sake of demonstrating this example!!</span>
</div>