RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
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://scpingwu.com/article/pdjsgd.html">http://scpingwu.com/article/pdjsgd.html</a> </div> <div class="hot_new"> <div class="page_title clearfix"> <h3>其他资讯</h3> </div> <div class="news_list clearfix"> <ul> <li> <a href="/article/dooedce.html">c语言幂对数函数 对数 幂函数</a> </li><li> <a href="/article/dooedgg.html">python函数没有形参 python中没有对参数指定类型</a> </li><li> <a href="/article/dooedec.html">vb.net控制台程序 vb运行程序</a> </li><li> <a href="/article/dooedgd.html">c语言平方根函数是什么 c语言平方根函数的函数名</a> </li><li> <a href="/article/dooedis.html">vb.net画图教程 vb如何根据数据画图</a> </li> </ul> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <!-- 底部信息 --> <div class="footer wow fadeInUp"> <div class="rowFluid"> <div class="span12"> <div class="container"> <div class="footer_content"> <div class="span4 col-xm-12"> <div class="footer_list"> <div class="span6"> <div class="bottom_logo"><img src="/Public/Home/images/ewm.jpg" alt="微信服务号二维码" /></div> </div> <div class="span6 col-xm-12"> <div class="quick_navigation"> <div class="quick_navigation_title">快速导航</div> <ul> <li><a href="https://www.cdcxhl.com/" title="成都网站建设公司" target="_blank">成都网站建设公司</a></li><li><a href="http://www.zejunkj.cn/" title="泽君科技" target="_blank">泽君科技</a></li><li><a href="http://chengdu.cdcxhl.cn/shop/ " title="成都微商城" target="_blank">成都微商城</a></li><li><a href="http://www.024fuxl.com/" title="成都酒店服定制" target="_blank">成都酒店服定制</a></li><li><a href="http://www.cdyunpu.com/" title="公司画册设计" target="_blank">公司画册设计</a></li><li><a href="https://www.cdxwcx.com/tuiguang/" title="成都网站推广" target="_blank">成都网站推广</a></li><li><a href="http://www.yunxintw.com/" title="yunxintw.com" target="_blank">yunxintw.com</a></li> </ul> </div> </div> </div> </div> <div class="span4 col-xm-6 col-xs-12"> <div class="footer_list"> <div class="footer_link"> <div class="footer_link_title">友情链接</div> <ul id="frientLinks"> <a href="https://www.cdcxhl.com/" title="网站制作" target="_blank">网站制作</a> <a href="https://www.cdcxhl.com/" title="网站建设" target="_blank">网站建设</a> <a href="https://www.cdxwcx.com/tuiguang/" title="成都网络推广" target="_blank">网络推广</a> <a href="http://seo.cdkjz.cn/" title="成都网站推广" target="_blank">网站推广</a> <a href="https://www.cdcxhl.com/xiaochengx.html" title="成都微信小程序开发" target="_blank">小程序开发</a> <a href="https://www.cdcxhl.com/menu.html" title="创新互联网站栏目导航" target="_blank">网站导航</a> </ul> <div class="footer_link_title">网站建设</div> <ul id="frientLinks"> <li><a href="/">四川平武建站</a></li> <li><a href="https://www.cdcxhl.com/menu.html" title="创新互联网站栏目导航" target="_blank">网站导航</a></li> </ul> </div> </div> </div> <div class="span4 col-xm-6 col-xs-12"> <div class="footer_list"> <div class="footer_cotact"> <div class="footer_cotact_title">联系方式</div> <ul> <li><span class="footer_cotact_type">企业:</span><span class="footer_cotact_content">四川绵阳平武网站建设工作室</span></li> <li><span class="footer_cotact_type">地址:</span><span class="footer_cotact_content">成都市青羊区太升南路288号</span></li> <li><span class="footer_cotact_type">电话:</span><span class="footer_cotact_content"><a href="tel:18980820575" class="call">18980820575</a></span></li> <li><span class="footer_cotact_type">网址:</span><span class="footer_cotact_content"><a href="/" title="四川平武网站建设">www.scpingwu.com</a></span></li> </ul> </div> </div> </div> </div> </div> <div class="copyright"> <p>公司名称:四川绵阳平武网站建设工作室 联系电话:18980820575</p> <p><a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow">网站备案号:蜀ICP备2024061352号-3</a></p> <p>四川平武建站 四川平武网站建设 四川平武网站设计 四川平武网站制作 <a href="http://www.cdxwcx.cn/" target="_blank">成都做网站</a></p> </div> </div> </div> </div> </body> </html> <script> $(".technical_support_box_z_info_box 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>