i am looking at building my website with the php dom classes. supposing i already have a document with a body, if i add a div to the body like so:
$div = $document->createElement('div');
$document->getElementsByTagName('body')->item(0)->appendChild($div);
is there a way to set a 'style' attribute for this element which has multiple entries? eg one which ends up looking like this:
<div style="top: 40px; left: 60px;"></div>
i know i could do this:
$div->setAttribute('style', 'top: 40px; left: 60px;');
but i want each aspect of the style to be accessible without parsing the value through regex. this is because i would like to access the 40px value easily in other parts of my code.