简体   繁体   English

如何在我的 CSS 文件中使用 select 这个 class

[英]How can I select this class within my CSS file

Currently I'm having an issue where i have a navigation bar where i have 2 diversions and a bunch of classes and I'm sturggling to figure out how to correectly write up that class within my CSS file in order to link them.目前我遇到一个问题,我有一个导航栏,其中有 2 个转移和一堆类,我正在努力弄清楚如何在我的 CSS 文件中正确地写出 class 以便链接它们。

This is my HTML.这是我的 HTML。

<img class="logo" src="svg/robert-evans-logo.svg" alt="evans design logo">

  <div class="sidenav">
    <a class="current" href="index.html">Home</a>
    <a href="https://robertevansuni.uk/Journal/">Journal</a>
    <button class="dropdown-btn">Davids Work
      <i class="fa fa-caret-down" aria-hidden="true"></i>
    </button>  
    <div class="dropdown-container">
    <a class="dropdowntext" ref="three-designed-objects-homepage.html">Designed Objects</a>
<!--
    <a href="#">Link 2</a>
    <a href="#">Link 3</a>
-->
</div>

  <button class="dropdown-btn">Priscas Work
    <i class="fa fa-caret-down" aria-hidden="true"></i>
  </button>
  <div class="dropdown-container">
    <a href="Typography-arrangement.html">Typography</a>
    <a href="lithome.html">literature</a>
<!--     <a href="#">Link 3</a> -->

  </div>
  <a class="submenu"href="oldwebsites.html">Archived Websites</a>
  <a class="nav-menu" href="about.html">About</a>
  <button class="openBtn" onclick="openSearch()">Search</button>
</div> 

and I want to select the class="dropdowntext"我想 select class="dropdowntext"

This is my current CSS.这是我目前的 CSS。

.dropdown-container a.dropdowntext {
  font-family: futura_lt_btlight, "Open Sans", "Didact Gothic", Questrial, Muli, sans-serif;
}

You have many ways to select that element in CSS.你有很多方法可以 select CSS 中的那个元素。 Your selector is good, it should have the effect.你的选择器不错,应该有效果。 If it not, your font-family css attribute of your element might be override by other css rules.如果不是,则元素的font-family css 属性可能会被其他 css 规则覆盖。

 .dropdowntext1 { color: red; }.dropdown-container.dropdowntext2 { color: yellow; }.dropdown-container a.dropdowntext3 { color: green; }.dropdown-container a:first-child { color: cyan; }.dropdown-container a:child(4) { color: black; }
 <img class="logo" src="svg/robert-evans-logo.svg" alt="evans design logo"> <div class="sidenav"> <a class="current" href="index.html">Home</a> <a href="https://robertevansuni.uk/Journal/">Journal</a> <button class="dropdown-btn">Davids Work <i class="fa fa-caret-down" aria-hidden="true"></i> </button> <div class="dropdown-container"> <a class="dropdowntext1" ref="three-designed-objects-homepage.html">Designed Objects</a> <a class="dropdowntext2" ref="three-designed-objects-homepage.html">Designed Objects</a> <a class="dropdowntext3" ref="three-designed-objects-homepage.html">Designed Objects</a> <a class="dropdowntext4" ref="three-designed-objects-homepage.html">Designed Objects</a> </div> <button class="dropdown-btn">Priscas Work <i class="fa fa-caret-down" aria-hidden="true"></i> </button> <div class="dropdown-container"> <a href="Typography-arrangement.html">Typography</a> <a href="lithome.html">literature</a> </div> <a class="submenu"href="oldwebsites.html">Archived Websites</a> <a class="nav-menu" href="about.html">About</a> <button class="openBtn" onclick="openSearch()">Search</button> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM