Codious-JR
Codious-JR

Reputation: 1748

Multiple Class Naming Convention

Recently i have been looking into Plugins and i keep seeing class names such as

  <div class="swiper-slide red-slide">
    <div class="title">Slide 2</div>
    <p>Keep swiping</p>
  </div>

It gets confusing when i am trying to modify the css files, I wanted to understand this class naming convention.

What does class="swiper-slide red-slide" mean? Does it mean that div has class attribute = "swiper-slide" and = "red-slide" ?

Upvotes: 1

Views: 222

Answers (2)

Christoph B&#252;hler
Christoph B&#252;hler

Reputation: 2923

Yes, a HTML element can have multiple classes.

<div class="swiper-slide red-slide">

means, that you can access the element with the class ".swiper-slide" and also ".red-slide". Of course, this does not work with IDs.

Upvotes: 2

IMSoP
IMSoP

Reputation: 97994

Class. This attribute is a space-separated list of the classes of the element.

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#class

Upvotes: 1

Related Questions