Solved

Variable in CSS

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

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 42

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
This article discusses four methods for overlaying images in a container on a web page
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

743 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

11 Experts available now in Live!

Get 1:1 Help Now