没有不值得去解决的问题,也没有不值得去学习的技术!

A Tour of Go Multilingual Translation Project: Fix Title Wrapping in Mobile Top Bar and Verify on Real Devices

Figure 4: After deploying to production and flushing the EdgeOne cache, accessing the site again on a real phone shows the top bar project name fully maintained on one line. Final mobile verification passed.

作者:

在

While continuing to refine the production site for the A Tour of Go multilingual translation project, I accessed the homepage on a real phone and noticed an issue that was not obvious on the desktop:

The “A Tour of Go 多语言翻译项目” in the top navigation bar does not fit on mobile, and the final character “目” is pushed to a second line.

The issue itself was not complex, but the entire resolution process was quite representative: discovering the problem on a real phone, locating the mobile CSS, making trade-offs between 360px and 320px widths, and finally deploying to production and handling the EdgeOne cache to truly close the loop.

This article documents the process of resolving this mobile homepage top bar issue.


1. Discovering the Title Wrapping on a Real Phone

The top of the project homepage includes a logo and the project name:

Plaintext
A Tour of Go 多语言翻译项目

There was no obvious issue in desktop browsers, but after opening the production site on a real phone, the title wrapped.

Figure 1: When accessing the homepage on a real phone, the project name in the top bar wraps, and the final character "目" is pushed to the second line. This shows that a normal desktop layout does not guarantee the absence of issues in the actual mobile layout.
Figure 1: When accessing the homepage on a real phone, the project name in the top bar wraps, and the final character “目” is pushed to the second line. This shows that a normal desktop layout does not guarantee the absence of issues in the actual mobile layout.

From the screenshot, you can see that the first line already fills the top bar:

Plaintext
A Tour of Go 多语言翻译项

The final character:

Plaintext
目

Drops to the second line by itself.

Since the top bar itself has a fixed height, the second line was close to exceeding the available space.

The main body of the homepage did not show any obvious abnormalities, so the problem could be confidently isolated to the top navigation bar.


2. Locating the Mobile CSS

The homepage top template itself is very simple, with a structure roughly like this:

CSS
<header class="bar top-bar site-header">
    <a href="/"><img src="/images/site-logo.png" class="site-logo" alt=""></a>
    <a class="logo" href="/">{{ui "site.title"}}</a>
</header>

The project name comes from the common UI copy:

Plaintext
A Tour of Go 多语言翻译项目

After further inspecting the CSS, the issue centered on the mobile media query.

The original mobile title styles contained:

CSS
.site-header .logo {
    font-size: 1em;
    white-space: normal;
    line-height: 20px;
}

The most critical part being:

CSS
white-space: normal;

This means the mobile style explicitly allowed the title to wrap automatically.

For shorter titles, this setting was not a problem.

However, “A Tour of Go 多语言翻译项目” contains both English and Chinese, and it is preceded by a logo, taking up considerable horizontal space. At actual mobile widths, this combination triggered the wrap.


3. Not Drastically Reducing the Font Size

The simplest and crudest fix would have been to further reduce the font size.

For example, dropping it directly from:

CSS
font-size: 1em;

Down to a very small value.

This could have forced it to fit even at a 320px width.

However, I ultimately did not adopt this approach.

The reason is that this project was designed for multilingual support from the very beginning.

Currently, the first phase only includes Simplified Chinese, but if other languages are added in the future, the site title length will not remain fixed.

If I kept compressing the font size just to keep the current Chinese title on a single line on extremely narrow devices, the result would likely be a top bar that is “technically unwrapped, but practically ugly.”

Therefore, I chose to first solve the real problem at standard mobile widths, rather than endlessly pursuing compatibility with the narrowest devices.


4. The Final CSS Adjustments

The final modifications were restrained.

On one hand, I reduced the spacing between the logo and the title:

CSS
.site-header .site-logo {
    margin-right: 0.75rem;
}

On the other hand, I slightly reduced the title font size and disabled automatic wrapping:

CSS
.site-header .logo {
    font-size: 0.9em;
    white-space: nowrap;
    line-height: 20px;
}

The corresponding commit was:

Plaintext
a4d4dca
fix: 修复首页手机端顶栏标题换行
Figure 2: The final mobile top bar CSS fix. Reduces the spacing between the logo and the title, appropriately decreases the mobile title font size, and disables title wrapping.
Figure 2: The final mobile top bar CSS fix. Reduces the spacing between the logo and the title, appropriately decreases the mobile title font size, and disables title wrapping.

