• 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.

How can I limit the width of a module that's crossing over from left to right?

Scheduled Pinned Locked Moved Unsolved Troubleshooting
11 Posts 4 Posters 311 Views 4 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.
  • B Offline
    BKeyport Module Developer @Kelemvor
    last edited by Mar 28, 2025, 5:38 AM

    @Kelemvor the answers will lie within the following two CSS items. Using Sam’s link, feel free to play with the CSS then add whatever works to custom.css

    https://www.w3schools.com/cssref/css3_pr_word-wrap.php
    https://www.w3schools.com/cssref/pr_dim_max-width.php

    The "E" in "Javascript" stands for "Easy"

    R 1 Reply Last reply Mar 29, 2025, 2:22 PM Reply Quote 0
    • R Offline
      rkorell @BKeyport
      last edited by Mar 29, 2025, 2:22 PM

      @BKeyport , @Kelemvor
      Thanks!

      max-width: 350px;
      

      worked for me.

      • I had a similar “problem” with module MMM-UselessFacts

      word-wrap doesn’t do the trick …

      Regards,
      Ralf

      S 1 Reply Last reply Mar 29, 2025, 2:26 PM Reply Quote 0
      • S Offline
        sdetweil @rkorell
        last edited by Mar 29, 2025, 2:26 PM

        @rkorell i don’t think there is a single term that works with 100% of content

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        R 1 Reply Last reply Mar 29, 2025, 2:41 PM Reply Quote 0
        • R Offline
          rkorell @sdetweil
          last edited by Mar 29, 2025, 2:41 PM

          @sdetweil yes, for sure.
          I’ve experimented a lot - even with trials to identify CSS-locator with debug-console (which fails)…
          Finally this simple statement in module-documentes CSS-locator works fine…
          :-)
          Lucky punch …

          Ralf

          S 1 Reply Last reply Mar 29, 2025, 2:50 PM Reply Quote 0
          • S Offline
            sdetweil @rkorell
            last edited by Mar 29, 2025, 2:50 PM

            @rkorell said in How can I limit the width of a module that's crossing over from left to right?:

            even with trials to identify CSS-locator with debug-console (which fails)…

            then you aren’t using it correctly…

            if you looked at this
            https://forum.magicmirror.builders/post/125328

            the dev console SHOWS you the selector AND you can copy/paste the html to get the terms in custom.css

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            R 1 Reply Last reply Mar 29, 2025, 9:14 PM Reply Quote 0
            • R Offline
              rkorell @sdetweil
              last edited by rkorell Mar 29, 2025, 9:17 PM Mar 29, 2025, 9:14 PM

              @sdetweil

              then you aren’t using it correctly…

              yes :-)
              For sure.
              But in your given (referenced) example (Thanks for this - highly appreciated!) is happening exacty this “magic” which I cannot get through …

              Example:

              your “magic” reduces

              .CX3 div .cell.today.thisMonth.thisYear.year_2025.month_3.date_25.weekday_2 div.cellHeader div.cellDate {
               height: 1em;
              text-align: left;
              }
              

              to much simpler

              .CX3 div .cell.today div.cellDate {
               height: 1em;
              }
              

              The reason behind is pretty clear but from my (naive and may incorrect) “understanding” MY approach would be

              .CX3 div .cell.today div.cellHeader div.cellDate {
               height: 1em;
              }
              

              And I’m sure this is wrong and won’t work.
              But why “div.cellHeader” is NOT neccesary regardless it’s presence in the copied locator - is kind of “contra-intuitive” and hard to understand …

              And I guess this exactly are these issues why I’m struggling…

              Warm regards,
              Ralf

              S 1 Reply Last reply Mar 29, 2025, 11:22 PM Reply Quote 0
              • S Offline
                sdetweil @rkorell
                last edited by sdetweil Mar 30, 2025, 4:28 AM Mar 29, 2025, 11:22 PM

                @rkorell will explain later
                I use this set of pages to help me understand the css selector clause…
                it used to be one page, now separated into like attributes…
                https://www.w3schools.com/cssref/css_selectors.php

                the html from my example link

                <div class="cell today thisMonth thisYear year_2025 month_3 date_29 weekday_6 weekend weekend_1" data-date="1743231600000" data-events="1" data-has-events="true" id="1743231600000_1743306263377" data-popoverble="true">
                     <div class="cellHeader">
                         <div class="cw">13</div>
                         <div class="cellDate">
                            <span class="dateParts month seq_0">Mar</span>
                            <span class="dateParts literal seq_1"> </span>
                            <span class="dateParts day seq_2">29</span>
                         </div>
                       </div>
                       <div class="cellBody"></div>
                       <div class="cellFooter">
                    </div>
                </div>
                

                now, we want to pick today, and the thing that wraps the date itself.

                css is really pretty straight forward

                left to right match the elements from the selector
                . means class=
                # means id=
                otherwise its an element name (div, table, p, span …)

                so. we want JUST content in the `CX3` class content
                   and then we want the things under `today`
                

                we don’t HAVE to specify the element as long as there are not different elements with the same class… (div and span)

                so
                .CX3 .today

                the space between means ‘also’, with no space it means ‘AND’ (same element has BOTH specified)

                we REALLY want the cellDate class elements, can we get there from today?
                yes,
                the cellHeader element doesn’t matter, cause there is no OTHER location for cellDate, except under cellHeader…

                so if we combine those

                .CX3 .today .cellDate, together they define a specific element family we can ‘select’

                we could add div.today (a div AND .today specified) , but it wouldn’t be more specific. In a calendar month there will only be ONE element with today class AND it only has ONE child element with cellDate, they are not the SAME element, so we need spaces between the selector elements

                css will ALWAYS pick ALL elements that match, across the entire document(page)

                so if we said .CX3 .cellDate we would adjust ALL of them, oops. NOT JUST for the one for today

                we could use .cellDate
                BUT if another module used that same class, then we would fiddle with their css… oops

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                R 1 Reply Last reply Mar 30, 2025, 7:40 AM Reply Quote 0
                • R Offline
                  rkorell @sdetweil
                  last edited by rkorell Mar 30, 2025, 7:40 AM Mar 30, 2025, 7:40 AM

                  @sdetweil Dear Sam,
                  thanks for this long explanation.
                  Understood.

                  But you did it again :-) (no worries - it’s my own inability…).

                  You’ve introduced - magic again :-) - a .today identifier …
                  This definitely makes sens but is not “visible” from a dummie perspective …
                  Just to illustrate what I mean.
                  If one KNOWS what happens (remember our long discussion in another thread where I was not able to pick the right “div” tag in the console) all is quite easy.
                  If not - it’s really hard . That’s all what I try to show…
                  And yes - the right way is and should be to get a full understanding how CSS works - which is not true in my personal case…
                  So I’m seeking around with “trial and error” - which fails often…

                  Thanks for your engagement and effort!

                  Ralf

                  S 1 Reply Last reply Mar 30, 2025, 6:35 PM Reply Quote 0
                  • S Offline
                    sdetweil @rkorell
                    last edited by Mar 30, 2025, 6:35 PM

                    @rkorell i didnt introduce it, in html

                    IMG_0895.png

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • 1
                    • 2
                    • 1 / 2
                    1 / 2
                    • First post
                      7/11
                      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