How can I define colors as variables in CSS

0 votes
I'm currently working on a lengthy CSS file. Can colours be assigned to variables so that I can simply update one variable and have the new colour applied to all elements that require it? I know the client might want modifications to the colour scheme.

Please take note that I am unable to dynamically alter the CSS file using PHP.
Jun 16 in CSS by Edureka
• 10,120 points
19 views

1 answer to this question.

0 votes
CSS does not use variables. You can, however, use another language, such as SASS, to specify your styling using variables and automatically generate CSS files, which you can then publish to the web. You'd have to re-run the generator every time you changed your CSS, but that's not too difficult.
answered Jun 21 by Edureka
• 9,540 points

Related Questions In CSS

0 votes
1 answer

How can I use CSS to style multiple images differently?

You can do that in HTML (delete ...READ MORE

answered Jun 21 in CSS by Edureka
• 9,540 points
26 views
0 votes
0 answers

How can I vertically center a div element for all browsers using CSS?

I want to center a div vertically with CSS. ...READ MORE

Jun 22 in CSS by Edureka
• 10,120 points
19 views
0 votes
1 answer

How can I set a css border on one side only?

Use four values to add a border ...READ MORE

answered Jun 28 in CSS by Edureka
• 9,540 points
23 views
0 votes
0 answers

How do I rotate text in css?

How can I rotate text using CSS ...READ MORE

Jun 30 in CSS by Edureka
• 10,120 points
23 views
0 votes
1 answer

Is there any way to colorize a white PNG image with CSS only?

Filters can be used with -webkit-filter and ...READ MORE

answered May 27 in CSS by Edureka
• 9,540 points
81 views
0 votes
0 answers
0 votes
0 answers

Color names allowed in HTML/CSS

what are the CSS color names, though ...READ MORE

May 27 in HTML by Tejashwini
• 1,760 points
16 views
0 votes
1 answer

Color names allowed in HTML/CSS

Aqua, black, blue, fuchsia, grey, green, lime, ...READ MORE

answered Jun 1 in CSS by Edureka
• 9,540 points
13 views
0 votes
1 answer

How to set Bullet colors in UL/LI html lists via CSS without using any images or span tags

I use jQuery for this: jQuery('li').wrapInner('<span class="li_content" />'); & ...READ MORE

answered May 27 in CSS by Edureka
• 9,540 points
48 views
0 votes
1 answer

How do I center this form in css?

You can try form { ...READ MORE

answered Jun 10 in CSS by Edureka
• 9,540 points
28 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP