0

Is it possible to have one css class having a property which calls another CSS class?

Example:

.redcolor {
    color:red;
}
p {
    text-align: center;
    color: redcolor;
}
1
  • no it's only Less css Commented Jun 1, 2016 at 11:24

3 Answers 3

2

No unless you are using SASS/LESS. You are stuck with giving everything "Red" as a normal class.

Sign up to request clarification or add additional context in comments.

Comments

0

You can make it with SASS:

$bodyColor: #000;

body {
    color: $bodyColor;
}

Comments

0

No ! It is not possible in plain CSS but you can always use Some CSS Preprocessors like SASS or LESS

New Edit: Okay I was searching about it and seems your problem can be solved without using pre Preocessor have a look here

but, let me clear this is experimental as per MDN can may not be compatible in all browsers

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.