189 8069 5689

css中如何实现背景不滚动-创新互联

这篇文章将为大家详细讲解有关css中如何实现背景不滚动,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:主机域名、虚拟空间、营销软件、网站建设、三山网站维护、网站推广。

css背景不滚动的实现方法:首先新建一个html代码页面;然后在标签后面创建一个<style>标签;接着在这个标签里设置<body>标签的背景图片;最后设置“background-repeat:no-repeat;”属性即可。</p></blockquote><p>打开html开发软件,新建一个html代码页面。</p><p><img src="/upload/otherpic9/3189.jpg" alt="css中如何实现背景不滚动"></p><p>在html代码页面的<body>标签里面输入多行段落文字,用于后面浏览器滚动条滚动的时候查看图片时候随滚动条而滚动条。如图</p><p><img src="/upload/otherpic9/3190.jpg" alt="css中如何实现背景不滚动"></p><p>设置背景图片样式。在<title>标签后面创建一个<style>标签,然后在这个标签里设置<body>标签的背景图片,以及背景图片不重复。'</p><p>样式代码:</p><pre>body{ background-image: url(img/bg.jpg); background-repeat:no-repeat; }</pre><p><img src="/upload/otherpic9/3191.jpg" alt="css中如何实现背景不滚动"></p><p>保存html代码后使用浏览器打开,这个时候滚动浏览器滚动条发现背景图片是随浏览器滚动条的滚动而滚动的。</p><p><img src="/upload/otherpic9/3192.jpg" alt="css中如何实现背景不滚动"></p><p>使用background-attachment: fixed设置背景图片不随滚动条而滚动。回到html代码页面,在body样式中添加上background-attachment: fixed即可。</p><p>如图</p><p><img src="/upload/otherpic9/3193.jpg" alt="css中如何实现背景不滚动"></p><p>保存html代码页面后刷新浏览器,这个时候滚动浏览器滚动条发现背景图片已经固定不随浏览器滚动而滚动了。如图</p><p><img src="/upload/otherpic9/3194.jpg" alt="css中如何实现背景不滚动"></p><p>关于css中如何实现背景不滚动就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。</p> <br> 网页题目:css中如何实现背景不滚动-创新互联 <br> 文章链接:<a href="http://www.finscp.com/article/ddisph.html">http://www.finscp.com/article/ddisph.html</a> </div> </div> <div class="other"> <h3>其他资讯</h3> <ul> <li> <a href="/article/djhiogi.html">清理临时表空间:提高数据库性能(清理数据库临时表空间不足)</a> </li><li> <a href="/article/djhiodg.html">结构化存储从Redis开始(redis的组建)</a> </li><li> <a href="/article/djhehgi.html">如何实现HTML高度100%?</a> </li><li> <a href="/article/djhiosg.html">创新互联XHTML教程:XHTML示例</a> </li><li> <a href="/article/djhiodp.html">u控件是什么</a> </li> </ul> </div> </div> <footer> <div class="foot container"> <div class="footl fl"> <h3>联系我们</h3> <dl> 您好HELLO!<br> 感谢您来到大邑网站建设公司,若您有合作意向,请您为我们留言或使用以下方式联系我们, 我们将尽快给你回复,并为您提供真诚的设计服务,谢谢。 </dl> <ul> <li>电话:028- <span>86922220 18980695689</span></li> <li>商务合作邮箱:631063699@qq.com</li> <li>合作QQ: 532337155</li> <li>成都网站设计地址:成都市青羊区锣锅巷31号五金站写字楼6楼</li> </ul> </div> <div class="footr fr"> <h3>昊豪耀航建站公司</h3> <dl> 大邑昊豪耀航网站建设公司拥有多年以上互联网从业经验的团队,始终保持务实的风格,以"帮助客户成功"为已任,专注于提供对客户有价值的服务。 我们已为众企业及上市公司提供专业的网站建设服务。我们不只是一家网站建设的网络公司;我们对营销、技术、管理都有自己独特见解,昊豪耀航建站采取“创意+综合+营销”一体化的方式为您提供更专业的服务! </dl> <h3>昊豪耀航观点</h3> <dl> 相对传统的大邑网站建设公司而言,昊豪耀航是互联网中的网站品牌策划,我们精于企业品牌与互联网相结合的整体战略服务。<br> 我们始终认为,网站必须注入企业基因,真正使网站成为企业vi的一部分,让整个网站品牌策划体系变的深入而持久。 </dl> </div> </div> <div class="link"> <div class="container"> <span> 友情链接:</span> <a href="http://www.shjierui.cn/" title="shjierui.cn" target="_blank">shjierui.cn</a>   <a href="https://www.cdcxhl.cn/ " title="云虚拟主机" target="_blank">云虚拟主机</a>   <a href="http://chengdu.cdxwcx.cn/" title="成都网站制作" target="_blank">成都网站制作</a>   <a href="http://www.scdazj.com/" title="公路钻孔机" target="_blank">公路钻孔机</a>   <a href="https://www.cdcxhl.com/tuoguan/" title="服务器托管" target="_blank">服务器托管</a>   <a href="http://www.cmpfcb.com/" title="海口节能洗碗机" target="_blank">海口节能洗碗机</a>   <a href="http://www.msbanjia.cn/" title="眉山发电机租赁" target="_blank">眉山发电机租赁</a>   <a href="https://www.cdcxhl.com/app.html" title="成都app软件开发" target="_blank">成都app软件开发</a>   <a href="https://www.cdxwcx.com/jifang/mianyang.html" title="绵阳电信机房" target="_blank">绵阳电信机房</a>   <a href="https://www.cdxwcx.com/tuiguang/zhenghe.html" title="全网营销" target="_blank">全网营销</a>    </div> </div> <div class="copy"> © Copyright 2026 <a href="http://www.finscp.com">昊豪耀航建站公司</a>All Rights Reserved.  <a href="http://beian.miit.gov.cn" target="_blank" rel="nofollow">蜀ICP备2021004003号-2</a>  <a href="https://www.cdxwcx.com" target="_blank">成都网站建设</a> / <a href="https://www.cdxwcx.com" target="_blank">成都网站建设</a> / <a href="https://www.cdxwcx.com" target="_blank">响应式网站建设</a> / <a href="https://www.cdcxhl.com" target="_blank">成都网站设计</a>  <a href="https://www.cdcxhl.com/service/weihu.html" target="_blank">成都网站维护</a> <a href="https://www.cdcxhl.com/news/" target="_blank">其他新闻分类</a> </div> </footer> </body> </html> <script> $(".con img").each(function(){ var src = $(this).attr("src"); //获取图片地址 var str=new RegExp("http"); var result=str.test(src); if(result==false){ var url = "https://www.cdcxhl.com"+src; //绝对路径 $(this).attr("src",url); } }); window.onload=function(){ document.oncontextmenu=function(){ return false; } } </script>