# P and h1 tag how to get them in top of the flex box

**URL:** <https://www.phphelp.com/t/p-and-h1-tag-how-to-get-them-in-top-of-the-flex-box/29288>\
**Category:** HTML & CSS\
**Created:** [June 19, 2019, 10:19am UTC](https://www.phphelp.com/t/p-and-h1-tag-how-to-get-them-in-top-of-the-flex-box/29288 "2019-06-19T10:19:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![swimmer](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/41988e/32.png) [@swimmer](https://www.phphelp.com/u/swimmer)\
**Post date:** [June 19, 2019, 10:19am UTC](https://www.phphelp.com/t/p-and-h1-tag-how-to-get-them-in-top-of-the-flex-box/29288/1 "2019-06-19T10:19:36Z")

</div>

When I try to make flex box that has a P tag and a H1 tag the p tag pushed to the bottom of the page I’m interested that the H1 and the text and the p tag will be in the top left corner.  
This is my code

Any help in what am I doing wrong will be appreciated.

```auto
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>

<style>
.flex-rectangle{
  display: flex;
  flex-direction:column;
  /* align-content: flex-start; */
  justify-content: center;
  text-align: center;
  width: 80%;
  height:50%;
  background: #ca0164;
 max-height: 500px;
 vertical-align: text-top;
}   
.flex-item {

  background: blue;
  
 }

.flex-rectangle:before{
  content: "";
  display: block;
  padding-top: 25%;
}
p .flex-rectangle {
  color: green;
 }

 .redtitle {
  color: red;
  background-color: black;
} 

h1.title {color: red;}
 

</style>

</head>
<body>
  
  <div class="row">
      <div class= "flex-rectangle">

          

          <h1 class = "title flex-item">This is my header</h1>
          
          
       
          <p class = "flex-item">This my p tag</p>
          
     </div>
</div>
 

  
</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![johnphpnewb](https://www.phphelp.com/user_avatar/www.phphelp.com/johnphpnewb/32/2219_2.png) [@johnphpnewb](https://www.phphelp.com/u/johnphpnewb)\
**Post date:** [June 20, 2019, 11:57pm UTC](https://www.phphelp.com/t/p-and-h1-tag-how-to-get-them-in-top-of-the-flex-box/29288/2 "2019-06-20T23:57:11Z")

</div>

> [@swimmer](#):
>
> padding-top: 25%;

your question and your code create a paradox. if you want them at the top, then remove the 25% padding that keeps pushing them down. Then, add the following code:

```auto
  align-content: flex-start;
  align-items: stretch;
```
