HTMLElement.style
属性返回元素的内联样式属性,但是会忽略任何样式表应用的样式属性。
样式的设置应该通过以下三种方式设置:
ele.style.cssText="color:blue;font-size:14px"
ele.setAttribute("style", "color:blue;font-size:14px")
ele.style.color="blue"
要获取元素的完整属性样式,应该使用window.getComputedStyle(element, [psudoEle])
来获取。(注意:普通元素第二个参数psudoEle应为null,伪元素为:::after等)