2

I have a page which attempts to display all the items in the cart in divs. For simplicity's sake, I'll hide all the non-relevant php code and only show the lines relating to the styling problem:

cart.php

<form action="singleproduct.php" method="post" class="cart">
<button type="submit" name="prod" value="<?php echo $tobuy['ProductID'] ?>" class="cartitem">
    <img src=<?php echo "http://$_SERVER[HTTP_HOST]/WebApplications/productImages/" . $tobuy['PictureLocation']?>></img>
    <p id="name"> <?php echo $tobuy['ProductName'] ?> </p>
    <p id="make"> <?php echo $tobuy['Make'] ?> </p>
    <p id="cost"> <i>Cost : $<?php echo $tobuy['Cost'] * $tobuy['quantity'] ?> </i> </p>
    <p id="quty"> Quantity : <?php echo $tobuy['quantity'] ?> </p>
</button>
</form>

<form action="cart.php" method="post" class="delete">
    <button
        type=submit
        name="delete"
        value=<?php echo $tobuy['ProductID'] ?>>
        Remove item </button>
    </button>
</form>

styles.css

form.cart > .cartitem{
    grid-column: 1/7;
    width: 100%;
    display: grid;
    grid-template-areas: "image name"
                         "image make"
                         "image cost"
                         "image quty";
    grid-template-columns: 200px auto;
    grid-column-gap: 20px;
    text-align: left;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 30px black;
    background: linear-gradient(#a7321f, #3d1111);
}

form.cart > .cartitem > img {
    grid-area: image;
    object-fit: cover;
    height: 200px;
    width: 200px;
    border-radius: 10px;
    box-shadow: 0 0 20px black;
}

form.cart > .cartitem > p#name{
    grid-area: name;
    font-size: 20px;
    font-weight: 300;
}

form.cart > .cartitem > p#make{
    grid-area: make;
    font-size: 25px;
    font-weight: 500;
}

form.cart > .cartitem > p#cost{
    grid-area: cost;
    font-size: 20px;
    font-weight: 300;
}

form.cart > .cartitem > p#quty{
    grid-area: quty;
    font-size: 15px;
}

From what I could tell, Chrome has full compatability with CSS Grid. I am using v65, and this website says that it should work. However, here is how it looks in Firefox:

Normal Grid

And here is how it looks in Chrome:

Normal Grid

The grid should be 2 columns by 4 rows, as shown in the css and firefox, however in Chrome for some reason there's only a 6 column grid, with no rows.

Is there a way where I can make the webpage look the same in Chrome as it does in Firefox?

ENBYSS
  • 819
  • 1
  • 10
  • 22
  • We need the output HTML. PHP is of little use here. – Paulie_D May 18 '18 at 14:12
  • But this IS the output HTML. It is what is showing the div. – ENBYSS May 18 '18 at 14:20
  • No...it;s not. Clearly! – Paulie_D May 18 '18 at 14:24
  • Questions seeking code help must include the shortest code necessary to reproduce it **in the question itself** preferably in a [**Stack Snippet**](https://blog.stackoverflow.com/2014/09/introducing-runnable-javascript-css-and-html-code-snippets/). See [**How to create a Minimal, Complete, and Verifiable example**](http://stackoverflow.com/help/mcve) – Paulie_D May 18 '18 at 14:24
  • What do you mean it's clearly not? That is the HTML that is producing the div. The rest of the page is PHP code, with the obligatory `` and `` tags. – ENBYSS May 18 '18 at 14:26
  • This `

    ` is not HTML. etc.
    – Paulie_D May 18 '18 at 14:35
  • Seems to be a problem with the button element in chrome, if we change the button for a div the problem disappears - https://jsfiddle.net/x2p17f31/75/ – Luís P. A. May 18 '18 at 14:39
  • The comment above is only for testing purposes – Luís P. A. May 18 '18 at 14:46
  • https://bugs.chromium.org/p/chromium/issues/detail?id=779864&q=button%20grid&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified – Luís P. A. May 18 '18 at 14:54
  • 1
    `button` elements don't accept `display: flex` and/or `display: grid`. It depends on the browser. But it's not a reliable approach in general. There's a better way. See the duplicate. – Michael Benjamin May 18 '18 at 15:36
  • Thank you so much, solved my problem! – ENBYSS May 18 '18 at 16:06

0 Answers0