custom css not being used

Created on 17 June 2023, over 1 year ago
Updated 27 June 2024, 6 months ago

I've used the steps to create custom color css from w3 and added it to my subtheme. I used #550406 the color of their site. I put the generated code in styles.css in the subtheme that did not work so I put it in the d8w3css-subtheme-style.css also. That did not work either.

The site address is site link

The code added is:

.w3-theme-l5 {color:#000 !important; background-color:#fee7e7 !important}
.w3-theme-l4 {color:#000 !important; background-color:#fbaeaf !important}
.w3-theme-l3 {color:#fff !important; background-color:#f75d60 !important}
.w3-theme-l2 {color:#fff !important; background-color:#f40c10 !important}
.w3-theme-l1 {color:#fff !important; background-color:#a4080a !important}
.w3-theme-d1 {color:#fff !important; background-color:#4b0405 !important}
.w3-theme-d2 {color:#fff !important; background-color:#420304 !important}
.w3-theme-d3 {color:#fff !important; background-color:#3a0304 !important}
.w3-theme-d4 {color:#fff !important; background-color:#320203 !important}
.w3-theme-d5 {color:#fff !important; background-color:#290203 !important}

.w3-theme-light {color:#000 !important; background-color:#fee7e7 !important}
.w3-theme-dark {color:#fff !important; background-color:#290203 !important}
.w3-theme-action {color:#fff !important; background-color:#290203 !important}

.w3-theme {color:#fff !important; background-color:#550406 !important}
.w3-text-theme {color:#550406 !important}
.w3-border-theme {border-color:#550406 !important}

.w3-hover-theme:hover {color:#fff !important; background-color:#550406 !important}
.w3-hover-text-theme:hover {color:#550406 !important}
.w3-hover-border-theme:hover {border-color:#550406 !important}

I realize this is my error I'm just not sure where it is. I've modified the subtheme libraries.yml to include styles.css

Any input is appreciated as we will need to customize colors outside of pre-defined colors for several of our sites.

Thank you in advance, Mark

💬 Support request
Status

Fixed

Version

2.0

Component

Miscellaneous

Created by

🇺🇸United States markfien

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @markfien
  • 🇮🇳India Kaustab_Roy

    hi @markfieni have tested it , the subtheme works for me.
    (screenshot attached - pink color is from subtheme css )

    what i have done:
    installed the theme -> enabled the subtheme ( Drupal8 W3CSS Sub-theme (default theme) )
    -> added styles inside (d8w3css-subtheme-style.css)

    Let me know if u have taken any other steps.

  • 🇺🇸United States markfien

    That is exactly what I have. Code above is in subtheme css file at bottom. So how do I get it to see, for example, w3-level-5. I tried putting it in heading no go. There is no way I can find to put it in predefined. Thanks

  • Assigned to flashwebcenter
  • Status changed to Fixed over 1 year ago
  • 🇺🇸United States flashwebcenter Austin TX

    Hello,
    To create a custom css color, you should use it with the blue print for the theme's region.
    https://www.drupal.org/files/project-images/drupal8-w3css-theme-color-guidance-1.jpg → .
    On the image each region has its own css class in yellow/orange
    Example: Header region has w3-theme-l4, Highlighted region has w3-theme-l2
    To use more classes, you will have to copy the page.twig.html and add css class for each region, or you can use the id/class for any region.
    Example:

    #header {color:#fff !important; background-color:#f40c10 !important}
    #page-title {color:#fff !important; background-color:#a4080a !important}
    

    I attached a sub-theme → and I tested it on my local.

    Best wishes,
    Alaa

  • 🇺🇸United States markfien

    Alaa,

    Thank you for the subtheme. I have installed it on the site and am having the same issue. It seems the css color codes (e.g. w3-theme, w3-theme-l5, etc.) do not override the default theme. How do I accomplish this and what am I missing? I'm sure it is something simple I have overlooked.

    The site address is site link if you can take a look. I'm happy to provide a login if necessary.

    TIA, Mark

  • 🇺🇸United States flashwebcenter Austin TX

    Mark,
    The sub-theme is working on my local. I inspect the site and I see five regions with the css classes. Header has w3-theme-l4, main-navigation-h has w3-theme, etc. If you define these classes in the css they should be working. Something is not right on the site. Feel free to contact me so I can take a look.

    Best wishes,
    Aaa

  • 🇺🇸United States markfien

    Alaa,
    I see the regions in view source.
    The thing I find strange is in view source on the main page the custom css is pointing to:
    link rel="stylesheet" media="all" href="/themes/custom/markfien/css/d8w3css-subtheme-style.css?rwtm0z" /
    and not to markfien-style.css.
    So I duplicated markfien-style.css as d8w3css-subtheme-style.css and that too fails.
    If I follow the link above for d8w3css-subtheme-style.css in view source it opens a file which shows:
    /* Add your css code here */
    then blank - I'm not sure where this is coming from or pointing to since no files in the subtheme have this text.
    The site address, if you could take a look I'd appreciate it, is: https://twpunion-d9.schoolboard.net/
    Many thanks, Mark

  • 🇺🇸United States flashwebcenter Austin TX

    Mark,

    You will need to login into the server and search for any duplicate files and check the markfien.libraries.yml file has the correct css files.
    Best wishes,
    Alaa

  • 🇺🇸United States markfien

    Alaa,
    I'm wondering if my issue is the fact that we are doing multi-site installation on Drupal. So we have one Drupal 9 codebase and the sites are under it. So our path to a site would be master/web/sites/sitename/files/themes/custom/markfien/css (using your example). In multi-site the custom css does not respond for the site.

    If I install your markfien.css in a stand-alone site I see the custom css and it does function. That is why I'm wondering if there is something else I must do for multi-site.

    Thank you in advance, Mark

  • 🇺🇸United States flashwebcenter Austin TX

    Hello Mark
    "So our path to a site would be master/web/sites/sitename/files/themes/custom/markfien/css (using your example)." Not my example there. https://www.drupal.org/project/d8w3css/issues/3301227 →

    My example:
    web/themes/contrib/* It will have all the contrib themes for all sites.
    web/themes/custom/* It will have all the custom themes for all sites.

    web/modules/contrib/* It will have all the contrib modules for all sites.
    web/modules/custom/* It will have all the custom modules for all sites.

    There is no need to add a custom theme there "master/web/sites/sitename/files/themes/custom/markfien".
    I would not put anything in files, or under sties. I would keep all custom themes or modules in one location and build a sub-theme for each site(with its own css file).

    Example (for a 3-site scenario): I will create a sub-theme (markfien) and the base theme will be drupal8_w3css_theme. In this sub-theme I will add all the global styles for all the 3 sites. Then I will create three sub-themes (siteone_sub_theme, sitetwo_sub_theme, and sitethree_sub_theme) and the base theme will be markfien.
    Using this method will give you the flexibility to add global styles for all 3 sites at once or target each individual site.

    Best wishes,
    Alaa

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 6 months ago
  • 🇺🇸United States flashwebcenter Austin TX
Production build 0.71.5 2024