Skip to content

jeffreymorganio/improve-html-heading-layout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

join-last-two-words.js

About

The joinLastTwoWordsOfElement function uses jQuery to replace the last space character in the selected HTML elements with the non-breaking space entity ( ).

Example

An example use is ensuring that blogs don't put the last word of an entry title on a separate line. For example:

Bad:

How to Improve HTML Heading Layout with
jQuery

Good:

How to Improve HTML Heading Layout
with jQuery

If you have the following mark up:

<h1>How to Improve HTML Heading Layout with jQuery</h1>

you can ensure two words will wrap to the next line with the following call:

joinLastTwoWordsOfElement('h1');

See test.html for more examples.

More Information

For more information, please read How to Improve HTML Heading Layout with jQuery.

About

Ensure HTML elements wrap two words to the next line rather than one.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published