Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Problem z dziedziczeniem stylu
Forum PHP.pl > Forum > Po stronie przeglądarki > CSS
kiepski96
Mam taki div:

  1. <div id="download">
  2. <h1>DOWNLOAD FILE</h1>
  3. <h4>It's easy!</h4>
  4. </div>


Chcę, aby TYLKO w tym divie znaczniki h1 i h4 miały dany kolor. Próbuję zrobić to tak:

  1. #download h1{
  2. color: #4b4b4b;
  3. }


Ale nawet samego h1 nie koloruje...
Co jest źle ?
proszek
http://codepen.io/anon/pen/DbCvB

Przecież działa?
toffiak
Pokaż cały kod, bo ten który podałeś musi działać.
proszek
Może jakiś inny styl nadpisuje Ci kolor, spróbuj dodać !important.
kiepski96
CSS:

  1. /* TYPOGRAPHY */
  2.  
  3. @font-face {
  4. font-family: 'Lato';
  5. src: url('fonts/Lato-Bold.eot'); /* IE9 Compat Modes */
  6. src: url('fonts/Lato-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  7. url('fonts/Lato-Bold.woff') format('woff'), /* Modern Browsers */
  8. url('fonts/Lato-Bold.ttf') format('truetype');
  9. font-style: normal;
  10. font-weight: bold;
  11. text-rendering: optimizeLegibility;
  12. }
  13.  
  14. @font-face {
  15. font-family: 'Lato';
  16. src: url('fonts/Lato-Regular.eot'); /* IE9 Compat Modes */
  17. src: url('fonts/Lato-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  18. url('fonts/Lato-Regular.woff') format('woff'), /* Modern Browsers */
  19. url('fonts/Lato-Regular.ttf') format('truetype');
  20. font-style: normal;
  21. font-weight: normal;
  22. text-rendering: optimizeLegibility;
  23. }
  24.  
  25. * {
  26. margin: 0px;
  27. padding: 0px;
  28. }
  29.  
  30. h1, h2, h3, h4, h5, h6{
  31. font-family: Lato;
  32. font-weight: normal;
  33. }
  34.  
  35. h1{font-size: 4.5em;} h2{font-size: 4em;} h3{font-size: 3.5em;} h4{ font-size:3em;} h5{ font-size:2em;} h6{ font-size:1em;}
  36.  
  37. body{
  38. font-size: .625em; /* 10px */
  39. margin: 0;
  40. padding: 0;
  41.  
  42. }
  43.  
  44. header{
  45. width: 100% ;
  46. height: 60px;
  47. background-color: #272d35;
  48.  
  49. }
  50.  
  51. .logo{
  52. width: 10%;
  53. min-width: 100px;
  54. height: 60px;
  55. float: left;
  56. background-color: #25a6d9;
  57. }
  58.  
  59. div p{
  60. font-size: 3em;
  61. color: #fff;
  62. text-align: center;
  63. font-family: Lato;
  64. font-weight: bold;
  65. margin-top: 10px;
  66. }
  67.  
  68.  
  69.  
  70. /* MENU STYLE*/
  71.  
  72. #menu{
  73.  
  74. }
  75.  
  76. #menu ul{
  77. list-style: none;
  78. }
  79.  
  80. #menu li{
  81. float: right;
  82. font-size: 1.5em;
  83. color: #fff;
  84. margin-right: 2%;
  85. font-family: Lato;
  86. font-weight: normal;
  87. margin-top: 18px;
  88.  
  89. }
  90.  
  91.  
  92.  
  93. /* DOWNLOAD INSTRUCTION */
  94.  
  95. .line{
  96. width: 100%;
  97. height: 4px;
  98. background-color: #25a6d9;
  99. }
  100.  
  101. #download-instruction h1{
  102. color: #4b4b4b;
  103. text-align: center;
  104. }


A tutaj HTML:

  1. <header>
  2. <div class="logo">
  3. <p>LOGO</p>
  4. </div>
  5. <div id="menu">
  6. <ul>
  7. <li>HOME</li>
  8. <li>GAMES</li>
  9. <li>ONLINE</li>
  10. <li>PC GAMES</li>
  11. <li>HOW TO DOWNLOAD</li>
  12. </ul>
  13. </div>
  14. </header>
  15.  
  16. <div class="fluid_container">
  17. <div class="camera_wrap camera_azure_skin" id="camera_wrap_1">
  18. <div data-thumb="images/slides/thumbs/bridge.jpg" data-src="images/slides/bridge.jpg"></div>
  19. </div>
  20. </div>
  21.  
  22. <div style="clear:both; display:block;"></div>
  23.  
  24. <div class="line"></div>
  25.  
  26. <div id="download-instruction">
  27. <h1>DOWNLOAD</h1>
  28. <h4>It's easy!</h4>
  29. </div>



Dodam, że normalnie w codepen działa, a w chromie nie chce tongue.gif
PrinceOfPersia
nacisnij prawy przycisk (w chrome) najezdzajac na napis DOWNLOAD, i "zbadaj element". Zobacz, czy łapie te style.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.