How to add an image to the contents using HAML?

前端 未结 1 1487
有刺的猬
有刺的猬 2021-02-07 00:11

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

1条回答
  •  情话喂你
    2021-02-07 00:30

    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"
    

    0 讨论(0)
提交回复
热议问题