how to make this div responsive ?

this is just a tag how can i make it responsive ? is it even possible i mean there should be padding / margin according to text length. how can i do that ? first image is the one i made and second is the design
No description
No description
8 Replies
Chris Bolson
Chris Bolson5mo ago
You can achieve this with flex
peterpumkineaterr
peterpumkineaterrOP5mo ago
i'm using flex let me send codepen
clevermissfox
clevermissfox5mo ago
The flex-grow:1 and width:100%; on both; also you don’t need to declare flex-direction:row as that’s the default when adding display:flex as well as not necessary to declare flex-shrink:1 which is also the default;
peterpumkineaterr
peterpumkineaterrOP5mo ago
I will try that in the morning
snxxwyy
snxxwyy5mo ago
add flex-wrap: wrap; to the container and take off width: 100%; on the children. They will then wrap when the screen can't fit both of them next to eachother.
peterpumkineaterr
peterpumkineaterrOP5mo ago
damn this worked !! thank you so much.
snxxwyy
snxxwyy5mo ago
No worries

Did you find this page helpful?