• hello,

    I want to add a title containing h2 to some pages on my website. but after the h2 option, the text becomes quite large.

    I don’t want to add the following code to the css field as I don’t want it to be valid on all pages.

    h2 {
    font-size:32px;
    }

    my question is: for example I want to use the h2 tag to the word “test” in the post editor. but I don’t want this word to be seen too big as a font when the visitor sees it.

    What shortcode or code can I add to the text edit field for this word?

    e.g:

    <strong>test</strong>

    I’m looking for a code similar to this.

    The word will feature the h2 tag.`

    • This topic was modified 3 years, 7 months ago by aga2442.
Viewing 1 replies (of 1 total)
  • Moderator threadi

    (@threadi)

    The size of the text in a heading depends on the theme you use. Of course you can change the size globally with the code you mentioned. However, you cannot set the font size individually in the Classic Editor.

    One possibility might be a shortcode, if you can handle it in content editing. Example:

    function custom_h2( $args, $content ) {
        var_dump($content);
        return '<h2 style="font-size: 32px;">'.$content.'</h2>';
    }
    add_shortcode('h2', 'custom_h2');

    In the editor you write:

    [h2]test[/h2].

    This would output the following on the frontend:

    <h2 style="font-size: 32px;">test</h2>

Viewing 1 replies (of 1 total)

The topic ‘h2 font size’ is closed to new replies.