新手问题 关于 image_tag 的问题

metal · 2012年07月25日 · 最后由 hooopo 回复于 2012年07月25日 · 2219 次阅读

有没有办法让 image_tag 自动加入宽和高,不用我去手动加入:size 指定。

<%= image_tag('image.png') %>

在 css 里限制行么?

<%= image_tag('image.png', :style => "width:100px;heigh:100px;") %> 我看错你的意思的...

有的。。根据图片的宽高自动给 image 标签加宽高 据说这也可以有前端性能优化的作用

需要 登录 后方可回复, 如果你还没有账号请 注册新账号