List posts related to category on a div [closed]

Here is a start. Create a template called content-related.php

Inside that paste the following code

<?php
/**
 * The default template for displaying realted posts
 *
 * @package WordPress
 * @subpackage Pieter Goosen
 * @since pietergoosen 1.0
 */



wp_reset_postdata();
    global $post;

    // Define shared post arguments
    $categories = get_the_category($post->ID);
    if ($categories) :
        $category_ids = array();
        foreach($categories as $individual_category) 
            $category_ids[] = $individual_category->term_id;

        $args=array(
                'category__in' => $category_ids,
                'post__not_in' => array($post->ID),
                'posts_per_page'=>3, // Number of related posts that will be shown.
                'ignore_sticky_posts'=>1
            );

        $query = new wp_query($args);

    if ( $query->have_posts() ): ?>

    <div class="related-posts block">

        <h4 class="heading">
            <?php _e('You may also like &hellip;','pietergoosen'); ?>
        </h4>

            <div class="related-posts group">

                <?php while ( $query->have_posts() ) : $query->the_post(); ?>

 <--- YOUR LOOP GOES HERE--->

<?php endwhile; ?>

</div>

</div>

<?php endif; ?>

This code checks for the category (using WP_Query)of the post that is displayed using get_the_category($post->ID). From this, posts from this category is fetched. In this code, three posts ('posts_per_page'=>3,) will be displayed from the category of the post currently displayed. You can customize the query to suite your needs, also, you can customize your loop just the way you want to.

You can now call this in your single.php where you need to display your related posts using

get_template_part('content', 'related');

As for the styling, you will need to sort that out yourself. CSS related stuff is off-topic here BTW