No desktop styles were changed here; adjustments were only made for:

CSS
@media (max-width: 600px)

within the mobile layout scope.

This matched the actual scope of the issue and avoided affecting the already functional desktop page while fixing the mobile side.


5. Verifying at 360px First

After modifying the code, I first used Firefox’s Responsive Design Mode to simulate a mobile width.

The test width was:

Plaintext
360px

At this width, the top title was able to remain entirely on a single line:

Plaintext
A Tour of Go 多语言翻译项目

The logo, title, and top bar height all remained normal.

Figure 3: Verified at 360px width in Firefox Responsive Design Mode. The top bar title can now maintain a single-line display. For the more extreme 320px width, no further forced adaptation was made by drastically reducing the font size.
Figure 3: Verified at 360px width in Firefox Responsive Design Mode. The top bar title can now maintain a single-line display. For the more extreme 320px width, no further forced adaptation was made by drastically reducing the font size.

There is another boundary worth documenting here.

I continued testing at:

Plaintext
320px

At 320px, the current title was still quite tight, and the final part risked being clipped.

Initially, I considered whether to continue adjusting for 320px.

But I ultimately decided to stop.


6. Why I Did Not Continue Optimizing for 320px

This decision was primarily based on three considerations.

1. 360px Already Covers More Practical Mobile Usage Scenarios

The actual problem on the real phone could already be solved with the current approach.

Continuing to shrink the font for narrower widths yielded diminishing returns.

2. The Project Will Expand to Other Languages in the Future

The current title is:

Plaintext
A Tour of Go 多语言翻译项目

If other languages are added in the future, the title length will likely differ.

Precisely compressing the current fixed Chinese string to fit 320px now would easily turn into a one-off special adaptation.

3. Readability is More Important Than Absolute Single-Line Display

Responsive design is not about:

Forcing all text to maintain the exact same layout across all device widths.

A more reasonable goal should be:

Maintaining a normal experience within the primary device range, while avoiding breaking overall readability for extreme boundaries.

Therefore, I ultimately set 360px as the practical mobile boundary for the current Simplified Chinese homepage, without expanding the special CSS handling further.


7. Committing and Deploying to Production

After confirming the local behavior, I committed the changes:

Plaintext
a4d4dca
fix: 修复首页手机端顶栏标题换行

I then generated a new Simplified Chinese production release.

The project status at the time remained:

Plaintext
ready=103
pending=0
blocked=0
pages=103
articles=7

This means the deployment was essentially just a site style adjustment; it did not change the translation status of the 103 completed course pages.

After deployment, the origin server was already serving the new CSS.

However, when I opened the page again on a real phone, I found:

The page still looked exactly as it did before the modification.


8. Origin Updated, but Mobile Still Showing Old CSS

Upon further inspection, I found the issue was no longer with the application itself.

The CSS file content requested by both desktop and mobile was identical, and the origin server was already running the new version.

What actually affected the mobile display was the Tencent Cloud EdgeOne cache.

In other words, the actual request chain had become:

Plaintext
Git CSS updated
→ production release updated
→ Go Tour origin updated
→ EdgeOne still caching old static assets
→ Mobile continues to see old styles

This is a situation in a CDN environment that can easily lead to misjudgments.

If you only look at the phone:

The changes did not take effect.

But if you only look at the origin server:

The changes clearly have taken effect.

Both conclusions are actually correct, because they observe different layers of the request chain.

I ultimately flushed the EdgeOne cache manually.


9. Final Verification Passed on a Real Phone

After flushing the cache, I accessed the site again on a real phone:

Plaintext
https://go-dev.shuijingwanwq.com/

The top title was now fully displayed on a single line:

Plaintext
A Tour of Go 多语言翻译项目

The logo, title, and top bar height had all returned to normal.

Figure 4: After deploying to production and flushing the EdgeOne cache, accessing the site again on a real phone shows the top bar project name fully maintained on one line. Final mobile verification passed.
Figure 4: After deploying to production and flushing the EdgeOne cache, accessing the site again on a real phone shows the top bar project name fully maintained on one line. Final mobile verification passed.

