echo cutom css code to WordPress page template file ? is this safe?

A very basic template

I created a file named about.php in a pages folder in the root of my theme with this code.

You can do the same or change the location as you see fit, just dont put it inside a child folder that is in a child folder, wordpress can’t read templates two levels deep it folder structure.

<?php defined('ABSPATH') || exit;

// Template name: About

// this gets the header.php file
get_header();
?>
<!-- Here we can do what ever we need -->
<style>
    .content .headline,
    .content .description {
        text-align: center;
    }

    .content .headline {
        margin: 0 0 20px;
        font-size: 2rem;
    }

    .content .description {
        max-width: 400px;
        margin: 0 auto;
    }
</style>

<div class="content">
    <h1 class="headline">About Us</h1>
    <p class="description">Lorem ipsum dolor sit amet consectetur adipisicing elit. Aspernatur repellat eius a beatae consectetur, et perferendis impedit molestias itaque esse optio repellendus sapiente iure debitis suscipit temporibus voluptas architecto animi.</p>
</div>
<?php
// this gets the footer.php file
get_footer();
?>