Advertisement
arnabkumar

html_tips

Nov 1st, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. HTML tricks and tips
  2. 1.If you don`t give any content inside div, it will not show.
  3.  
  4. 2.If you don`t give any content inside div and give div width,height and background it will show.
  5.  
  6. 3.another note that if you don`t give any content inside div but give box-shadow and padding or background and padding it will show.
  7.  
  8. 3.if u want to equal three column amd more column div then u have to use -
  9.  
  10. main div -20 or something and single column div 20px or something then use width. ex-
  11.  
  12. <style type="text/css">
  13. body{background:#2293da;color:#ffffff;}
  14. .column{width:960px;margin:0 auto;}
  15. .test_div{margin-left:-30px;}
  16. .box{margin-left:30px;float:left;}
  17. .box_one{width:300px;height:300px;background:red;}
  18. .box_two{width:300px;height:300px;background:#328e2d;}
  19. .box_three{width:300px;height:300px;background:#8e2d84;}
  20.  
  21. </style>
  22. </head>
  23.  
  24.  
  25.  
  26.  
  27. <body>
  28. <div class="column">
  29. <div class="test_div">
  30. <div class="box box_one">PqNNN</div>
  31. <div class="box box_two"></div>
  32. <div class="box box_three"></div>
  33. </div>
  34. </div>
  35. </body>
  36.  
  37.  
  38. 4.z-index css only work over position:relative; and position:absolute; . even one div z-index 1 and another div z-index 0 1 will show top.
  39.  
  40.  
  41. 5.using position absolute to center a div -
  42.  
  43. background: #2acdd7;
  44. width: 300px;
  45. height: 300px;
  46. position: absolute;
  47. left: 50%;
  48. top: 50%;
  49. margin-left: -150px;
  50.  
  51. importtant thing - left:50%;margin-left: -150px; (this -150px come from width 300/2 = 150 )
  52.  
  53.  
  54. 6.content centerd
  55.  
  56. parebt div - display:table
  57. height:200px
  58.  
  59. child div - display:table-cell
  60. vertical-align: middle;
  61.  
  62.  
  63.  
  64. 7. responaive background image -background-size:100% auto;
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77. 8.center incon inside div -
  78.  
  79.  
  80. <div class="exp">
  81. <i class="fa fa-camera-retro fa-3x"></i>
  82. </div>
  83.  
  84. <style type="text/css">
  85. width:80px;
  86. height:80px; //here widht height and line-height =
  87. background-color:red;
  88. border-radius:100%;
  89. line-height:80px;
  90. text-align:center;
  91.  
  92.  
  93. .fa-camera-retro { line-height: inherit;}
  94. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement