Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Theme Inheritance - background color of all the pages

theme

Solved by pamtbaau View solution

Started by thgr 6 years ago · 4 replies · 1431 views
6 years ago

Hello,

I duplicate the quark theme to have "mytheme" like explain in the documentation :
Theme Inheritance > Inheriting manually

Now I would like to change the background color of all the pages of the site.

What is the easier way to do this ?
Is it in user/theme/mytheme/css/custum.css file ?

I have tried :

background-color:#CCBBBB;
background:#CCBBBB;

but only the background-color of the text have changed.

Thank's

6 years ago

@thgr, A theme (and installed plugins) may have several elements for which the background-color is set and needs to be altered with your own preferred colour. A few of these elements are #head for the header, .card for the list of items in a blog, etc.

In '/user/themes/mytheme/css/custom.css' try the following:

CSS
body, #header, .card {
  background-color: #CCBBBB;
}

You will have to explore your site and for each element you wish to change the background of, you need to find out the selector (id, class, element) and add that to the list.

You can find the selector of an element by right clicking the element and open the developer tools of the browser ('Inspect' in Chrome).

6 years ago

Hello,

Thank's for the answer !
I succed for all the page but not for a small part in the header and footer

header

TXT
    <section class="container ">
        <nav class="navbar">
            <section class="navbar-section logo">
                <a href="/" class="navbar-brand mr-10">

<svg xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" viewBox="0 0 504 140" clip-rule="evenodd">...</section>
<section class="navbar-section desktop-menu">

footer

<section id="footer" class="section bg-gray">
<section class="container ">
<p><a href="http://getgrav.org">Grav</a> was <i class="fa fa-code"></i> with <i class="fa fa-heart-o pulse "></i> by <a href="https://trilby.media">Trilby Media</a>.</p>
</section>
</section><section id="header" class="section">

custom.css

CSS
body, start, header, footer, p, section
{
  background-color: #CCBBBB;
}

If someone have an idea...

Thank's

6 years ago Solution

@thgr, I would suggest to read some docs on css selectors.

In HTML you may have for example:

  • <body>...</body>
  • <div class="card">...</div>
  • <div id="header">...</div>

In css they are referred as:

  • Type selector:   body { ... }
  • ID selector:       #header { ... }         -> don't forget the # (hash)
  • Class selector:  .card { ... }             -> don't forget the . (dot)

See my first reply and note the #header and .card

6 years ago

Thank's again !
so the solution for me is

CSS
body, #header, .card  {
  background-color: #CCBBBB;
}

.bg-gray {
  background: #CCBBBB !important;
}
👍 1
last edited 07/18/20 by pamtbaau

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by Pedro M, 2 months ago
4 193 2 months ago
Themes & Styling · by Ian, 2 months ago
3 91 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 451 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 45 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 125 3 months ago