Heading with line break | WordPress.org

[ad_1]

Hello, with long headings it can happen that they reach to the right margin and then wrap one or two words. However, this does not comply with the conventions for headings.

This ticket refers to the thread Heading with line break, and the following solution is more practical.

Headings cannot simply be wrapped without causing problems for the table of contents. This should therefore be implemented using CSS, as follows:

/* --- Heading with line break --- */

@media (min-width: 700px) {
    .long-heading {
        white-space: nowrap;
    }
}

CSS-Media-Query @media (min-width: 700px) ensures that this class is only used on screens with a minimum width of 700 pixels.

An example in HTML could look like this:

<h2 class="long-heading">If headings are long,<span class="nowrap">they reach the right margin</span></h2>

Headings that are to be wrapped are assigned the class long-heading, while the parts that are to be wrapped are marked within a span tag with the class nowrap.

The direct solution in HTML may no longer be ideal after a theme change. In such cases, the customizations should be checked and adjusted if necessary.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer