• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS How can i title above center border with flexbox

richiewollie

New Coder
Best,

My english is not so good and i will try to explain. And i am newbie.

I tried to place a title H1 above center border with flexbox.

How can I do?


<div class="container">
<div id="blogpost">
<h1>Blog</h1>
<div class="blog">
<p> <b>30-4-22</b><br><br> Lorem, ipsum dolor sit amet consectetur adipisicing elit. Laboriosam reiciendis sapiente a voluptatibus quam veniam eligendi, at iusto laborum accusamus error exercitationem esse nisi repellat omnis illum vero voluptatem qui aperiam labore quos dolore ullam placeat. Commodi quod cumque exercitationem ad vel beatae alias voluptates quibusdam earum nostrum dignissimos aliquid, deserunt laudantium quae quisquam dolorum harum, explicabo tempore atque sint quaerat possimus, reiciendis in? Molestiae quidem numquam aperiam quam, quia unde blanditiis consequatur. Eum delectus veniam saepe asperiores impedit voluptas, officiis aliquam aliquid suscipit autem laudantium facere nemo ipsum recusandae perferendis architecto sit quo labore fugit magnam quae obcaecati! Commodi. </p>
</div>
</div>
</div>

.container {
display: flex;
justify-content: center;
margin-top: 150px;
width: 100%;
align-items: center;
}
#blogpost{
display: flex;
justify-content: center;
height: 100%;
width: 100%;
background-color: #ffffff;
}
#blogpost h1 {
display: inline-block;
justify-content: center;
color: #000000;
}
.blog {
display: flex;
justify-content: center;
border: #000000;
border-style: solid;
border-width: 3px;
border-radius: 25px;
width: 300px;
height: auto;
padding: 10px;
margin: 25px;
box-shadow: 5px 0px 10px 10px black;
}
.blog h1 {
color: #000000;
text-align: center;
}
.blog p {
color: #000000;
font-size: large;
}
 

BGB

King Coder
Staff Team
Guardian
If this is what you want -
HTML:
<!DOCTYPE html>
<html lang="en-US">

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title >New Tab</title>
    
    <style>
        .container {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 150px;
    }

    #blogpost {
        width: 300px;
        padding: 10px;
        border-style: solid;
        border-width: 3px;
        border-radius: 25px;
        box-shadow: 5px 0px 10px 10px black;
    }
    </style>
</head>
<body>
    <div class="container">
        <div id="blogpost">
            <h1>Blog</h1>
            <div class="blog">       
                <p> <b>30-4-22</b><br><br> Lorem, ipsum dolor sit amet consectetur adipisicing elit. Laboriosam reiciendis sapiente a voluptatibus quam veniam eligendi, at iusto laborum accusamus error exercitationem esse nisi repellat omnis illum vero voluptatem qui aperiam labore quos dolore ullam placeat. Commodi quod cumque exercitationem ad vel beatae alias voluptates quibusdam earum nostrum dignissimos aliquid, deserunt laudantium quae quisquam dolorum harum, explicabo tempore atque sint quaerat possimus, reiciendis in? Molestiae quidem numquam aperiam quam, quia unde blanditiis consequatur. Eum delectus veniam saepe asperiores impedit voluptas, officiis aliquam aliquid suscipit autem laudantium facere nemo ipsum recusandae perferendis architecto sit quo labore fugit magnam quae obcaecati! Commodi. </p>
            </div>
        </div>   
    </div>

</body>

</html>
 
Top