简体   繁体   中英

css selector for selector

I have this HTML Element:

<button type="button" class="btn btn-xs btn-info">Feedback</div>

Class contains three elements:

  • btn - style for default button
  • btn-xs - changed size for button (not default one)
  • btn-info - changed color for button (not default one)

This is 3th party library (bootstrap) that designs my button.

My question: Is it possible to make css selector where I summarize css selectors to one?

In my case it would look like:

<button type="button" class="feedback">Feedback</div>

And in my css:

.feedback {
  style: .btn; /* how to do that? */
  style: .btn-xs;
  style: .btn-info;
}

No.

CSS has no way to define a rule-set that imports rules from other rule-sets.

You can change your original rule-sets so they have a group of selectors:

.feedback, .btn { /* rules */ }
.feedback, .btn-xs { /* rules */ }
.feedback, .btn-info { /* rules */ }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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