Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <style>
  5. #text_holder {
  6. background: blue;
  7. width: 500px;
  8. height: 200px;
  9. }
  10. #text_holder2 {
  11. background: blue;
  12. width: 500px;
  13. height: 200px;
  14. color: rgba(255, 255, 0, 1);
  15. }
  16.  
  17. #alpha_30 {
  18. opacity: 0.3;
  19. color: #ff0000;
  20. }
  21. #alpha_100 {
  22. color: #ff0000;
  23. }
  24. </style>
  25. </head>
  26.  
  27. <body>
  28.  
  29.  
  30. <div id="alpha_100">
  31. <div id="text_holder">
  32. <p>Demo text 1</p>
  33. </div>
  34. </div>
  35.  
  36. <div id="alpha_30">
  37. <div id="text_holder">
  38. <p>Demo text 2</p>
  39. </div>
  40. </div>
  41.  
  42. <div id="alpha_30">
  43. <div id="text_holder">
  44. <p>Demo text 3</p>
  45. </div>
  46.  
  47.  
  48. <div id="text_holder2">
  49. <p>Demo text 4</p>
  50.  
  51.  
  52. </div>
  53.  
  54. </div>
  55.  
  56. </body>
  57. </html>
  58.  
  59. #text_holder {
  60. background:rgba(0, 0, 255,1);
  61. width: 500px;
  62. height: 200px;
  63. }
  64. #text_holder2 {
  65. background: rgba(0, 0, 255,1);;
  66. width: 500px;
  67. height: 200px;
  68. color: rgba(255, 255, 0, 1);
  69. }
  70.  
  71. #alpha_30 > div {/* select child */
  72. /*opacity: 0.3;*/
  73. background:rgba(0, 0, 255,0.3);/* give opacity to bg color only */
  74. color: #ff0000;
  75. }
  76. #alpha_100 {
  77. color: #ff0000;
  78. }
  79.  
  80. <div class="bg-img">
  81. <p class="text_holder"> some text</p>
  82. </div>
  83.  
  84. .bg-img {
  85. background:url(http://lorempixel.com/100/100/abstract);
  86. }
  87. .bg-img .text_holder {
  88. background:rgba(255,255,255,0.3);/* here white cause body as white background */
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement