Welcome Guest! To access all forums & features, please register an account or sign-in. → Why register?



parent Div & Child Div?


2 replies to this topic - - - - -

#1 shakthi

    Resident One Post Wonder

  • 1 posts
  • Joined: 19-July 12

Posted 19 July 2012 - 10:44

How can a parent DIV wrap around child DIVs which are floating left or right?


Edited by Charisma, 20 July 2012 - 18:54.



#2 Kami-

    ♫ d(-_-)b ♫

  • 3,624 posts
  • Joined: 28-July 08
  • Location: SandBox

Posted 19 July 2012 - 10:51

Exactly that, just insert your floated divs inside the parent div... don't forget about 'clear' and jobs done.

#3 Dorza

    Neowinian²

  • 108 posts
  • Joined: 20-February 07
  • Location: South Wales - UK

Posted 19 July 2012 - 10:54

Add the following css to your stylesheet

/*CLEAR FIX*
/* For modern browsers */
.clearfix:before,
.clearfix:after {
	content:"";
	display:table;
}
.clearfix:after {
	clear:both;
}
/* For IE 6/7 (trigger hasLayout) */
.clearfix {
	zoom:1;
}

Then add the class "clearfix" to your parent div. Can't remember where I found this so can't give credit but its all over the net in various forms