diff --git a/readme.md b/readme.md index 3a460b48..cd9adcd2 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # Frontend practice with catalog page using grid Replace `` with your Github username and copy the links to Pull Request description: -- [DEMO LINK](https://.github.io/layout_catalog_grid/) +- [DEMO LINK](https://Kacper-Leman.github.io/layout_catalog_grid/) > Follow [this instructions](https://github.com/mate-academy/layout_task-guideline#how-to-solve-the-layout-tasks-on-github) diff --git a/src/index.html b/src/index.html index af41a22d..91757b71 100644 --- a/src/index.html +++ b/src/index.html @@ -17,35 +17,35 @@
- @@ -76,3 +76,4 @@ + diff --git a/src/styles/_catalog.scss b/src/styles/_catalog.scss index a63c46d7..1bfa60f6 100644 --- a/src/styles/_catalog.scss +++ b/src/styles/_catalog.scss @@ -1,22 +1,27 @@ .catalog { - display: flex; - flex-wrap: wrap; - - max-width: 944px; + display: grid; + gap: 48px; + justify-content: center; margin: 0 auto; + @media (min-width: 488px) { + grid-template-columns: repeat(2, $cardWidth); + } + + @media (min-width: 768px) { + grid-template-columns: repeat(3, $cardWidth); + } + + @media (min-width: 1024px) { + grid-template-columns: repeat(4, $cardWidth); + } + &__card { - display: flex; - justify-content: center; - align-items: center; - width: 200px; + display: grid; + place-items: center; + width: $cardWidth; height: 300px; border: 1px solid #ccc; border-radius: 5px; - margin-bottom: 48px; - } - - &__card:not(:nth-child(4n)) { - margin-right: 48px; } } diff --git a/src/styles/main.scss b/src/styles/main.scss index cf7e6948..173d4fd0 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -9,6 +9,6 @@ body { * { box-sizing: border-box; } - +@import "./utils/variables"; @import "_header.scss"; @import "_catalog.scss"; diff --git a/src/styles/utils/_variables.scss b/src/styles/utils/_variables.scss new file mode 100644 index 00000000..faad7242 --- /dev/null +++ b/src/styles/utils/_variables.scss @@ -0,0 +1 @@ +$cardWidth: 200px;