Hi there,
it can’t be done with CSS.
But you can try this PHP Snippet:
add_filter( 'the_content', 'insert_featured_image', 20 );
function insert_featured_image( $content ) {
global $post;
$feat_img = get_the_post_thumbnail($post->ID, 'post-single');
if ( is_single() && ! is_admin() ) {
return prefix_insert_after_paragraph( '<div class="incontent-featured-image">' . $feat_img . '</div>', 1, $content );
}
return $content;
}
function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) {
$closing_p = '<h2>';
$paragraphs = explode( $closing_p, $content );
if ($paragraphs) {
$paragraphs[0] = $paragraphs[0].'<h2>'.$insertion;
}
return implode( '<h2>', $paragraphs );
}
It will insert the featured image before the first H2.
Adding PHP: https://docs.generatepress.com/article/adding-php/