Solved

Variable in CSS

Posted on 2015-02-19
3
73 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.net Fit 3 divs on screen side by side 3 26
SlickNav Menu Plugin Not appearing on mobile 6 34
Sort Order Icons on HTML Table 3 24
innerHTML 7 19
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

809 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