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.

    Resize custom or main modules

    Scheduled Pinned Locked Moved Development
    24 Posts 6 Posters 39.5k Views 10 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.
    • bokifideB Offline
      bokifide
      last edited by paviro

      Hey,

      I added a bunch of modules to my mirror and I’m finding it hard to pick which ones I want to get rid of to make it all fit… I’m just wondering if there’s a way to change the size of the modules so they don’t take up so much space. :) let me know

      Mich had added the following:

      If you just put the following items in your css/custom.css you can change the font sizes of the mirror by adjusting the values.

      .xsmall {
        font-size: 15px;
        line-height: 20px;
      }
      
      .small {
        font-size: 20px;
        line-height: 25px;
      }
      
      .medium {
        font-size: 30px;
        line-height: 35px;
      }
      
      .large {
        font-size: 65px;
        line-height: 65px;
      }
      
      .xlarge {
        font-size: 75px;
        line-height: 75px;
        letter-spacing: -3px;
      }
      

      But I’m quite new to this… Once you add the values above in css/custom.css how and where do I adjust the values as mentioned above??

      Regards,

      Boki

      Note from Moderator: Please use Markdown on code snippets for easier reading.

      1 Reply Last reply Reply Quote 0
      • KirAsh4K Offline
        KirAsh4 Moderator
        last edited by

        The answer is right there in those numbers. Those numbers represent the size of the fonts, in the various different sections. So if 15px is too large, reduce it to perhaps 10px, then reload your mirror and see what changed and how. The line-height is exactly what it says, the height of two identical lines. What I mean with that is, if there’s a line of text that’s wrapping to a second one, line-height will determine how far apart in vertical space they will be.

        So play with the values, one by one. Don’t try to change it all at once because then it’ll be hard to determine which one changed what.

        A Life? Cool! Where can I download one of those from?

        shreyashS 1 Reply Last reply Reply Quote 0
        • bokifideB Offline
          bokifide
          last edited by

          Hey thanks for the reply!

          I understand that part, what I was wondering is once I actually add those values in custom.css how do I link it to the specific module that I want?

          If its newsfeed lets say, do I change or add something in config.js?
          Or do I change or add something to in the newsfeed.js, that’s in the module’s folder?
          Or do I copy the custom.css file to the folder itself and then somehow make reference to it?

          Simply… what do I do after I add the above value to custom.css to tell it what I want to change

          Sorry for being a newb. 0.o I know this is an obvious answer for most of you.

          Thanks for your help :)

          1 Reply Last reply Reply Quote 0
          • KirAsh4K Offline
            KirAsh4 Moderator
            last edited by KirAsh4

            Those CSS rules will affect all the modules, as all modules use them. If you only want to affect one single module, then you need to change the rules to point to the specific module. Let’s say you want the text smaller on the newsfeed, then you need to look at the actual HTML being created to get the class named being used:

            <div id="module_8_newsfeed" class="module newsfeed newsfeed" style="transition: opacity 1.25s; opacity: 0; position: static;">
              <div class="module-content">
                <div>
                  <div class="light small dimmed">ESPN - Top News, 4 minutes ago:</div>
                  <div class="bright medium light">Georgia RBs Chubb, Michel still iffy for opener</div>
                </div>
              </div>
            </div>
            

            Now you can see that the rules that affect the text, 'light small dimmed' and 'bright medium light' are all contained within the main class 'module newsfeed newsfeed' (on the very first line.)

            Using a bit of CSS juju, doing this:

            .newsfeed .medium {
              font-size: 18px;
            }
            

            … will make the text of the article headline smaller than the default '30px'. And this will only affect the newsfeed module. All the others also using the 'medium' rule will be unaffected.

            A Life? Cool! Where can I download one of those from?

            D 1 Reply Last reply Reply Quote 0
            • bokifideB Offline
              bokifide
              last edited by

              Awesome! Thanks for explaining that :) I’ll give it a try now.

              1 Reply Last reply Reply Quote 0
              • bokifideB Offline
                bokifide
                last edited by

                Hey so I was testing out the custom.css values to see how it affects the magic mirror and I’m not getting any difference for some reason =/.

                Before
                alt text

                The change (changed the px values to be way lower than what was shown in the original paste above)
                alt text

                After the above change
                alt text

                I was hoping changing those values would mean that I could make it look clean enough to not change the size of specific modules, but I seem to still be missing something :( .

                Regards,
                Boki

                1 Reply Last reply Reply Quote 0
                • KirAsh4K Offline
                  KirAsh4 Moderator
                  last edited by

                  '.small' affects the calendar, weather forecast modules, and newsfeed sourceTitle
                  '.medium' affects the date (only), current weather EXCEPT the temperature display, newsfeed article title
                  '.large' affects the time display and temperature from current weather

                  I’m sure there are others I’ve missed.

                  Those are all 'master' rules, affecting all those modules. If you want to only change a specific module, you have to follow the steps I mentioned above.

                  A Life? Cool! Where can I download one of those from?

                  1 Reply Last reply Reply Quote 0
                  • zombi27Z Offline
                    zombi27
                    last edited by

                    I know it!

                    Tried the same yesterday, and found a “bug” :)
                    You inserted your code inside the body { } section (like i did), wich is not working…
                    Just erase the body { } from the custom.css and paste the code in the empty file :)

                    @MichMich, @KirAsh4: Is the body { } section a leftover from an older version maybe?

                    MichMichM 1 Reply Last reply Reply Quote 0
                    • MichMichM Offline
                      MichMich @zombi27
                      last edited by

                      @zombi27 Nope, it’s an example to show where your CSS must go … ;)

                      I think there is a limit in how far we should spoon feed the users. ;)

                      1 Reply Last reply Reply Quote 0
                      • zombi27Z Offline
                        zombi27
                        last edited by

                        okay :D The body section confused me too, so maybe it’s better to keep it empty? just a comment “place css code here?”

                        i could send a pull request? would be my first one :D or how could this be done? totally new to github…

                        1 Reply Last reply Reply Quote 0
                        • bokifideB Offline
                          bokifide
                          last edited by bokifide

                          ahh… See I was thinking it was a bug as well, I don’t know much about CSS or programming in general, but I’m glad you clarified that part @zombi27 . I had just gone directly to the main.css to modify the values since I couldn’t get the dashboard to reflect the custom.css values :). I’ll give it a try once I get home.

                          Thanks for the help and direction @KirAsh4 @MichMich @zombi27

                          Boki

                          1 Reply Last reply Reply Quote 0
                          • KirAsh4K Offline
                            KirAsh4 Moderator
                            last edited by

                            Yep, that body { ... } rule is just there as an example. A quick search on 'css example' on Google would’ve shown you oodles of examples on syntax, almost to a fault.

                            A Life? Cool! Where can I download one of those from?

                            1 Reply Last reply Reply Quote 0
                            • MichMichM Offline
                              MichMich
                              last edited by

                              The problem if we change that file now (with an explanation text), it would overwrite files from users who modified it if they update …

                              zombi27Z 1 Reply Last reply Reply Quote 0
                              • zombi27Z Offline
                                zombi27 @MichMich
                                last edited by

                                @MichMich: ah, okay ^^ that wouldn’t be nice :D

                                1 Reply Last reply Reply Quote 0
                                • bokifideB Offline
                                  bokifide
                                  last edited by bokifide

                                  @KirAsh4 uses cast shadow on bokifide…
                                  … It’s super effective! :sweat:

                                  haha :D . I guess it just wasn’t as common sense to me, in my mind I had no reason to doubt whether or not a portion of the sample given to me by the magic mirror gods had to be there. :pensive: But you’re 100% right, I should have googled it, because you never know :) that portion could serve another purpose like @MichMich pointed out.

                                  Lesson learned. Won’t happen again.

                                  Thank you for your time fellows :bow_tone1:
                                  Boki

                                  1 Reply Last reply Reply Quote 1
                                  • D Offline
                                    daveyg_71 @KirAsh4
                                    last edited by

                                    @KirAsh4 said in Resize custom or main modules:

                                    Those CSS rules will affect all the modules, as all modules use them. If you only want to affect one single module, then you need to change the rules to point to the specific module. Let’s say you want the text smaller on the newsfeed, then you need to look at the actual HTML being created to get the class named being used:

                                    <div id="module_8_newsfeed" class="module newsfeed newsfeed" style="transition: opacity 1.25s; opacity: 0; position: static;">
                                      <div class="module-content">
                                        <div>
                                          <div class="light small dimmed">ESPN - Top News, 4 minutes ago:</div>
                                          <div class="bright medium light">Georgia RBs Chubb, Michel still iffy for opener</div>
                                        </div>
                                      </div>
                                    </div>
                                    

                                    Now you can see that the rules that affect the text, 'light small dimmed' and 'bright medium light' are all contained within the main class 'module newsfeed newsfeed' (on the very first line.)

                                    Using a bit of CSS juju, doing this:

                                    .newsfeed .medium {
                                      font-size: 18px;
                                    }
                                    

                                    … will make the text of the article headline smaller than the default '30px'. And this will only affect the newsfeed module. All the others also using the 'medium' rule will be unaffected.

                                    Where can I find the HTML file that is being created?

                                    The only HTML file I see is at ~/MagicMirror/index.html

                                    This file looks nothing like the example shown here.

                                    cowboysdudeC strawberry 3.141S 2 Replies Last reply Reply Quote 0
                                    • cowboysdudeC Offline
                                      cowboysdude Module Developer @daveyg_71
                                      last edited by cowboysdude

                                      @daveyg_71 put these in the css directory - custom.css file…

                                      I would never suggest changing ANY core css file because it could have well not good results then you’ll be trying to fix several problems.

                                      That’s what the custom.css file is for ;)

                                      Not sure if you know but modules are numbered like the example above:
                                      module_8_newsfeed

                                      There is another thread here that explains all that :)
                                      Here’s one and it even has an example custom.css file attached:
                                      check here!

                                      D 1 Reply Last reply Reply Quote 0
                                      • strawberry 3.141S Offline
                                        strawberry 3.141 Project Sponsor Module Developer @daveyg_71
                                        last edited by

                                        @daveyg_71 there is only the index.html file, the rest of the DOM will be created during runtime with js. so if you want to manipulate the design with custom.css but you’re not sure about the structure, start the mirror in dev mode npm start dev or with ctrl+alt+i then you can inspect the DOM in tab elements or view the mirror in your browser and open developer tools

                                        Please create a github issue if you need help, so I can keep track

                                        D 1 Reply Last reply Reply Quote 0
                                        • D Offline
                                          daveyg_71 @cowboysdude
                                          last edited by

                                          @cowboysdude I wasn’t planning on changing the any core css files. Wanted to look at it so I could find the module information like the earlier post then change the custom.css

                                          1 Reply Last reply Reply Quote 0
                                          • D Offline
                                            daveyg_71 @strawberry 3.141
                                            last edited by

                                            @strawberry-3.141 I was able to view the inspect the html with crtl+shift+I.

                                            my problem is it doesn’t look like the example above.

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              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