Skip to content

Grid item with width:100% in grid container with fixed width seems to use the container's width instead of the column width #41422

@webbedspace

Description

@webbedspace

Describe the bug:
Using the "experimental" grid layout (is it OK to submit individual bugs for it?). In a grid with columns of 1fr and a fixed width (say, 300px), a cell with width:100% gains the size of 300px instead of the 1fr.

To Reproduce:
Test case

<!doctype html>
<style>
    #A {
        display:grid; grid-template-columns:repeat(3, 1fr);
        width:300px;
        div {
            width:100%;
            height:120px;
            background:blue;
        }
        div:nth-child(2n) {
            background:gold;
        }
    }
</style>
<div id="A">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</div>

Firefox (top), Servo (bottom)
Image
As you can see, it's 3x the size it should be (the 300px is used for each column instead of the whole thing).
Interestingly, changing the cells' width from 300px to auto makes it work fine.

Platform:
Win 10.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions