资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

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://cdkjz.cn/article/ddisph.html">http://cdkjz.cn/article/ddisph.html</a> </div> <div class="g-return-wrapper clearfix"> <a href="http://www.cdkjz.cn/" class="home">返回首页</a> <a href="http://www.cdkjz.cn/news/" class="column">了解更多建站资讯</a> </div> </div> </div> <div class="full-related-news"> <h3 class="related-title">相关资讯</h3> <div class="related-news weblg"> <ul class="clearfix"> <li> <a href="/article/ehjjsp.html"> <h2 class="title">什么叫网站空间,什么是网站空间</h2> </a> </li><li> <a href="/article/ehjjjd.html"> <h2 class="title">网站快照怎么更新,快照网站怎么进入</h2> </a> </li><li> <a href="/article/ehjjdp.html"> <h2 class="title">如何用ps制作曲线图,如何用ps画曲线啊</h2> </a> </li><li> <a href="/article/ehjigo.html"> <h2 class="title">tenda放大器怎么设置,tendaw300a无线放大器怎么设置</h2> </a> </li><li> <a href="/article/ehjjec.html"> <h2 class="title">挖矿设置,我的世界连锁挖矿按键设置</h2> </a> </li><li> <a href="/article/ehjgji.html"> <h2 class="title">开发一款手机app需要多少钱,如何开发一款手机app</h2> </a> </li><li> <a href="/article/ehjjdd.html"> <h2 class="title">IIS服务器多域名SSL证书绑定443端口的方法</h2> </a> </li><li> <a href="/article/ehjjjo.html"> <h2 class="title">可信云GPU云主机新一批测评即将公布适应AI高性</h2> </a> </li> </ul> </div> </div> <div class="full-icontact-cover m-ft-contact"> <div class="weblg"> <div class="clearfix content"> <div class="motto"> 多年建站经验 </div> <div class="info"> <h3>多一份参考,总有益处</h3> <h2> 联系快上网,免费获得专属《策划方案》及报价</h2> <div class="msg"> <p>咨询相关问题或预约面谈,可以通过以下方式与我们联系</p> <h4> 大客户专线   成都:<a href="tel:+13518219792" rel="nofollow">13518219792</a>   座机:<a href="tel:02886922220" rel="nofollow">028-86922220</a> </h4> </div> </div> </div> <div class="btns clearfix"> <a href="https://wpa.qq.com/msgrd?v=3&uin=631063699&site=qq&menu=yes" target="_blank" rel="nofollow" class="oline">在线咨询</a> <a href="javascript:;" class="edit" rel="nofollow">提交需求</a> </div> </div> </div> <div class="footer-content"> <div class="weblg clearfix"> <div class="friend-links"> <h6 class="clearfix"> <span class="tilte">友情链接</span> <a class="exchagne" href="http://wpa.qq.com/msgrd?v=3&uin=631063699&site=qq&menu=yes">交换友情链接</a> </h6> <div class="link-list clearfix"> <div class="link-slider"> <a href="http://www.scdzj.cn/" title="护栏打桩机" target="_blank">护栏打桩机</a><a href="http://chengdu.cdcxhl.cn/jianshe/ " title="品牌网站建设" target="_blank">品牌网站建设</a><a href="http://www.kswsj.com/" title="成都网页设计" target="_blank">成都网页设计</a><a href="http://www.scaimingsi.com/" title="四川艾名斯" target="_blank">四川艾名斯</a><a href="http://www.xywzsj.com/" title="钢筋机械设备" target="_blank">钢筋机械设备</a><a href="http://www.scmwjz.com/" title="诚信建站" target="_blank">诚信建站</a><a href="http://www.cqcxhl.com/jianzhan/" title="重庆建站" target="_blank">重庆建站</a><a href="http://www.skart.cn/" title="成都艺考培训" target="_blank">成都艺考培训</a><a href="http://www.fushidz.cn/" title="成都服装定制" target="_blank">成都服装定制</a><a href="https://www.cdcxhl.com/gaiban/chengdu.html" title="成都企业网站改版" target="_blank">成都企业网站改版</a> </div> </div> </div> </div> <div class="full-foot-bottom"> <div class="weblg clearfix"> <p>成都网站建设公司地址:成都市青羊区太升南路288号锦天国际A座10层 建设咨询<a href="tel:028-86922220">028-86922220</a></p> <p> 成都快上网科技有限公司-四川网站建设设计公司 | <a href="http://www.miitbeian.gov.cn/" target="_blank" rel="nofollow">蜀ICP备19037934号</a> Copyright 2020,ALL Rights Reserved cdkjz.cn | <a href="http://www.cdkjz.cn/" target="_blank">成都网站建设</a> | © Copyright 2020版权所有.</p> <p>专家团队为您提供<a href="http://www.cdkjz.cn/" target="_blank">成都网站建设</a>,<a href="http://www.cdkjz.cn/" target="_blank">成都网站设计</a>,成都品牌网站设计,成都营销型网站制作等服务,成都建网站就找快上网! | 成都网站建设哪家好? | <a href="###">网站建设地图</a></p> </div> </div> </div> <script type="text/javascript" src="../js/idangerous.swiper.min.js"></script> <script type="text/javascript" src="../js/wow.min.js"></script> <script type="text/javascript" src="../js/jquery.mousewheel.min.js"></script> <script type="text/javascript" src="../js/jquery.placeholder.min.js"></script> <script type="text/javascript" src="../js/layout.js"></script> </body> </html> <script> $(".singlepage 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>