Adding rounded corner for the list with divider between two items when list size is not fixed

I want to create a list like in the image attached .I can achieve this if list size is fixed by adding some div with background color. But if list size is not fixed how can I do this.

If anyone can help I will be thankful. I tried too much but didn’t get a way to do this.