Get help from the marimo community

Updated 4 weeks ago

centered vs left aligned text

I'm using mo.md to add text to my notebook. Is there a way to control the alignment? It seemed like it was automatically centered earlier, but now it's left aligned.
M
M
18 comments
when width is maxed out (full) we default the heading to the left side as we think it looks better for super wide screens (keeps content together)
you can do mo.md().left() , mo.md().right(), mo.md().center()
all UI elements should have left/right/center too
This worked, thank you very much!
Actually, maybe not? It's working on desktop but not mobile.
what about on desktop if you squish the screen
this also most the content left/right/middle, but doesnt change the text to by "aligned" left/right/middle per https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
you could maybe use styles, mo.md().center()style({"text-align": "center"})
Can you only style one line at a time? The text is two different lines, and it worked on the second one but not the first.
Attachment
IMG_1468.png
I split it out into two different cells and it seems like .style() still doesn't do it for the header.
Yea - I think we wrap those in too many elements. You might want to do “<h1 style=“text-align:center”> header… “
am I not doing this right? this definitely isn't H1
Attachment
image.png
Try mo.md?

I don’t think we style any HTML by default. It all gets reset
Off topic: but it’s generally common to “reset” all defaults of html elements since they are different cross-browser. We may only style markdown and not plain html (that is left as-is)
this is what I have now and it still doesn't center on mobile
Attachment
image.png
Sorry, it’s text-align:center
I had an original typo
That did it, I should've noticed that. As always, thank you!
Add a reply
Sign up and join the conversation on Discord