是否有可能视差img标签而不是背景图像在div? [英] Is it possible to parallax an img tag rather than background image in a div?

查看:76
本文介绍了是否有可能视差img标签而不是背景图像在div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一些parallaxing教程(这一个特别我现在看着: http://net.tutsplus.com/tutorials/html-css-techniques/simple-parallax-scrolling-technique/ );然而,它们似乎都在一个固定的< div> 中包含背景图片。如果图像位于< img> 标签中,是否可以实现类似的视差效果?

I've come across a number of parallaxing tutorials (this one in particular I'm looking at now: http://net.tutsplus.com/tutorials/html-css-techniques/simple-parallax-scrolling-technique/); however, they all seem to involve a background image in a <div> that's fixed. Is is possible to achieve a similar parallax effect if my image is in a <img> tag?

推荐答案

假设您使用相同的属性,那么确定它可以

Provided you use the same attributes then yeah sure it can

这里可以看到一个例子:
http://webdesign.tutsplus。 com / tutorials / complete-websites / create-a-parallax-scrolling-website-using-stellar-js /

An example of this can be seen here: http://webdesign.tutsplus.com/tutorials/complete-websites/create-a-parallax-scrolling-website-using-stellar-js/

这篇关于是否有可能视差img标签而不是背景图像在div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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