我一直在努力找出问题,但没有运气。我也一直在互联网上寻找可能的解决方案,但是,再次没有运气。
假设我希望用户在浏览网站时向下滚动时,带有文本的图像在背景中保持固定,我该如何处理?(也很敏感)。
我尝试做很多事情,但是当调整窗口大小时,当文本希望保留在背景图像中时,文本超出了背景图像。
html5
===========
<body>
<header id="head">
<!--head content-->
</header>
<div class="fixedImage">
<div class="welcome">
<h1>Welcome to this site</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec commodo, enim eu posuere commodo, elit mauris condimentum sem.</p>
</div>
</div>
</body>
css
======
#head{
width:100%;
background-color:#FFFFFF;
}
.fixedImage{
background-attachment:url(img/random.jpg);
background-size: 100%;
background-repeat:no-repeat;
background-attachment:fixed;
}
.welcome{
/*styling goes here*/
}
我想做的一个很酷的例子是这样的:
固定在顶部的图像(其中包含文本)在调整大小时不会从图像中倒出。
如果有人可以帮助我解决这个令人毛骨悚然的事情,那就太好了!
感谢您的时间!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句