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
• 7,940 points
7 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
• 8,460 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
• 8,460 points
8 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

6 days ago in CSS by Edureka
• 7,940 points
11 views
0 votes
0 answers

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

I want to only show a border ...READ MORE

1 day ago in CSS by Edureka
• 7,940 points
3 views
0 votes
1 answer

How do I give text or an image a transparent background using CSS?

Use either a semi-transparent PNG or SVG ...READ MORE

answered May 27 in CSS by Edureka
• 8,460 points
24 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
• 8,460 points
24 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
• 400 points
7 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
• 8,460 points
9 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
• 8,460 points
29 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
• 8,460 points
18 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