After some searching I have come to the conclusion that it is not possible to retrieve CSS styles using the PHP DOM parser
. Can anyone confirm that?
An element can e.g. be identifyed by its ID
. If that element then has a style attribute (an element style style="abc"
), this attribute's value can be retrieved too. But if the element's style is defined by an id
from a CSS selector
, PHP seems not to have any direct access to the styles.
The only workaround I see is parsing all linked CSS files and checking if there are any styles assigned to that ID
. Is that right?