Haml:如何为 HAML 中的元素设置内联样式 [英] Haml: How to set inline style for element in HAML

查看:47
本文介绍了Haml:如何为 HAML 中的元素设置内联样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

它仅解析 style='position: absolute',不解析其他样式.我怎样才能做到这一点?

解决方案

如果你发布了你正在使用的 HAML 会很方便,但它是这样完成的:

%div.some{ :style =>位置:绝对;左侧:300px;顶部:300px;"}

Here is my code:

<div class='some' style='position: absolute; left: 300; top: 300;'>..</div>

It parses only style='position: absolute', and doesn't parse the other styles. How can I achieve this?

解决方案

It would have been handy if you'd posted the HAML you're using, but this is how it's done:

%div.some{ :style => "position: absolute; left: 300px; top: 300px;" }

这篇关于Haml:如何为 HAML 中的元素设置内联样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