Change element style
<div style= "width:100px;height:100px;text-align:center;line-height:100px;" > This is div
</div>
We assign a value to the Style property directly if the style of the general change is less.
Div.style.width = "200px";d iv.style.height = "200px";d iv.style.lineHeight = "200px";
But once you have a lot of styles to change, you can use Csstext to set
Div.style.cssText = "width:200px;height:200px;line-height:200px";
However, Csstext overrides the inline style, does not overwrite the style within the <style> tag, does not overwrite the external style, so in order to solve this problem, style overlay is used.
Div.style.cssText + = "width:200px;height:200px;line-height:200px";
However, browser Div.style.cssText below IE9 will omit the last semicolon in Csstext
Console.log (Div.style.cssText);
The result: height:100px; width:100px; Text-align:center; line-height:100px; Background-color:red
So in order to solve this small problem in IE
Div.style.cssText + = "; width:200px;height:200px;line-height:200px";
The csstext of CSS