thomasloven / lovelace-card-mod

🔹 Add CSS styles to (almost) any lovelace card
MIT License
1.06k stars 169 forks source link

Browser variable #260

Open dimmanramone opened 1 year ago

dimmanramone commented 1 year ago

My Home Assistant version: 2023.3.1

My lovelace configuration method (GUI or yaml): YAML

What I am doing: Use browser variable in a jinja2 template to have different css per device

What I expected to happen: When browsing from the the device with deviceID pixel7-app to have top: 2px;

What happened instead: Continues to the else statement

Not really sure that I'm using it right but it works for example with the user variable.

card_mod:
  style: |
    :host {
      z-index: 999;
      position: sticky;
      position: -webkit-sticky;
      {% if browser == 'pixel7-app' %}
        top: 2px;
      {% else %}
        top: var(--header-height); 
      {% endif %}
    }
thomasloven commented 6 months ago

Cannot reproduce.

You can check your browser_id with e.g.

ha-card::after { content: "{{browser}}";}