David
David

Reputation: 571

ionic2:can't set <ion-content> background color in variables.scss

in html:

<ion-content class="bg-style">

in variables.scss:

.bg-style {
    background-color: #f5f0eb;
}

the above codes do not work,but it can work in other tags like <a> <div> and so on,and when I put the style file(.scss,such as test.scss) in the same path as the html file,it can work well also.I do not know if my question is clear,thank you for help.

Upvotes: 7

Views: 13001

Answers (3)

George Adrian Echim
George Adrian Echim

Reputation: 115

I would recommend you to override the ionic variables

$background-color: #f5f0eb !default;
$background-ios-color: #f5f0eb !default;
$background-md-color: #f5f0eb !default;

Check this url for more details - link

Upvotes: 6

Mohamed Ali
Mohamed Ali

Reputation: 4015

in the app.scss file add a style

.fixed-content{
    background-color: #f5f0eb;
}

it will apply to all pages, and you don't have to add a class to every ion-content

Upvotes: 2

Sampath
Sampath

Reputation: 65988

use app.scss file instead of variables.scss.

app.scss

  .bg-style {
        background: #f5f0eb;
    }

Upvotes: 8

Related Questions