gpt4 book ai didi

html - 在 erb 文件中设置虚线内联样式

转载 作者:太空宇宙 更新时间:2023-11-04 03:20:53 32 4
gpt4 key购买 nike

如何在 erb 文件中设置虚线内联 css 属性。比如这个

<%= image_tag "some_image.png", html: {width: "some_width", height: "some_height", margin:"some_margin"}%>

这工作正常但是当我设置

<%= image_tag "some_image.png", html: {width: "some_width", height: "some_height", margin-left:"some_margin_left"}%>

我明白了

syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('

最佳答案

你有这个错误是因为带有破折号的符号文字(-,比如 :margin-left)不是有效的符号。应该是:

:"margin-left" => "some_margin_left"

此外,此语法应该有效:

margin: {left: "some_margin_left"}

关于html - 在 erb 文件中设置虚线内联样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27900271/

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