Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jeffreymorganio/improve-html-heading-layout

Ensure HTML elements wrap two words to the next line rather than one.
https://github.com/jeffreymorganio/improve-html-heading-layout

Last synced: 6 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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:

How to Improve HTML Heading Layout with jQuery

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](http://usabilityetc.com/2010/07/improve-html-heading-layout-with-jquery/).