Bullet CSS Bugs & Fixes

Oct 3, 2024
Bullet CSS Bugs & Fixes

TLDR;

CSS Fixes
  • Fix for overflowing toggle blocks: Set max-width to 100% for text and list elements.
  • Fix for video embedding issues in toggle blocks: Apply height: 0 and padding-bottom: 50% to video wrapper divs.
Styling Enhancements
  • Custom CSS for blog tags allows setting different background colors.
  • Include Google Font links in the head to properly display italic fonts.
Mobile Responsiveness
  • More CSS applied to improve mobile appearance; further updates planned.
Additional Tips & Notes
  • VSCode shortcuts like CTRL+F and ALT+Up/Down work in the CSS code editor.
  • Some bugs remain unfixed, such as unpublished posts still appearing on the home page.
Quick Fix
To save your time, you can copy this CSS to fix all issues mentioned in this article.
/* Fix Toggle Blocks Overflow*/ .notion-text, .blog_page_content .notion-text, .notion-list-numbered, .notion-list li { max-width: 100%; } /* Fix YouTube Embed Under Toggle Block */ .notion-toggle .notion-asset-wrapper-video .notion-yt-lite { padding-bottom: 50%; } /* Fix Blog Tag Color Property */ a.blog-tags[data-tag-color="red"], .blog-thumbnail .tagLeft[data-tag-color="red"] { background-color: red; } a.blog-tags[data-tag-color="blue"], .blog-thumbnail .tagLeft[data-tag-color="blue"] { background-color: blue; }

Toggle Blocks

Basic - Overflowing Toggle Block

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.
notion image
See samples of the same bug on other screen sizes.
Mobile(Iphone XR)
notion image
Tablet(Ipad Air)
notion image
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.
.notion-list-numbered { ... padding-inline-start: 1.6em; }
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.
The text still overflows within the toggle block.
So, I include one more subtraction, producing this result:
Now, there’s no more overflow.
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.
notion image
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:
.notion-list .notion-toggle { max-width: calc(100vw - 17% - 1.6em); }
After I did this, I observed two things:
  1. the lists themselves were overflowing and
  1. The fix above ruined the toggle block in some cases.
notion image
Then I realised that I could simply kill two birds with one stone 🤩
notion image
So with one stone or one line of code, I solved two problems. Here’s the code:
.notion-text, .blog_page_content .notion-text, .notion-list-numbered, .notion-list li { max-width: calc(100vw - 16% - 1.2em); }
Why this works?
Here’s a hint:
Remember this?
.blog-main { width: 84% }
Well, the problem wasn’t actually from the toggle block but from the list and text. So the fix I applied adjusts all of them at once.
  • 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.
notion image
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.
notion image
But magically— if I disable height property, the video appears ✨.
notion image
Well it worked there, but look at this:
notion image
Can you figure out what’s wrong and the correct fix?
See Answer
notion image
Well, the <div> element has a fixed height this time.
So I disabled it and…
notion image
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 😆.
notion image
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.
notion image
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:
notion image
Aren’t you wondering why this didn’t work here:
notion image
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:
notion image
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…
notion image
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.
But it turns out there is…
.notion-toggle .notion-asset-wrapper-video .notion-yt-lite { padding-bottom: 50%; }
I also got to learn that there was no difference between height: 0px and height: fit-content in our use-case (since the youtube embed had no height).
So, just padding-bottom: 50%; was enough to fix the bug afterall. Embedded Notion videos didn’t need fixing.
Skip to CSS fix
.notion-toggle .notion-asset-wrapper-video .notion-yt-lite { padding-bottom: 50%; }

Tags

Bug: Adding a color property within the Notion database had no effect.
I use the custom CSS below to address this:
/* Blog Tags */ a.blog-tags[data-tag-color="red"], .blog-thumbnail .tagLeft[data-tag-color="red"] { background-color: red; } a.blog-tags[data-tag-color="blue"], .blog-thumbnail .tagLeft[data-tag-color="blue"] { background-color: blue; }
With this, I can set two colors(red or blue) in Notion.
You can update the CSS code to add more color options.
 
Follow the tutorial below to update the tag color within Notion:

Images

Advanced Image Attribute

 
Advanced Image Attributes Sample
This image is the result of using the advanced image attribute👇👇👇
These are the attributes applied:
:link=”https://notion.so” :alt=”Advanced Image Attributes Sample” :height=”320px”
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.
Notion Image
✅ This works.
Adding Links
  1. Hover on the image(in the notion page)
  1. Click on more actions
  1. Click on Add link
Adding Alt Text
  1. Hover on the image(in the notion page)
  1. Click on more actions
  1. 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.
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Salsa&display=swap" rel="stylesheet"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&display=swap" rel="stylesheet">

Spicy Shortcuts 😋

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
I intend to write more articles on the following topics:
  • How to set up free analytics for your bullet site.
  • How I built my Portfolio.
Finally, let me know in the comments if and what you enjoyed the most about this article.