Guest User

Untitled

a guest
Aug 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. 2 x 2 div grid using float with min-height
  2. <div class="boxContainer">
  3. <div class="box"></div>
  4. <div class="box"></div>
  5. <div class="box"></div>
  6. <div class="box"></div>
  7. </div>
  8.  
  9. .boxContainer{
  10. width: 800px;
  11. height: auto;
  12. }
  13.  
  14. .box{
  15. float: left;
  16. min-height: 150px;
  17. width: 400px;
  18. }
  19.  
  20. <div class="boxContainer clearfix">
  21. <div class="box"></div>
  22. <div class="box"></div>
  23. <div class="box"></div>
  24. <div class="box"></div>
  25. </div>
  26.  
  27. .boxContainer{
  28. width: 800px;
  29. height: auto;
  30. }
  31.  
  32. .box{
  33. float: left;
  34. min-height: 150px;
  35. width: 400px;
  36. display: block;
  37. }
  38. /* I would put this at the top of the page, and minimise the newlines :) if you want to remove the "." (dot) then use this content: "0A0"; which puts a whitespace, */
  39. .clearfix:after {
  40. content: ".";
  41. display: block;
  42. clear: both;
  43. visibility: hidden;
  44. line-height: 0;
  45. height: 0;
  46. }
  47.  
  48. .clearfix {
  49. display: inline-block;
  50. }
  51.  
  52. html[xmlns] .clearfix {
  53. display: block;
  54. }
  55.  
  56. * html .clearfix {
  57. height: 1%;
  58. }
Add Comment
Please, Sign In to add comment