# Grid help

**URL:** <https://www.phphelp.com/t/grid-help/36103>\
**Category:** HTML & CSS\
**Created:** [April 12, 2024, 1:12pm UTC](https://www.phphelp.com/t/grid-help/36103 "2024-04-12T13:12:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmanghani](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/e9c0ed/32.png) [@dmanghani](https://www.phphelp.com/u/dmanghani)\
**Post date:** [April 12, 2024, 1:12pm UTC](https://www.phphelp.com/t/grid-help/36103/1 "2024-04-12T13:12:19Z")

</div>

I am using grid in css  
when my option is blank simple echo command, data is displayed correctly in position.  
when I use any option all the data of all the grids is displayed on the left column only.

my CSS is as follows:

```auto
.container {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: auto;
}

.left{
    grid-column:1/2;
    background-color: rgb(95, 169, 95);
}

.middle{
    grid-column:2/3;
    background-color: rgb(10, 45, 4);
}

.right{
    display: inline;
        position: relative;
    grid-column:3/3;
    background-color: rgb(100, 33, 0);
}
```

my PHP file is as follows;

```auto
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="stylecopy.css" type="text/css" />
    </head>

<?php
session_start();
include "config.php";
//include "common.php";
include "functions.php";
$no=0;
?>
<div class="container">
    <div class="left">
        <?php 
            if(isset($_GET['broker'])){ 
                $broker=$_GET['broker'];
                $query="SELECT * FROM holdings WHERE type=14 AND folio='$broker'";
                $result = mysqli_query($conn, $query);
                while ($row = mysqli_fetch_assoc($result)) {
                $data[$row['folio']][]=$row;
                }
                foreach($data as $folio=>$arr) {
                echo "<table><tr><th class='heading' style='text-align:center; background-color:rgb(192, 64, 0);' colspan='10'>$folio</tr></th>";
                foreach($arr as $row){ 
                $code=$row['name'];
                $id=$row['id_holding'];
                $_SESSION['id']=$id;
                $no++; 
                echo "<tr class='data' ><td><center>$no"."</td>";
                share($code);
                }
                }
                }
                
        ?>
    </div>
            
    <div class="middle">
        <?php
            echo "Right";
        ?>    
    </div>

    <div class="right">
            <?php include_once "note.php";?>
    </div>

    <div class = "footer">
        <form action=" " method="GET">
        Broker<select type=text name=broker>
        <option value=""></option>
        <option value="5 Paisa">5 Paisa</option>
        <option value="ICICI Direct">ICIC Direct</option>
        <option value="JMFL">JMFL</option>
        <option value="Nirmal">Nirmal</option>
        <option value="Angel">Angel</option>
        </select>
        <input type=submit name=invest_submit >
        </form>
    </div>
</div>
```

---

<div class="post-metadata">

**Author:** ![Strider64](https://www.phphelp.com/user_avatar/www.phphelp.com/strider64/32/3161_2.png) [@Strider64](https://www.phphelp.com/u/Strider64)\
**Post date:** [April 12, 2024, 11:39pm UTC](https://www.phphelp.com/t/grid-help/36103/2 "2024-04-12T23:39:12Z")

</div>

You are using grids, so why are you doing this?

```auto
.right{
    display: inline;
        position: relative;
    grid-column:3/3;
    background-color: rgb(100, 33, 0);
}

```

`grid-column: 3/3;` should be first line in the class .right. I can’t say it would fix your problem as I am a little unclear in what you are trying to achieve?

---

<div class="post-metadata">

**Author:** ![dmanghani](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/e9c0ed/32.png) [@dmanghani](https://www.phphelp.com/u/dmanghani)\
**Post date:** [April 13, 2024, 6:41am UTC](https://www.phphelp.com/t/grid-help/36103/3 "2024-04-13T06:41:37Z")

</div>

grid-column 3/3; shifting to the first line made no difference.

if no option is selected. ( this is as it should be )

 ![Screenshot from 2024-04-13 12-05-43](https://www.phphelp.com/uploads/default/original/2X/6/65b80d89ca314af1c2f2a737c87d001ea106cd57.png)

if any option is selected

 ![Screenshot from 2024-04-13 12-06-21](https://www.phphelp.com/uploads/default/original/2X/6/61fb85f2eab445faf3908bba0e297b0620690714.png)  
all the displayed data is shifted to the extreme left!. Data should be shown in their own grid and not overlap to the 1st grid.

---

<div class="post-metadata">

**Author:** ![phdr](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/91b2a8/32.png) [@phdr](https://www.phphelp.com/u/phdr)\
**Post date:** [April 13, 2024, 6:52am UTC](https://www.phphelp.com/t/grid-help/36103/4 "2024-04-13T06:52:57Z")

</div>

The markup is probably broken, and cannot be understood by the browser. Have you validated the resulting web page at [validator.w3.org](http://validator.w3.org)

---

<div class="post-metadata">

**Author:** ![dmanghani](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/e9c0ed/32.png) [@dmanghani](https://www.phphelp.com/u/dmanghani)\
**Post date:** [April 13, 2024, 7:13am UTC](https://www.phphelp.com/t/grid-help/36103/5 "2024-04-13T07:13:04Z")

</div>

So sorry it was my fault, the note.php had a which was the reason for the breakup.
