I have one container and I have float:left inside it’s child div. Problem is as soon as I apply float:left on child div my parent div’s background is completely lost.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="background: #CCC; width:100%; position:relative;">
<div style="float:left;">
This is some text
</div>
</div>
</body>
</html>
Can anybody tell me how do I fix this?
floatelements do not haveheightunless you clear them below or give explicitheightTry this,
OR
OR use this hack of setting
overflowof element.