Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 296
David Avatar asked Mar 20 '17 01:03

David


3 Answers

use app.scss file instead of variables.scss.

app.scss

  .bg-style {
        background: #f5f0eb;
    }
like image 145
Sampath Avatar answered Feb 01 '23 08:02

Sampath


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

like image 23
George Adrian Echim Avatar answered Feb 01 '23 08:02

George Adrian Echim


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

like image 26
Mohamed Ali Avatar answered Feb 01 '23 09:02

Mohamed Ali