Fix Paragraph Runts With Nonbreaking Space [Snippet] <> No-Code Supply Co.

Fix Paragraph Runts With Nonbreaking Space

Fix Paragraph Runts With Nonbreaking Space
// Use or update ".no-runt" as the class that should be used on any element to fix runts within
$(".no-runt").each(function() {
var wordArray = $(this).text().split(" ");
if (wordArray.length > 1) {
wordArray[wordArray.length-2] += "&nbsp;" + wordArray[wordArray.length-1];
wordArray.pop();
$(this).html(wordArray.join(" "));
}
});
view raw fix-runts.js hosted with ❤ by GitHub

Add the 'no-runt' class to any paragraph or text element you want to combine the last two words with a non-breaking space to ensure there are no runts.

Creators

Have feedback or a question related to this item? Drop us some feedback!

Curated: 
10.8.20

Similar items

Also

3.26.25

Hurry Up & Have Fun

3.24.25

Cleft Notes

3.22.25

Typography in web design course

€399
3.22.25

Modulify AI

3.22.25

Webflow Expert Course

3.22.25

Dreamr

3.22.25

Website Headlines (dotcom)

3.18.25

Plumb

3.18.25

Elevate Sphere

3.17.25

Rubus

3.14.25

brand.ai

3.14.25

Tiny Mighty Buttons

3.14.25

DeepFlow

3.13.25

Sections.wtf

3.13.25

Mast

3.13.23

Birch

3.11.25

Whalesync

1.8.23

Praxis Leandra Isler

3.10.25

Ditto

3.10.25

Frontify

3.10.25

Fleur MCP App Store

3.10.25

Jetboost

12.3.19

Fathom Analytics

12.1.22

Fondu

3.6.25

Pasha Ink

3.4.25
Load more

Bummer, no results

Try a different search/filter combo, or drop us some feedback if there is something missing you would love to see!

Reset filters

Subscribe for updates

Get updates on the latest curated resources and be the first to hear of new features.