gpt4 book ai didi

css - 在 Dart 中设置
高度属性

转载 作者:行者123 更新时间:2023-11-28 09:38:19 25 4
gpt4 key购买 nike

我正在学习 Dart,并且一直坚持更改 <div> 的高度.任何帮助表示赞赏。

<div id="sample_container_id">
<p id="sample_text_id"></p>
</div>
import 'dart:html';
void main()
{
DivElement div = query('#sample_container_id');
div.style.height = "40000";
}

最佳答案

正如@richthepanda 在评论中指出的那样,您使用 Dart 代码正确设置了 div 元素的 height 属性,但是您将其设置为无效 height字符串至于让浏览器用它做你想做的事。添加预期单位可解决问题:

  div.style.height = "40000px";

关于css - 在 Dart 中设置 <div> 高度属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16006289/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com