我是css和Bulma的新手。
这是我的问题的相关代码。
for (var i=0; i<20; i++){
if (i<list.length){
var textTemplate="{{text}}";
attach= Mustache.render(textTemplate,list[i]);
attach=document.createTextNode(attach);
var basePlate=document.createElement("section");
basePlate.style.class="section";
var listPiece=document.createElement("dt");
listPiece.style.class="container";
toInsert.appendChild(basePlate);
basePlate.appendChild(listPiece);
listPiece.appendChild(attach);
....更改为basePlate和listPiece的类不会改变实际网页上的任何内容,我不知道为什么。有谁能解释一下吗?
发布于 2019-01-12 15:26:45
因为在对象style内部是css属性,如background-color、width、opacity、display等
使用:
listPiece.className="container";
参考:https://developer.mozilla.org/en-US/docs/Web/API/Element/className
https://stackoverflow.com/questions/54157117
复制相似问题