Someone else asked a similar question here but the answer only works if every element on the page is auto-placed and takes up only one column.
I have a 12-column grid layout in which the first three rows are all taken up by one element that spans all twelve columns; then I have three rows of auto-placed elements that each take up six columns.
While I could do the math to work this out based on that previous answer, it seems somewhat absurd to think that the calculated placement of the element isn't stored anywhere that is accessible by Javascript.
If I access the computed CSS properties regarding the grid, I'm just getting auto
and span 6
, rather than the actual computed number of row-start
or row-end
. Is there really no way to access the computed value of grid-row
and grid-column
?
Element.getBoundingClientRect()
doesn't do the job? developer.mozilla.org/en-US/docs/Web/API/Element/… – Henchman