How to add an image to the contents using HAML?

泄露秘密 提交于 2019-12-04 15:36:03

问题


New to this tagging language, and I'm having trouble finding documentation mentioning how to work with images. An example or two would be fantastic.

Btw, I did refer to this discussion, but not sure if that's what I need.


回答1:


Outside any kind of framework:

%img(src="/images/loading.gif")

The older, more verbose but flexible syntax:

%img{:src => "/images/loading.gif"}

If you’re using Rails, it will generate the tag itself:

=image_tag "loading.gif"


来源:https://stackoverflow.com/questions/10561121/how-to-add-an-image-to-the-contents-using-haml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!