Skip to content

Commit

Permalink
Merge pull request #105 from ash413/picture-dimensions-css
Browse files Browse the repository at this point in the history
  • Loading branch information
idna001 authored Nov 2, 2024
2 parents e40eed3 + 1ee5180 commit 4e4bd6d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 30 deletions.
37 changes: 27 additions & 10 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ button:hover {
grid-gap: 20px;
}

@media screen and (max-width: 600px) {
.card-grid {
margin-top: 40px;
margin-left: 5px;
margin-right: 5px;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: 10px;
}
}

#theme-toggle{
position: absolute;
Expand Down Expand Up @@ -77,4 +67,31 @@ div.animation {
}
}

/*Responsive design */
@media screen and (max-width: 800px) {
.card-grid {
margin-top: 40px;
margin-left: 5px;
margin-right: 5px;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: 10px;
}
}

@media screen and (max-width: 600px) {
.card-grid {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 5px;
}
}

@media screen and (max-width: 390px) {
.card-grid{
display: grid;
grid-template-columns: 1fr;
align-items: center;
align-content: center;
}
}
53 changes: 33 additions & 20 deletions src/components/SingleCard.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.card {
position: relative;
display: grid;
place-items: center;
}
.card img {
display: block;
Expand All @@ -9,6 +11,8 @@

.card .front-container {
display: flex;
justify-content: center; /* Center the content horizontally */
align-items: center; /* Center the content vertically */
}

.card .front {
Expand All @@ -17,24 +21,7 @@
background-color: fff;
position: absolute;
}
@media screen and (max-width: 800px) {
.card .front {
object-fit: unset;
position: absolute;
}
.front-background {
object-fit: scale-down;
border: unset !important;
filter: unset;
display: none;
}
.card img {
display: block;
border: 2px solid #fff;
border-radius: 6px;
width: 100px;
}
}

.front-background {
object-fit: cover;
width: 200px;
Expand All @@ -43,8 +30,10 @@
}

.flipped .front {
transform: rotateY(0deg);
}
transform: rotateY(0deg) translateX(0); /* Keep translateX(0) to avoid horizontal shift */
margin: 0 auto; /* Ensure margins don't cause shifting */

}

.card .back {
transition: all ease-in 0.2s;
Expand All @@ -54,4 +43,28 @@
.flipped .back {
transform: rotateY(90deg);
transition-delay: 0s;
}

/*Responsive design*/
@media screen and (max-width: 800px) {
.card .front {
object-fit: unset;
position: absolute;
}
.front-background {
object-fit: scale-down;
border: unset !important;
filter: unset;
display: none;
}
.card {
padding-top: 10px;
padding-bottom: 10px;
}
.card img {
display: block;
border: 2px solid #fff;
border-radius: 6px;
width: 90%;
}
}

0 comments on commit 4e4bd6d

Please sign in to comment.