I'm using PHP DOM to read in an HTML page. What I would like to do is traverse through this HTML and associate each tag, id or class with its corresponding stylesheet attributes. For example: If I had a div with a class called "container", I could find the corresponding stylesheet container { color: red; }. I am able to do this example fairly easy, but stylesheets have many complexities in their hierarchy as well as the many ways to write them.
I was hoping there might be a class out there to do this? Perhaps something that works with PHP DOM that incorporates css files as well? Or maybe a project that someone knows about that I could gain research from or to point me in the right direction?