Kevin Powell - CommunityKP-C
Kevin Powell - Community15mo ago
4 replies
Dev_HK

is there anyway i can tell the margin-left to shrink based on the viewport width

meaning at first it's like 15%,but when i reach a certain breakpoint (at 768px)
i switch the layout to grid-template-column:1fr instead of

grid-template-columns:[start] 4rem [start-row-2] 50% [seperator-row-1] 4rem [seperator-row-2] 50% [end-row-1] 4rem [end]


the smaller the viewport gets; the smaller margin-left should be until it reaches to 0

like if it's a 576px it should be 5% but if it's 460px it should be 0

idk how to do that dynamically without making too many breakpoints
Was this page helpful?