Created
August 29, 2020 16:16
-
-
Save wpflames/74751c394739cd099ff539746c0270a1 to your computer and use it in GitHub Desktop.
Card UI Design with CSS Flexbox - SCSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *{ | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| font-family: 'Poppins', sans-serif; | |
| } | |
| body{ | |
| width: 100%; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| min-height: 100vh; | |
| .container{ | |
| position: relative; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| max-width: 1000px; | |
| flex-wrap: wrap; | |
| .card{ | |
| position: relative; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| flex-wrap: wrap; | |
| margin: 100px 0; | |
| &:nth-child(odd){ | |
| flex-direction: row; | |
| } | |
| &:nth-child(even){ | |
| flex-direction: row-reverse; | |
| text-align: right; | |
| } | |
| .imgBx{ | |
| position: relative; | |
| left: 25px; | |
| width: 500px; | |
| height: 400px; | |
| z-index: 1; | |
| img{ | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| object-fit: cover; | |
| } | |
| } | |
| &:nth-child(even) .imgBx{ | |
| left: -25px; | |
| } | |
| &:nth-child(even) .contentBx{ | |
| left: 25px; | |
| padding: 20px 100px 20px 60px; | |
| } | |
| .contentBx{ | |
| position: relative; | |
| right: 25px; | |
| width: 500px; | |
| height: 400px; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| background: #0d1113; | |
| padding: 20px 60px 20px 100px; | |
| &:before{ | |
| content: ''; | |
| position: absolute; | |
| top: -50px; | |
| bottom: -50px; | |
| left: 0; | |
| right: 0; | |
| background: #0d1113; | |
| z-index: -1; | |
| } | |
| .content{ | |
| h2{ | |
| font-size: 30px; | |
| color: white; | |
| margin-bottom: 20px; | |
| } | |
| p{ | |
| color: white; | |
| margin-bottom: 20px; | |
| } | |
| a{ | |
| color: white; | |
| text-decoration: none; | |
| font-weight: bold; | |
| border: 1px solid; | |
| padding: 8px 15px; | |
| margin-top: 10px; | |
| display: inline-block; | |
| border-radius: 5px; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment