Search
 
SCRIPT & CODE EXAMPLE
 

CSS

read properties from css file

.box {
    position:absolute;
    background-color:red;
    height:10px;
    width:10px;
}
Comment

read properties from css file

function propertyFromStylesheet(selector, attribute) {
    var value;

    [].some.call(document.styleSheets, function (sheet) {
        return [].some.call(sheet.rules, function (rule) {
            if (selector === rule.selectorText) {
                return [].some.call(rule.style, function (style) {
                    if (attribute === style) {
                        value = rule.style.getPropertyValue(attribute);
                        return true;
                    }

                    return false;
                });
            }

            return false;
        });
    });

    return value;
}

console.log(propertyFromStylesheet(".box", "height"));
Comment

PREVIOUS NEXT
Code Example
Css :: how to change paragraph text color to orange - css 
Css :: font awesome eyes 
Css :: How to make blinking/flashing text with CSS 3 
Css :: cut word css 
Css :: circle button html 
Css :: dont brake text in css 
Css :: css font face 
Css :: bootstrap 3 offset 
Css :: font for css code google link 
Css :: reduire espace entre ligne css 
Css :: onclick jquery add css 
Css :: pointer events none and cursor not allowed 
Css :: texting getting out of box css 
Css :: how to prevent select image in css 
Css :: ionic input line color 
Css :: mini-css-extract-plugin 
Css :: flex fill space 
Css :: how to change color of element when hovering over div 
Css :: Applying an ellipsis with css 
Css :: image rotate css 
Css :: how to set fallback font in css 
Css :: svg image shadow css 
Css :: how to add font otf format in html 
Css :: how to set div background image 
Css :: how to make multiple borders using box shadow in css 
Css :: how to view downloading speed 
Css :: convert firebase created_at to Date string 
Css :: rgb green 
Css :: glassmorphism in css 
Css :: transform origin css 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =