Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.

Styling local DOM #1185

Description

@ebidel

From @Scratch2k on June 12, 2015 0:4

I've just spent several hours trying to figure out why I couldn't apply a theme to my components with cross scope styling with css variable.

The documentation at: https://www.polymer-project.org/1.0/docs/devguide/styling.html outlines the basics and I followed it to the letter. It just wasn't working. The sample code shows the class definitions using css variables, like so:

   <style>
      .title {
        color: var(--my-toolbar-title-color);
      }
    </style>

and

 <style>
    .title{
      --my-toolbar-title-color: green;
    }
  </style>

and I followed this syntax, it wasn't until I stumbled upon the API reference (http://polymer.github.io/polymer/) which showed the following syntax:

 <style is="custom-style">
    .title{
      --my-toolbar-title-color: green;
    }
  </style>

Then everything magically worked!

Could I recommend the docs be updated with the requirement for <style is="custom-style"> for css variables shim to work?

Copied from original issue: Polymer/polymer#1842

Activity

  1. ebidel commented on Jun 12, 2015

    @ebidel
    ContributorAuthor

    Hey @Scratch2k, the relevant section on that page is Custom element for document styling (custom-style, although it's pretty far down on that doc. The idea is that within and element, polymer takes care of shimming styles in <style>. Outside, you need to tell Polymer what styles to shim using <style is="custom-style">.

  2. Scratch2k commented on Jun 12, 2015

    @Scratch2k

    I see it now, thanks for taking the time to reply Eric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions