Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reuse a color in a stylesheet?

Tags:

css

I have a stylesheet and a lot of styles with the same border color (#CCCCCC to be precise).

Is there a way to specify some kind of variable and reuse that, so instead of typing #CCCCCC over and over, I can type:

border: 1px solid $bordercolor; 

P.S. I'm using ASP.NET MVC.

like image 724
Michel Avatar asked Apr 27 '10 13:04

Michel


People also ask

How many ways you can use color in CSS?

There are three different ways to specify colors in CSS.

How do I customize colors in CSS?

Simply add the appropriate CSS selector and define the color property with the value you want. For example, say you want to change the color of all paragraphs on your site to navy. Then you'd add p {color: #000080; } to the head section of your HTML file.


1 Answers

.classA, .classB, .classC {    border-color: #CCC; }  .classA {    border-width: 1px;    border-style: solid; }  ... 

But you can't use the short-hand syntax to define the border anymore.

like image 50
kennytm Avatar answered Sep 23 '22 21:09

kennytm