HubSpot Guide to CSS Word Wrap
Designers and developers using HubSpot often need precise control over how long words and URLs break across lines. Understanding CSS word wrapping properties keeps your HubSpot pages readable, accessible, and visually consistent on every device.
This guide walks through the core CSS properties that control word wrapping, how they differ, and when to use each as you build or edit HubSpot templates, modules, and theme layouts.
Why Word Wrapping Matters in HubSpot Layouts
On any modern website, including those built in HubSpot, long strings of text can break your layout if they are not wrapped correctly. Common problem cases include:
- Very long URLs in blog posts or landing pages
- Long product names or technical terms in HubSpot CTAs
- Code snippets or tokens inside HubSpot rich text modules
- Text content in narrow columns on responsive pages
Without the right CSS, these long strings may overflow their containers, cause horizontal scrolling, or push other elements out of alignment. By adding a few small CSS rules to your HubSpot theme or module, you can keep text neatly wrapped.
Key CSS Properties for Word Wrap in HubSpot
The source article from HubSpot explains three primary CSS properties that influence word wrapping:
word-wrapoverflow-wrapword-break
Each can be applied to elements in your HubSpot templates or in custom modules to control how long text behaves.
1. Using word-wrap in HubSpot Templates
The word-wrap property is an older, but still widely recognized way to allow long words to break onto the next line. Most browsers now treat word-wrap as an alias for overflow-wrap.
Common values include:
normal– Default behavior; words only break at allowed break points, such as spaces or hyphens.break-word– Long words or URLs can break at arbitrary points to prevent overflow.
Example for a HubSpot blog post content area:
.hs-blog-post > .post-body {
word-wrap: break-word;
}
Apply this in your HubSpot theme CSS file or within a custom module style sheet to ensure exceptionally long strings do not disrupt your layout.
2. Using overflow-wrap for Modern HubSpot Designs
overflow-wrap is the modern, standard property for handling word wrapping. In most cases, it should be your default choice in new HubSpot projects.
Typical values:
normal– Only break at normal break points.break-word– Break words if necessary to keep them within the container.
Example for a HubSpot rich text module inside a narrow column:
.hubspot-wrapper .hs-richtext {
overflow-wrap: break-word;
}
This rule tells the browser it may break up a long word to keep your HubSpot content from overflowing its box, especially useful for responsive layouts.
3. Using word-break for Special Cases
word-break controls how words are split when wrapping. It is more aggressive than overflow-wrap and should be used carefully in HubSpot designs, usually only for specific elements where overflow must be prevented at all costs.
Key values:
normal– Standard line break rules based on language.break-all– Break words anywhere if needed, which can make text harder to read.keep-all– Avoid breaking words in languages like Chinese, Japanese, and Korean except at allowed break points.
Example for a HubSpot module that prints generated tokens or IDs:
.hs-code-like-text {
word-break: break-all;
}
Use this only when you have no other option and must prevent horizontal scrolling inside a small HubSpot container.
How to Add Word Wrap CSS in HubSpot
Whether you are editing a theme, a standalone template, or a custom module, the process for applying word wrap rules in HubSpot is straightforward.
Step 1: Identify Problem Elements in HubSpot
First, locate where overflow occurs on your HubSpot pages:
- Open the affected page or blog post in a browser.
- Inspect the layout using your browser DevTools.
- Find the specific class or element that contains the long text.
- Confirm whether the issue appears on desktop, mobile, or both.
Step 2: Add CSS Rules in the HubSpot Design Tools
Next, add a suitable word-wrapping rule in the HubSpot design manager:
- In your HubSpot account, navigate to Marketing > Files and Templates > Design Tools.
- Open your theme or template CSS file.
- Append a rule such as:
.hs-long-text {
overflow-wrap: break-word;
} - Save and publish your changes.
Assign the .hs-long-text class (or your own custom class) to your HubSpot rich text modules, blog content areas, or any block where long strings appear.
Step 3: Test Across HubSpot Pages and Devices
After updating your CSS, confirm that the new behavior works as intended:
- Refresh the affected HubSpot page in an incognito window.
- Check both desktop and mobile views.
- Review multiple templates (blog, landing, website) that share the same CSS.
- Verify that no unexpected breaks occur in languages or layouts where you want more natural word wrapping.
Choosing the Right Property for Your HubSpot Project
Use these guidelines when deciding which CSS property to use in HubSpot environments:
- For general long text: Prefer
overflow-wrap: break-word;. - For legacy support: Pair
word-wrap: break-word;withoverflow-wrapfor maximum compatibility. - For extreme overflow control: Use
word-break: break-all;only on specific HubSpot elements that absolutely cannot overflow.
A combined, robust example for a HubSpot blog body might be:
.hs-blog-post .post-body {
overflow-wrap: break-word;
word-wrap: break-word; /* legacy alias */
word-break: normal;
}
Referencing the Original HubSpot Resource
The explanations in this tutorial are based closely on the original HubSpot article about CSS word wrapping, which you can review for additional context and visuals here: HubSpot CSS word wrap article.
That resource shares the same core recommendations for using word-wrap, overflow-wrap, and word-break in modern websites and aligns well with best practices for HubSpot-built pages.
Optimizing HubSpot Pages with Professional Help
If you manage many HubSpot pages, themes, and modules, standardizing CSS rules for text wrapping can save time and reduce layout issues. You can also combine CSS refinements with broader SEO and performance audits.
For specialized optimization support across HubSpot, technical SEO, and content strategy, you can explore services from Consultevo, which focuses on comprehensive website and search optimization.
Summary: Applying Word Wrap Best Practices in HubSpot
Effective word wrapping is a small but important detail in maintaining professional HubSpot page designs. By using modern CSS properties such as overflow-wrap and carefully applying word-break only where needed, you can:
- Prevent long URLs and tokens from breaking your HubSpot layouts
- Improve readability on mobile and narrow columns
- Keep your themes and modules consistent across the entire HubSpot site
Review your existing HubSpot templates, identify any overflowing text, and apply the rules in this guide to ensure clean, responsive typography across your entire site.
Need Help With Hubspot?
If you want expert help building, automating, or scaling your Hubspot , work with ConsultEvo, a team who has a decade of Hubspot experience.
“`
