Solved

Variable in CSS

Posted on 2015-02-19
3
72 Views
Last Modified: 2015-02-19
Hi Experts,

Is it possible to use variables in CSS? For example, if I want to set the width to couple of elements to the same value, can I do this in one place?

Thank you
0
Comment
Question by:APD_Toronto
3 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 40619461
Nope.  CSS does not support variables.  Some people get around this using their server side language like PHP to process their CSS files.  Or they set things using javascript.
0
 
LVL 43

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 250 total points
ID: 40619477
You could use one of the CSS extension frameworks such as SASS or LESS. Otherwise, as Dave says, build your CSS dynamically using PHP - fairly straight forward to do.
0
 

Author Closing Comment

by:APD_Toronto
ID: 40619490
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unwanted gap in IE11 between header and menu 9 20
How can i modify my File download link ? 6 49
Not showing page correctly 3 30
Why my select dropdown does not work? 8 26
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now