• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Extreme basic question!

Scheduled Pinned Locked Moved Custom CSS
3 Posts 2 Posters 716 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    chris_d
    last edited by Jan 31, 2023, 8:10 PM

    I’ve written my own module to display a set of family tasks which rotate each week.
    Once I’ve done some javascript to build a string of HTML, I display with.

            var element = document.createElement("div")
            element.className = "myContent
            element.innerHTML = output;
            return element
    
    

    I just want to format this element with an existing magic mirror class so that the text doesn’t look massive and out of place, say “title” for example. But I can’t work out how to actually achieve that.

    S 1 Reply Last reply Jan 31, 2023, 8:34 PM Reply Quote 0
    • S Offline
      sdetweil @chris_d
      last edited by sdetweil Feb 1, 2023, 2:02 PM Jan 31, 2023, 8:34 PM

      @chris_d in custom.css

       .module_name .classname {
         font-size:. ?????
      }
      

      .module_name is your module name
      . classname is .myContent
      fix the missing " in your posted text

      note the dot in front. that means class
      no dot means element name (div, table. li, …)
      # means id

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      S 1 Reply Last reply Feb 1, 2023, 2:06 PM Reply Quote 0
      • S Offline
        sdetweil @sdetweil
        last edited by sdetweil Feb 1, 2023, 2:14 PM Feb 1, 2023, 2:06 PM

        @chris_d

        the string of things before the {

        is called the selector clause.

        this gives u the ability to ‘select’ the html elements you want to apply the styles to

        I use this cheat sheet to view the different choices
        https://www.w3schools.com/cssref/css_selectors.php

        the selector can be very complex

        here is one from my MMM-Config module

        .possibly-hidden-tab div:nth-child(2)  > div > div >div >ul >li:only-child >a[rel*="Item 1"] {
          display: none;
        }
        

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          1/3
          Last post
        Enjoying MagicMirror? Please consider a donation!
        MagicMirror created by Michael Teeuw.
        Forum managed by Sam, technical setup by Karsten.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy