Shouldn't the div expand to fit around the buttons? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Shouldn't the div expand to fit around the buttons?

https://code.sololearn.com/WyK7jXgQdVXE/?ref=app How can I make the div fit perfectly around the buttons? Also, shouldn't it already do that?

12th Aug 2018, 7:22 AM
Daniel Cooper
Daniel Cooper - avatar
3 Answers
12th Aug 2018, 7:44 AM
Meet Mehta
Meet Mehta - avatar
+ 1
Divs with no content and no borders take up no space. That's why there's something called a clearfix hack. There are many versions of it. None are perfect (thus "hack") so you should tweak it to suit your specific purposes. Here's one of many places available to get started researching: https://css-tricks.com/tag/clearfix/
12th Aug 2018, 7:37 AM
Janningā­
Janningā­ - avatar
0
Guys. I fixed it. I just removed the centering on the div and the float:left; on the back button. Here's the updated code: https://code.sololearn.com/WyK7jXgQdVXE/#html
12th Aug 2018, 6:29 PM
Daniel Cooper
Daniel Cooper - avatar