public function css(string $name, $val=null)
    {
        if ($val !== null) { // set css for all nodes
            foreach ($this->getElements() as $node) {
                $style = self::parseStyle($node->getAttribute('style'));
                $style[$name] = $val;
                $node->setAttribute('style', self::getStyle($style));
            }
            return $this;
        }
        if ($node = $this->getFirstElmNode()) { // get css value for first element
            $style = self::parseStyle($node->getAttribute('style'));
            if (isset($style[$name])) {
                return $style[$name];
            }
        }
    }
public function css(string $name, $val=null)
    {
        if ($val !== null) { // set css for all nodes
            foreach ($this->getElements() as $node) {
                $style = self::parseStyle($node->getAttribute('style'));
                $style[$name] = $val;
                $node->setAttribute('style', self::getStyle($style));
            }
            return $this;
        }
        if ($node = $this->getFirstElmNode()) { // get css value for first element
            $style = self::parseStyle($node->getAttribute('style'));
            if (isset($style[$name])) {
                return $style[$name];
            }
        }
    }
public function css ( string $ name , $ val = null ) { if ( $ val !== null ) { // set css for all nodes foreach ( $ this -> getElements ( ) as $ node ) { $ style = self :: parseStyle ( $ node -> getAttribute ( 'style' ) ) ; $ style [ $ name ] = $ val ; $ node -> setAttribute ( 'style' , self :: getStyle ( $ style ) ) ; } return $ this ; } if ( $ node = $ this -> getFirstElmNode ( ) ) { // get css value for first element $ style = self :: parseStyle ( $ node -> getAttribute ( 'style' ) ) ; if ( isset ( $ style [ $ name ] ) ) { return $ style [ $ name ] ; } } }
Get the value of a computed style property for the first element in the set of matched elements
or set one or more CSS properties for every matched element.

@param string $name
@param string $val

@return $this|string
Get the value of a computed style property for the first element in the set of matched elements or set one or more CSS properties for every matched element .