Ich m?chte mehrere Klassen für Hyperlink-Stile erstellen.
Ich m?chte eine Standardklasse und eine spezielle Klasse für das Navigationsmenü.
Das ist mein CSS-Code:
a { color: white; text-decoration: none; } .menu-items a { color: black; text-decoration: none; }
Ich habe versucht, die Klasse ?menu-items“ in HTML aufzurufen, aber sie verwendet weiterhin den oben gezeigten Standardstil a{}.
Dies ist der HTML-Code:
<div class="container-outside"> <div class="container-inside"> <ul class="ul-list"> <li> <a class="menu-items" href="temperature.html">Temperature</a></li> <li>|</li> <li>Weight</li> <li>|</li> <li>Currency</li> </ul> </div> </div>
Ich habe erfolglos versucht, die Standardklasse zu entfernen und zwei spezielle Klassen zu erstellen. Ein bisschen überfordert hier.
可以直接把類名.menu-items
CSS a { color: white; text-decoration: none; } .menu-items { color: black; text-decoration: none; }
- Temperature
- |
- Weight
- |
- Currency
您的選擇器不正確,因?yàn)?menu-items
不是 a
s 父級。您應(yīng)該像這樣選擇標(biāo)簽:
a.menu-items { color: black; text-decoration: none;}