-4

I have used a p tag inside a div tag:

div{background-color:#3B3B3B;}

p{float:left;}

The background-color of div does not appear in the image:

Image

How to solve this?

JAL
  • 39,073
  • 22
  • 153
  • 285

1 Answers1

0

Using float on a child will cause the parent to collapse. There are many alternative solutions, see How do you keep parents of floated elements from collapsing?

Community
  • 1
  • 1