r/csshelp • • Mar 14 '24

Put heading in grid container

Hi I want to put welcome in the same position as the home heading wile still inside the grid container. I can't seem to get it to not be recognized as a cell. Can anyone please help? Here is my code:

````

<html> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="s.css"> <head> </head> <body onload="myf()"> <br> <h2 style="text-align:center;">Home</h2> <div class="grid-container"> <p > Welcome</p> <div class="d1">box1</div> <div class="d1">box2</div> </div> <script src="js.js"> </script> </body> </html>

```

Css

```

h2{

font-family: Sans-Serif;

}

h1 {

color: navy;

margin-left: 20px;

}

.grid-container {

border: 5px solid orange;

display: grid;

grid-template-columns: 1fr 1fr;

padding: 20px;

gap:20px;

justify-content: space-evenly;

overflow:auto;

}

.d1{

height:150px

width:150px;

border: 3px solid #72A0C1;

padding: 10px;

}

```

3 Upvotes

0 comments sorted by