How to make a column span full width when a second column is not there?
问题 I know there are similar questions but this is specifically asking how to do this using CSS Grid Layout. So we have this basic grid setup: HTML (with sidebar): <div class="grid"> <div class="content"> <p>content</p> </div> <div class="sidebar"> <p>sidebar</p> </div> </div> CSS: .grid { display: grid; grid-template-columns: 1fr 200px; } To create a layout that looks something like this: | content | sidebar | If the page doesn't have a sidebar though, ie. the html looks like this but with the