• cantercrow

    (@cantercrow)


    I am trying to write a CSS file to change a grid based on the screen size but the code I have below does not work, when viewed on a desktop it always uses the last option "@media screen and (max-width: 480px)" and dont understand why?

    /* Masonry Grid Styles */
    .cmg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    }

    .cmg-grid-item {
    background-color: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .cmg-thumbnail img {
    width: 100%;
    height: auto;
    }

    .cmg-excerpt {
    padding: 15px;
    }

    .cmg-excerpt h2 {
    font-size: 18px;
    margin: 0;
    padding-bottom: 10px;
    }

    .cmg-excerpt p {
    font-size: 14px;
    margin: 0 0 15px;
    color: #555;
    }

    .cmg-read-more {
    display: inline-block;
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 4px;
    }

    .cmg-read-more:hover {
    background-color: #0056b3;
    }

    /* Responsive Design */
    @media screen and (max-width: 768px) {
    .cmg-grid {
    grid-template-columns: repeat(2, 1fr);
    }
    }

    @media screen and (max-width: 480px) {
    .cmg-grid {
    grid-template-columns: 1fr;
    }
    }

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.