Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2015
682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. HTML Style
  2. border (all)
  3. :2px solid black;
  4.  
  5. background (div, button, canvas, img)
  6. :green;
  7. :url('http://www.w3schools.com/images/colorpicker.gif');
  8.  
  9. ##############################
  10.  
  11. <parent>
  12. <child>
  13. <child2></child2>
  14. <child2></child2>
  15. </child>
  16. <child></child>
  17. </parent>
  18.  
  19. size (div, button, canvas, img)
  20. width:100px; :auto; :100%;
  21. height:100px; :auto; :100%;
  22.  
  23. auto:
  24. div => 100%
  25. rest => matches content
  26.  
  27. div matches content => display:inline-block;
  28.  
  29. ###############################################
  30.  
  31. <div style="">
  32. <a style="border:2px solid black;background:green;">Hello</a>
  33. </div>
  34.  
  35. <div style="border:2px solid black;background:green;">
  36. <a style="">Hello</a>
  37. </div>
  38.  
  39. <div style="border:2px solid black;background:green;display:inline-block">
  40. <a style="">Hello</a>
  41. </div>
  42.  
  43.  
  44.  
  45. HTML Style
  46. position (div, button, canvas, img)
  47. top:100px;
  48. left:100px;
  49. position:absolute;
  50. float:left;
  51. margin-left:10px;
  52. margin-top:10px;
  53.  
  54. Position relative to normal position:
  55. margin-left && margin-top
  56.  
  57. Position relative to parent top-left corner:
  58. position:absolute;
  59. top && left
  60. and make sure parent is also position:absolute;
  61.  
  62. Containers next to each other:
  63. float:left; (on both)
  64.  
  65. <div style="border:2px solid black; width:500px; height:500px;margin-left:10px;margin-top:10px;">
  66. <div style="border:2px solid black; width:300px; height:300px;margin-left:100px;margin-top:100px;">
  67. <div style="
  68. border:2px solid green;
  69. width:100px;
  70. height:100px;
  71. "></div>
  72. <div style="
  73. border:3px solid red;
  74. width:100px;
  75. height:100px;
  76. "></div>
  77.  
  78. </div>
  79. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement