public function setStyle($key, $value)
    {
        foreach ($this as $node) {
            if ($node instanceof \DOMElement) {
                /** @var \DOMElement $node */
                $styles = Helpers::cssStringToArray($node->getAttribute('style'));
                if ($value != '') {
                    $styles[$key] = $value;
                } elseif (isset($styles[$key])) {
                    unset($styles[$key]);
                }
                $node->setAttribute('style', Helpers::cssArrayToString($styles));
            }
        }
        return $this;
    }
public function setStyle($key, $value)
    {
        foreach ($this as $node) {
            if ($node instanceof \DOMElement) {
                /** @var \DOMElement $node */
                $styles = Helpers::cssStringToArray($node->getAttribute('style'));
                if ($value != '') {
                    $styles[$key] = $value;
                } elseif (isset($styles[$key])) {
                    unset($styles[$key]);
                }
                $node->setAttribute('style', Helpers::cssArrayToString($styles));
            }
        }
        return $this;
    }
public function setStyle ( $ key , $ value ) { foreach ( $ this as $ node ) { if ( $ node instanceof \ DOMElement ) { /** @var \DOMElement $node */ $ styles = Helpers :: cssStringToArray ( $ node -> getAttribute ( 'style' ) ) ; if ( $ value != '' ) { $ styles [ $ key ] = $ value ; } elseif ( isset ( $ styles [ $ key ] ) ) { unset ( $ styles [ $ key ] ) ; } $ node -> setAttribute ( 'style' , Helpers :: cssArrayToString ( $ styles ) ) ; } } return $ this ; }
set one CSS style property for all elements in the list

@param string $key name of the property
@param string $value value of the property
@return HtmlPageCrawler $this for chaining
set one CSS style property for all elements in the list