Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS CSS Grid not expanding to full width of available space.

10weller01

New Coder
I am using CSS grid to display lots of 'tiles' on the page, each with its own clickable button that takes the user to an external link. I want the grid to take up the full width of the available space but it isn't - instead it snaps to a new width when I'm shrinking the browser window. Strangely it does work as intended when the grid is down to 2 columns.

Screen recording of how it looks.

Here is the code used for the grid:
Code:
.posts {
  display: grid;
  grid-gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  height: 100%;
}
 
I use css-tricks all the time. I went to W3C to read the standards and things there have changed and I can't find my way around. Will someone help out with this?
When you tried the auto change - did it work?
 

Latest posts

Buy us a coffee!

Back
Top Bottom