Created
December 8, 2023 02:43
-
-
Save blueforesticarus/2ac467c75882f828f7987bf678755ca4 to your computer and use it in GitHub Desktop.
css grid layout with row divs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<!-- | |
This part could be better with CSS3 attr() if any browser actually supported it. | |
then we could use attributes instead of inline style, which would make selecting an element easier. | |
-->> | |
<div style="grid-row: 1"> | |
<div style="grid-column: 1">A</div> | |
<div style="grid-column: 2">B</div> | |
</div> | |
<div style="grid-row: 2"> | |
<div style="grid-column: 1">C</div> | |
<div style="grid-column: 2">D</div> | |
</div> | |
</div> | |
<style> | |
body > div { | |
display: grid; | |
} | |
body > div > div { | |
display: contents; | |
} | |
body > div > div > div { | |
grid-row: inherit; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://jsfiddle.net/rsb0hu3n/2/