爱秀代码's Archiver

麻城生活网 发表于 2018-9-9 15:10

求助如何实现背景图贴在自己的论坛纵横平铺

[i=s] 本帖最后由 麻城生活网 于 2018-9-9 16:43 编辑 [/i]

[attach]337[/attach]

如何把上图背景直接用在自己的论坛背景上纵横平铺,头部代码不行,会覆盖免刷新切换论坛背景导致失效。

麻城生活网 发表于 2018-9-9 15:47

我用了两组代码来实现的,各位站长能不能电脑端帮我测试一下宽屏的效果,我这边笔记本
css_append[code]html,body {background: url("http://mc0713.66rt.com/attachments/day_180908/18090812491ae2e5e05c9f70c9.jpg") repeat-x 0 0;text-align: center;}[/code]其他头部[code]<style>body,html{background-attachment:fixed!important;}</style>[/code]

麻城生活网 发表于 2018-9-9 15:54

360测试其他风格背景有一点点瑕疵,用火狐就不行了,谁有ie浏览器帮我测试一下!!!

icode 发表于 2018-9-9 16:03

加上[code]background-size:cover[/code]就可以了

比如[code].red {
    background: #FCFAF0 url(http://icode.258club.com/attachments/month_1809/1809091….jpg) no-repeat 50% 0;
    background-size: cover;
}[/code]

麻城生活网 发表于 2018-9-9 16:10

