category: css

CSS - content property use special char

on 2017-05-04

CSS - content property use special char

If you want use special char like © in CSS content property

You must use ASCII and show on HEX

And it is &#169

So CSS need

div;before {
    content: "\00A9";
}

Entity Conversion Calculator

This page can help us trans to hex

Refer - CSS Content | CSS-Tricks

JavaScript - get CSS style

on 2016-01-27

JavaScript - get CSS style

Sometimes i want to use JavaScript get dom CSS style.

Use DOM.currentStyle and window.getComputedStyle(DOM)

For IE use DOM.currentStyle

Other use window.getComputedStyle(DOM)

var dom = document.getElementById("target"),
    style = dom.currentStyle || window.getComputedStyle(dom);
console.log(style.marginTop);

refer - Window.getComputedStyle() - Web APIs | MDN

refer - currentStyle object (Internet Explorer)