资讯

精准传达 • 有效沟通

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

css中如何实现背景不滚动

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

专注于为中小企业提供做网站、成都网站设计服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业雨湖免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了近千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

css背景不滚动的实现方法:首先新建一个html代码页面;然后在标签后面创建一个<style>标签;接着在这个标签里设置<body>标签的背景图片;最后设置“background-repeat:no-repeat;”属性即可。</p></blockquote><p>打开html开发软件,新建一个html代码页面。</p><p><img src="/upload/otherpic69/3189.jpg" alt="css中如何实现背景不滚动"></p><p>在html代码页面的<body>标签里面输入多行段落文字,用于后面浏览器滚动条滚动的时候查看图片时候随滚动条而滚动条。如图</p><p><img src="/upload/otherpic69/3190(1).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/otherpic69/3191.jpg" alt="css中如何实现背景不滚动"></p><p>保存html代码后使用浏览器打开,这个时候滚动浏览器滚动条发现背景图片是随浏览器滚动条的滚动而滚动的。</p><p><img src="/upload/otherpic69/3192.jpg" alt="css中如何实现背景不滚动"></p><p>使用background-attachment: fixed设置背景图片不随滚动条而滚动。回到html代码页面,在body样式中添加上background-attachment: fixed即可。</p><p>如图</p><p><img src="/upload/otherpic69/3193.jpg" alt="css中如何实现背景不滚动"></p><p>保存html代码页面后刷新浏览器,这个时候滚动浏览器滚动条发现背景图片已经固定不随浏览器滚动而滚动了。如图</p><p><img src="/upload/otherpic69/3194.jpg" alt="css中如何实现背景不滚动"></p><p>关于css中如何实现背景不滚动就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。</p> <br> 文章标题:css中如何实现背景不滚动 <br> 本文来源:<a href="http://cdkjz.cn/article/pdjsgd.html">http://cdkjz.cn/article/pdjsgd.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/gessjs.html"> <h2 class="title">Nagios监控系列学习——check_nt监控windows系统资源</h2> </a> </li><li> <a href="/article/geseco.html"> <h2 class="title">影响windows电脑启动慢的七个原因和解决方法</h2> </a> </li><li> <a href="/article/gesshd.html"> <h2 class="title">站点切换插件使用</h2> </a> </li><li> <a href="/article/gesspp.html"> <h2 class="title">OpenStack实践(七):RabbitMQ监控</h2> </a> </li><li> <a href="/article/geseoo.html"> <h2 class="title">c语言中数组有几种类型</h2> </a> </li><li> <a href="/article/geseoc.html"> <h2 class="title">MySQL--------入门简介篇</h2> </a> </li><li> <a href="/article/gessei.html"> <h2 class="title">python函数详解</h2> </a> </li><li> <a href="/article/geseoh.html"> <h2 class="title">Java中如何实现消息队列任务的平滑关闭</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="https://www.xwcx.net/hkcloud.html" title="香港云服务器" target="_blank">香港云服务器</a><a href="http://www.cdkjz.cn/wangzhan/jituan/" title="成都集团网站建设" target="_blank">成都集团网站建设</a><a href="http://www.wjwzjz.com/" title="温江网站设计" target="_blank">温江网站设计</a><a href="http://www.cdxtjz.cn/" title="成都网站建设" target="_blank">成都网站建设</a><a href="http://www.myfdjwx.com/" title="myfdjwx.com" target="_blank">myfdjwx.com</a><a href="http://www.tyjike.cn/" title="成都富士康招工" target="_blank">成都富士康招工</a><a href="http://www.hbxxgc.cn/" title="乐山中领科信" target="_blank">乐山中领科信</a><a href="http://www.ahjierui.cn/" title="ahjierui.cn" target="_blank">ahjierui.cn</a><a href="http://www.gyfdjwx.com/" title="gyfdjwx.com" target="_blank">gyfdjwx.com</a><a href="http://www.cdkjz.cn/wangzhan/" title="网站seo优化" target="_blank">网站seo优化</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>