JavaScript-js改变css样式的3种方式

第一种:使用 cssText 全属性

*.style.cssText = "width: 666px; color: red";

第二种:使用 setProperty(属性名,属性值) 方法

*.style.setProperty("width", "666px");

第三种:直接使用单属性

*.style.width="666px";

 

posted @ 2019-03-06 10:17  luvflo  阅读(3388)  评论(0编辑  收藏  举报