At this point, the mobile issue was truly resolved.

It was not resolved just by:

Plaintext
Code changes completed

Nor was it resolved just by:

Plaintext
Local 360px looking normal

But rather by:

Plaintext
Discovering issue on real phone
→ CSS localization
→ Local responsive verification
→ Production deployment
→ CDN cache handling
→ Real phone re-verification

A complete closed loop.


10. Key Takeaways from This Issue

Although this was just a minor top title wrapping issue, it still provided a few experiences worth documenting.

1. Responsive Design Ultimately Requires Real Device Verification

Browser responsive modes are great for quick localization and debugging.

But they are better suited to answer:

Is this CSS adjustment likely correct?

Once live, you should still let real devices answer:

Is the result the user actually sees correct?

Factors like fonts, browser UI, device scaling, and CDN caching can all cause discrepancies between the real environment and development simulations.

2. Do Not Endlessly Stack Special Rules for Extreme Widths

Continuing to compress the font at 320px is certainly doable.

But from a maintenance perspective, this is likely just the beginning.

Switching to another language or a longer title later would require further adjustments.

In contrast, accepting a reasonable mobile boundary and keeping the CSS simple results in lower long-term maintenance costs.

3. Multilingual Projects Should Avoid Relying on Fixed String Lengths

Although nowrap temporarily resolved the Simplified Chinese homepage issue this time, it also reminded me:

The top bar design cannot forever assume a fixed project name length.

With only zh-CN in the first phase, the current approach is sufficient.

When other languages are actually added in the future, if significantly longer project names emerge, a more reasonable approach might be to rethink the information architecture of the mobile header, rather than continually compressing the font size bit by bit.

This is an issue to address when future language expansion actually happens; there is no need to build complex solutions prematurely now.

4. CDN Caching is Also Part of the Frontend Deployment Chain

For production sites using a CDN:

Plaintext
Origin server correct

Does not equal:

Plaintext
Users immediately seeing correct content

Static CSS, JavaScript, and HTML can still be served by edge caches.

So for future style deployments, if you encounter:

Plaintext
Origin server updated
Browser still showing old styles

You should prioritize distinguishing between:

Plaintext
Application issues
Origin server issues
CDN cache issues
Browser local cache issues

Rather than immediately modifying the code again.


11. A CSS Fix Uncovers Another Problem

This article temporarily only covers the mobile top bar itself.

However, during the deployment of this minor CSS fix, I unexpectedly encountered another issue more worthy of a separate record:

After the new release was uploaded to the server, go-tour.service experienced status=203/EXEC due to abnormal directory permissions, and the production site returned a 502.

Although I successfully rolled back and fixed it, this experience prompted me to re-examine the current production deployment process, which still relies on many manual steps.

I subsequently spent another cycle organizing the upload, permission normalization, SHA-256 verification, atomic switching, continuous health checks, and failure rollback into a production automated deployment script.

Moreover, during the first actual run of the automated deployment script, I observed a very interesting phenomenon:

Plaintext
systemd already active
but localhost still returned HTTP 000 on the first try

It wasn’t until 3 consecutive HTTP 200 responses followed that the application was truly deemed stable.

This part completely exceeds the scope of this article’s mobile CSS topic, so I plan to cover it separately in the next post.


Summary

This mobile homepage top bar issue for the A Tour of Go multilingual translation project ultimately only required modifying very little CSS:

CSS
.site-header .site-logo {
    margin-right: 0.75rem;
}

.site-header .logo {
    font-size: 0.9em;
    white-space: nowrap;
    line-height: 20px;
}

But actually completing a production issue fix still involved:

Plaintext
Real device discovery
→ CSS localization
→ 360px verification
→ Evaluating 320px boundary
→ Controlling modification scope
→ Commit
→ Deploy
→ Troubleshooting CDN cache
→ Final real device verification

The final result achieved the goal of this adjustment:

At current primary mobile widths, the top title “A Tour of Go 多语言翻译项目” can fully maintain a single-line display, without adding more special CSS for extremely narrow screens.

For this long-term multilingual project, I increasingly lean towards the following handling principle:

Solve real existing problems first, keeping the implementation simple enough; expand based on actual needs when new languages and new layout requirements truly arise in the future.

Rather than prematurely turning a simple problem into a complex system for boundaries that do not yet exist.

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系