Arthur W
Arthur W

Reputation: 62

CSS Inheriting or Sharing Properties (Class Inheritance IN CSS)

So I looked at how CSS "shares" its properties here : https://stackoverflow.com/a/199719/13707884

This was written in 2008 so I figured maybe CSS does allow for inheritance now & sure enough there is an article on it here : https://coderwall.com/p/lqjd1w/css-class-inheritance-in-css

So I am trying out the code as mentioned in the link on "coderwall":

[class*=“row-“] {
  border: 5px solid lightskyblue;
}

.row-1 {
  color: blue;
}

.row-2 {
  color: darkred;
}
<div class="row-1">AAA</div>
<div class="row-2">AAA</div>

However, this does not seem to be working. What could I be doing wrong here?

Upvotes: 1

Views: 191

Answers (1)

Eric
Eric

Reputation: 321

Your quotation marks in your first selector are invalid.

[class*="row-"] {
  border: 5px solid lightskyblue;
}

.row-1 {
  color: blue;
}

.row-2 {
  color: darkred;
}
<div class="row-1">AAA</div>
<div class="row-2">AAA</div>

Upvotes: 4

Related Questions