HTML
<div id="height">div标签</div>
js的样式设置
window.onload = function () {
var box = document.getElementById("height");
height.style.width = "100px";
height.style.height = "100px";
height.style.backgroundColor = "green";
height.style.color = "#fff";
height.style.fontSize = "26px";
}结果样式: