Read From CSS

J

Jeronimo Bertran

I want to be able to programatically read the value from a css stylesheet.
For example, I have a stylesheet with the following style defined:

..dayInactive
{
background-color:#D200D2;
}


And from a C# codebehind I want to be able to obtain the value for the
background-color.

Thanks

Jeronimo Bertran
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Jeronimo said:
I want to be able to programatically read the value from a css stylesheet.
For example, I have a stylesheet with the following style defined:

.dayInactive
{
background-color:#D200D2;
}


And from a C# codebehind I want to be able to obtain the value for the
background-color.

Thanks

Jeronimo Bertran

There is nothing built in to do this on the server side. To positively
determine the style applied to any given element is rather complicated,
including parsing the page to determine what css files are loaded, load
them and parse them all, and parse the page content to be able to
determine what styles affect the element.

If you just have a simple style like your example, and only want to read
the property from a given css file based on a single class name, you can
just read the file, look for style and extract the property.
 
G

Guest

Jeronimo,
CSS style declarations exist in the browser once they are loaded and are
strictly a client-side ("in the browser") construct, not subsequently
available from server-side code.

Could you be more specific about what exactly is the goal here?
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top