CSS select Decoration - Java org.w3c.dom.css

Java examples for org.w3c.dom.css:CSSStyleDeclaration

Description

CSS select Decoration

Demo Code


//package com.java2s;

import org.w3c.dom.css.CSSStyleDeclaration;
import org.w3c.dom.css.CSSValue;
import org.w3c.dom.css.ElementCSSInlineStyle;

public class Main {
    public static void selectDecoration(ElementCSSInlineStyle elemStyle) {
        CSSStyleDeclaration style = elemStyle.getStyle();
        CSSValue cssValue = style.getPropertyCSSValue("color"); // Usar el CSSValue es la forma m?s lenta pero es para testear
        if (cssValue == null)
            style.setProperty("color", "red", "");
        else//from  w w  w .ja  va 2 s .com
            cssValue.setCssText("red");
    }
}

Related Tutorials