美文网首页
JS中动态调整Class、Style

JS中动态调整Class、Style

作者: 第一梯队利群 | 来源:发表于2019-03-08 13:50 被阅读0次
setBackHeight() {
      var backHeight = document.getElementById("serviceCommentClass");
      var heightStr =
        this.backHeight + this.myLawyer.lawyerEvaluatels.length + "rem";
      console.log("heightStr:", heightStr);
      //第一种:设置某个具体的值
      backHeight.style.height = heightStr;
    
      //第二种:用cssText
      div.style.cssText='width:600px;height:250px;border:1px red solid;text-align: center;line-height: 250px;';
 }

相关文章

网友评论

      本文标题:JS中动态调整Class、Style

      本文链接:https://www.haomeiwen.com/subject/fcdrpqtx.html