可以使用引导来改变背景颜色 [英] is possible to change background color using bootstrap

查看:166
本文介绍了可以使用引导来改变背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是引导,而目前整个页面是白色背景为默认。我在想,如果可以改变背景颜色引导下使用移动时为灰色!像级=COL-SM-6COL-XS-6...

I'm using bootstrap, and currently full page is white background as default. I was wondering if that possible to change background color to gray when using mobile under bootstrap! like "class="col-sm-6" col-xs-6"...

确实可以如何编写code jQuery中自动改变背景颜色为灰色的颜色来时使用手机,如果用台式变化逗留背景颜色为白色为默认值。

does is possible how to write that code in jquery to automatic to change background color to gray color when come to use mobile and if using desktop change stay background color to white as default.

推荐答案

这是绝对有可能的,但不要求你使用jQuery的。在一个CSS文件,只需添加一个背景属性,这些类 - 它可能看起来像下面这样:

This is definitely possible, but doesn't require you to use jQuery at all. In a CSS file, simply add a background attribute to those classes - it might look something like the following:

.col-xs-1, .col-xs-2, .col-xs-3,
.col-xs-4, .col-xs-5, .col-xs-6,
.col-xs-7, .col-xs-8, .col-xs-9,
.col-xs-10, .col-xs-11, .col-xs-12 {
    background: #999;
}

.col-sm-1, .col-sm-2, .col-sm-3,
.col-sm-4, .col-sm-5, .col-sm-6,
.col-sm-7, .col-sm-8, .col-sm-9,
.col-sm-10, .col-sm-11, .col-sm-12 {
    background: #fff;
}

另外,你可以使用媒体查询来改变身体的背景在特定的大小。例如,为了使身体灰色,只有当小屏幕,你可以使用:

Alternatively, you could use media queries to change the body background at certain sizes. For example, to make the body gray only when the screen in small, you could use:

body {
    background: #fff;
}

@media all and (max-width: 768px) {
    body {
        background: #999;
    }
}

这篇关于可以使用引导来改变背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