[b]回复 [url=http://icode.258club.com/redirect.php?goto=findpost&pid=756&ptid=93]4#[/url] [i]icode[/i] [/b]


    我去试试!!!感谢哈

麻城生活网 发表于 2018-9-9 16:17

[b]回复 [url=http://icode.258club.com/redirect.php?goto=findpost&pid=756&ptid=93]4#[/url] [i]icode[/i] [/b]


    这个代码加到各个颜色背景里不行了,背景直接乱了

icode 发表于 2018-9-9 16:26

[b]回复 [url=http://icode.258club.com/redirect.php?goto=findpost&pid=758&ptid=93]6#[/url] [i]麻城生活网[/i] [/b]


    你的common模版里不是有风格切换的css么?[code].default{background: #96C9FE url(http://mc0713.66rt.com/attachments/day_180908/18090812491ae2e5e05c9f70c9.jpg) repeat-x 20 0;}
.red{background: #FCFAF0  url(http://mc0713.66rt.com/attachments/day_180907/18090717025e9e049a0ad8b500.jpg) no-repeat 50% 0;}
.orange{background: #FCFAF0 url(http://mc0713.66rt.com/attachments/day_180907/1809071702fe7bd1b1850b49fc.jpg) no-repeat 50% 0;}
.blue{background: #FFFFFF url(http://mc0713.66rt.com/attachments/day_180907/1809071701f2e2a134107b9eac.jpg) no-repeat 50% 0 fixed;text-align: center;}
.green{background: #FFF url(http://mc0713.66rt.com/attachments/day_180907/1809071701e445e03aea373f3f.jpg) no-repeat 50% 0;}
.purple{background: #FFF url(http://mc0713.66rt.com/attachments/day_180907/1809071701be6e117566216898.jpg) no-repeat 50% 24px;}[/code]你把默认风格那个改成[code].default{background: #96C9FE url(http://mc0713.66rt.com/attachments/day_180908/18090812491ae2e5e05c9f70c9.jpg) no-repeat 50% 0; background-size: cover;}[/code]

麻城生活网 发表于 2018-9-9 16:26

[b]回复 [url=http://icode.258club.com/redirect.php?goto=findpost&pid=756&ptid=93]4#[/url] [i]icode[/i] [/b][code]/* ~~~~~~~~~~~~~~~~~~~~ 风格切换~~~~~~~~~~~~~~~~~~~~ */
#set_style_menu{padding: 6px 10px 10px;}
.sslct_btn i {float: left;display: inline;margin: 1px;width: 10px;height: 10px;background: #2E80D1;overflow: hidden;font-style: normal;}
#set_style_menu li {float: left;margin: 4px 4px 0 0;width: 12px;height: 12px;border: 1px solid #CDCDCD;cursor: pointer;list-style: none;}
#set_style_menu li i {float: left;display: inline;margin: 1px;width: 10px;height: 10px;background: #2E80D1;overflow: hidden;font-style: normal;}
.default{background: #96C9FE url(http://mc0713.66rt.com/attachments/day_180908/18090812491ae2e5e05c9f70c9.jpg) repeat-x 20 0;}
.red{background: #FCFAF0  url(http://mc0713.66rt.com/attachments/day_180907/18090717025e9e049a0ad8b500.jpg) no-repeat 50% 0;
background-size: cover;
}
.orange{background: #FCFAF0 url(http://mc0713.66rt.com/attachments/day_180907/1809071702fe7bd1b1850b49fc.jpg) no-repeat 50% 0;
background-size: cover;
}
.blue{background: #FFFFFF url(http://mc0713.66rt.com/attachments/day_180907/1809071701f2e2a134107b9eac.jpg) no-repeat 50% 0 fixed;text-align: center;
background-size: cover;
}
.green{background: #FFF url(http://mc0713.66rt.com/attachments/day_180907/1809071701e445e03aea373f3f.jpg) no-repeat 50% 0;
background-size: cover;
}
.purple{background: #FFF url(http://mc0713.66rt.com/attachments/day_180907/1809071701be6e117566216898.jpg) no-repeat 50% 24px;
background-size: cover;
}
#toptb {
    border-bottom: 1px solid #CDCDCD;
    background: #F2F2F2;
    line-height: 0px;
    margin-top: -5px;
    height: 22px;
}
.zsc a{float: left;padding: 0 4px;height: 28px;color:#333 ;}[/code]

icode 发表于 2018-9-9 16:27

还有,css_append模版里[code]html,body {background: url("http://mc0713.66rt.com/attachments/day_180908/18090812491ae2e5e05c9f70c9.jpg") repeat-x 0 0;text-align: center;}[/code]删了吧

麻城生活网 发表于 2018-9-9 16:29

[b]回复 [url=http://icode.258club.com/redirect.php?goto=findpost&pid=761&ptid=93]9#[/url] [i]icode[/i] [/b]


    我想达到的效果是默认风格就用1楼的背景,其他的颜色背景保持不变

麻城生活网 发表于 2018-9-9 16:30

[b]回复 [url=http://icode.258club.com/redirect.php?goto=findpost&pid=759&ptid=93]7#[/url] [i]icode[/i] [/b]


    刚加上去的

icode 发表于 2018-9-9 16:37

默认背景的写法错了要改成[code].default{background: #96C9FE url(http://mc0713.66rt.com/attachments/day_180908/18090812491ae2e5e05c9f70c9.jpg) no-repeat 50% 0; background-size: cover;}
[/code]

麻城生活网 发表于 2018-9-9 16:40

[b]回复 [url=http://icode.258club.com/redirect.php?goto=findpost&pid=764&ptid=93]12#[/url] [i]icode[/i] [/b]


    应该好了吧,谢谢无界兄的热心帮助!!!!

麻城生活网 发表于 2018-9-9 16:42

[b]回复 [url=http://icode.258club.com/redirect.php?goto=findpost&pid=764&ptid=93]12#[/url] [i]icode[/i] [/b]


    恩,之前我的默认背景图与主题表格有出入我自己瞎改的,谁知道蒙对了!!!!:lol

麻城生活网 发表于 2018-9-9 21:07

[b]回复 [url=http://icode.258club.com/redirect.php?goto=findpost&pid=766&ptid=93]14#[/url] [i]麻城生活网[/i] [/b]


    精华帖子好像调用的不对,你给看看哪里出问题了?

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.