Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Html CSS get variables finally after 17 years

Related Tutorials


 
 

Share on Google+Share on Google+

CSS get variables finally after 17 years

Advertisement
After a long wait finally variables functionality is added to the CSS document.

CSS get variables finally after 17 years - Now use variables in CSS document

In this tutorial you will know about the CSS and how it has become possible to use the variables in the CSS.

CSS or Cascading Styles Sheets is a style language, which helps in defining the features of HTML documents. CSS, which is the step to present HTML, is the presentation of the said content or document.

The major problem with CSS initially was that its dumbfounding lack of variables and it was unable to deal with them. But now there has come a revolutionary concept with the same and now after 17 years, one can put variables with the CSS.

It was difficult to set it as if you want globally available variables; this is just because CSS doesn't support 'loose' properties, so this ensures things don't break in parsers that aren't aware of variables.

Now it has become easy to defining and refereeing for CSS and also it provides the scope for variables.

In this process, many variables with prefixed ?var? and defined within a context ant certainly they should be entertained in the same way.

Here is simple example of variables in CSS:

<style>
:root {
var-redcolor: #FF0000; 
var-yellowcolorcode: #FFFF00;
}


h1 {
color: var(redcolor);
}
h2 {
color: var(yellowcolorcode);
}
:root {
var-redcolor: #369;
var-yellowcolorcode: powderblue;
}
#partnerbadge {
var-redcolor: #036;
var-yellowcolorcode: #cfc;
}
</style>

Although it has to be see how this functionality could be useful when allowing users to customize colors on a profile base as it plays crucial role with different parts of the large section of the CSS.

Interestingly it can also be used to provide a new way and also be used if some want to try SASS.
However SASS is the style sheet languages with compile down to CSS and it will be needed to introduce the same for a long time from now.

Check HTML Tutorials Home page

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 24, 2013

Related Tutorials

Discuss: CSS get variables finally after 17 years  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com