This works fine when displayed on its own. The major issue here is when toggle blocks are used under lists(numbered or bullet). The toggle blocks overflow and cannot be scrolled into view.
This bug occurs across all screen sizes.
See samples of the same bug on other screen sizes.
Mobile(Iphone XR)
Tablet(Ipad Air)
How to fix the bug?
Since toggle-blocks work fine on their own i.e. not within a list. I figured that its the indent of the list that’s affecting the toggle block.
This CSS was applied to all numbered lists.Read Full Debug Story
But when I adjust the max-width solely based on the padding mentioned above, we get this result:
The text still overflows within the toggle block.
So, I include one more subtraction, producing this result:
Now, there’s no more overflow.
Wondering why I chose 17%?
Of course, it’s not random.
I was wondering where the extra padding on the sides of the list came from. I eventually found a width of 84% had been applied to the page via .blog-main.
For this reason, I chose to remove 16%(100-84) and an extra 1%(clearance) from the max-width calculation. Here’s the current CSS code:
The additional 1.2em is in consideration of the padding-inline-start of 1.6em. When I tried to use 1.6em, it appeared a bit much in some cases, 1.2em seems to work fine on all screen sizes below 768px.
The result:
Overkill I know, but this proves just how responsive it has now become. (768px → 245px)
Screen sizes above 768 px?
I’m sure many of us, “CSS-ers” can relate to this particular story.
While trying to tweak the max-width for larger screens, I calculated for various factors:
Brown sections: This was about 16% of the page width, due to the 84% width of .blog-main mentioned earlier.
Left Blue section: A grid template column of 1fr 3fr was applied to section the table of contents and main text body. That accounts for 25% of …
Then I realised 🤔 … I can’t do max-width: calc(100vw - 16% - 25%...The 25% doesn’t apply to the full page width, but the inner container.
Then I just randomly tried this. I got the idea from the fact that normal toggle blocks (not within a list) look fine (they had a max-width of 100%).
.notion-text, .blog_page_content .notion-text, .notion-list-numbered, .notion-list li {
max-width: 100%;
}
To my greatest surprise 🤯, this even simpler piece of code fixes the issue for all screen sizes(mobile, tablet, pc). Honestly, I initially had no idea why this works, but as they say - If it works, don’t change it.
After a bit of digging, I discovered a few things:
There’s a lot of containing divs for the page with their width or max-width in percentages.
Then finally the main page has a fixed max-width depending on the screen size.
So, I imagine my fix works because it restricts the width of the text and list blocks to 100% of the available width, instead of allowing overflow.
View final CSS fix
.notion-text, .blog_page_content .notion-text, .notion-list-numbered, .notion-list li {
max-width: 100%;
}
Advanced - Video embedded under Toggle Block
Bug: Embedded YouTube videos didn't display under toggle blocks.
The main cause of the bug was this piece of CSS:
.notion-toggle .notion-asset-wrapper-video div {
height: fit-content !important;
}
or so I thought…Read Full Story
.notion-toggle .notion-asset-wrapper-video div {
height: fit-content !important;
}
If you inspect the <iframe/>, you would see that it has a height of 0, so the height property applied to the containing div has nothing to fit inside it.
But magically— if I disable height property, the video appears ✨.
Well it worked there, but look at this:
Can you figure out what’s wrong and the correct fix?
See Answer
Well, the <div> element has a fixed height this time.
So I disabled it and…
Well, where’d the video go? 👀
Turns out that height property was actually important. So, what do u think is the fix here?
1. Apply a new height property (there’s no classes directly applied on our target div)
.notion-toggle .notion-asset-wrapper-video div {
height: 0px !important;
}
This does 2 things:
It ensures that any height property used in the <style> tag is overridden.
Effectively wipes out the videos anyway 😆.
So, can you figure out the solution yourself now? 😏
2. Magic ingredient?
In the final image from step 1, you’d observe something odd, the first toggle block seems to have some height despite the absence of the video.
Do you know why?
Well, you can see the two CSS lines cancelled out below are the culprits.
Does that give an idea of a possible solution?
Well the solution is quite simple. We need to apply these properties to all divs that are children of .notion-toggle .notion-asset-wrapper-video.
.notion-toggle .notion-asset-wrapper-video div {
height: 0px !important;
padding-bottom: 50%;
}
Why this works?
We don’t know the height of the video, but the width is usually fixed and padding-bottom applies its percentages in terms of the width of the containing block.
You can see that the iframe element has a width here despite being empty:
Aren’t you wondering why this didn’t work here:
I mean there’s a padding-bottom property applied to the div element, although it’s in a style tag. height: 0 !important is equally applied.
So why doesn’t the video display?
To answer this, I’d like you to compare the screenshot above to this below:
Observe anything?
Yes, you got it! The inner div still had 0 height as it had a padding-bottom of 0.
So, all we have to do is apply padding-bottom: 50% to this div too. That’s why the recommended fix works perfectly. It effectively solves the issue with just two lines of CSS.
Skip to Final & Recommended Fix at this point
.notion-toggle .notion-asset-wrapper-video div {
height: 0px !important;
padding-bottom: 50%;
}
Note: As of writing, this has only been tested for the case where a landscape(2:1) YouTube video is embedded under a Toggle Block. See sample.
A Twist?
After doing all that, I go ahead and upload this video, and then…
Well, fixing this turned out to be quite easy. I had initially thought there were no CSS classes to target embedded youtube videos with CSS.
Note: Advanced Image Attribute will bug out your image if you already added a link directly on the image. See how to add a link to the image below 👇🏾.
Alternative Means
You can actually achieve a very similar result right inside Notion that looks pretty good and is much easier to execute.
✅ This works.
Adding Links
Hover on the image(in the notion page)
Click on more actions
Click on Add link
Adding Alt Text
Hover on the image(in the notion page)
Click on more actions
Click on Alt text
See Visual Guide
To add caption, follow the same process as outlined above.
For width and height, its best to simply resize the image in Notion.
Personally, I think those are all you need but for more fine-grained control, you would have to use custom CSS to target the image.
Italics - fonts
The major issue here is that italic font type isn’t included when you apply font family from the Bullet dashboard. The solution was to include Google font link in the head(in the bullet dashboard).
Here’s the code for my favorite fonts — Poppins and Salsa font families.
I was quite surprised, but some of my favorite VScode shortcuts work in the CSS code editor window. Here’s some that I found that work so far:
CTRL + F – Quickly search for specific code. Super useful when you need to locate something fast.
ALT + Up/Down Arrow Keys – Move the current line (or selected lines) up or down. Perfect for rearranging content easily.
SHIFT + Up/Down Arrow Keys – Highlight one line at a time, allowing you to select text incrementally using the arrow keys.
Other Bugs
There were some bugs I couldn’t find a fix for:
We can uncheck Publish for blog posts. It doesn’t show up on the Blog page, but the articles still appears on the home page. I’m unable to open the post from there but it does look odd.
Mobile Responsiveness
The site looks terrible on mobile devices, so I had to apply a lot of CSS to get it close enough to my liking. So this might be a bit subjective, but it should definitely give you a head start and help you find most of the pain points quicker.
I will update this section soon. If you enjoyed my article, I can keep you posted on future updates via any of these:
Subscribe to the newsletter(Be my first subscriber🤭) or