[英]Can't figure out why my css isn't being changed by my Javascript using Bulma framework
I am new to css and Bulma. 我是CSS和Bulma的新手。
This is the relevant code for my problem. 这是我的问题的相关代码。
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);
....
The class changes to basePlate and listPiece isn't changing anything on the actual web page, and I have no idea why. 该类更改为basePlate和listPiece并没有更改实际网页上的任何内容,我也不知道为什么。 Can anyone explain?
谁能解释?
Because inside object style
are css properties such background-color
, width
, opacity
, display
, etc 因为内部对象
style
是css属性,例如background-color
, width
, opacity
, display
等
use: 采用:
listPiece.className="container";
reference: https://developer.mozilla.org/en-US/docs/Web/API/Element/className 参考: https : //developer.mozilla.org/zh-CN/docs/Web/API/Element/className
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.