Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style.css: fluid spacing of nav-links for mobile #385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tleb
Copy link
Member

@tleb tleb commented Feb 5, 2025

Before we had a set gap inbetween each link. That means that carriage returns happen quickly on mobile. Once we switch to mobile width, let flexbox justify-content spread links on the line. It'll wrap once there is no more space.

Previously, most mobiles showed two lines of links. Now we only have one (but links are closer).

On mine, before/after is:

navlinks-preview

We can still gain vertical space by reducing the header & Bootlin logo, but that's out of scope of this pull request.

@tleb tleb requested a review from fstachura February 5, 2025 14:55
@fstachura
Copy link
Collaborator

According to Firefox, links can get cramped to the point of being unreadable on some screen widths. On Samsung S20 for example. I propose adding gap: 5px to mobile .nav-links rules.
image

I also find the link layout switch that happens while making the window width smaller kind of distracting, but it's not that important maybe.

Before we had a set gap inbetween each link. That means that carriage
returns happen quickly on mobile. Once we switch to mobile width, let
flexbox justify-content spread links on the line. It'll wrap once there
is no more space.

Previously, most mobiles showed two lines of links.
Now we only have one (but links are closer).

Signed-off-by: Théo Lebrun <[email protected]>
@tleb
Copy link
Member Author

tleb commented Feb 14, 2025

Added a gap: 0.6ch value when in mobile mode. That means that links cannot get closer than 6ch else it wraps. The smallest width still in one line looks like the following. So we get closer links but avoid the edge-case of links touching each other (like on the S20).

screenshot_2025-02-14-17h15m16s

A wider mobile (iPhone 11 Pro Max) looks like:

screenshot_2025-02-14-17h18m35s

@fstachura
Copy link
Collaborator

I would also add gap amount of left-right padding to the container, otherwise links may get really close to the edges.
image

In the end I'm not sure if this really improves much. Links layout is sometimes a little bit better with this, sometimes not really. Mobile layout needs redesign, for example search also becomes hard to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants