|
| 1 | +@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap"); |
| 2 | + |
| 3 | +:root { |
| 4 | + --left-bg-color: rgba(87, 84, 236, 0.7); |
| 5 | + --right-bg-color: rgba(43, 43, 43, 0.8); |
| 6 | + --left-btn-hover-color: rgba(87, 84, 236, 1); |
| 7 | + --right-btn-hover-color: rgba(28, 122, 28, 1); |
| 8 | + --hover-width: 75%; |
| 9 | + --minimize-width: 25%; |
| 10 | + --transition-speed: 1s; |
| 11 | +} |
| 12 | + |
| 13 | +* { |
| 14 | + box-sizing: border-box; |
| 15 | +} |
| 16 | + |
| 17 | +body { |
| 18 | + font-family: "Roboto", sans-serif; |
| 19 | + height: 100vh; |
| 20 | + overflow: hidden; |
| 21 | + margin: 0; |
| 22 | +} |
| 23 | + |
| 24 | +h1 { |
| 25 | + font-size: 4rem; |
| 26 | + color: #fff; |
| 27 | + position: absolute; |
| 28 | + left: 50%; |
| 29 | + top: 20%; |
| 30 | + transform: translateX(-50%); |
| 31 | + white-space: nowrap; |
| 32 | +} |
| 33 | + |
| 34 | +.btn { |
| 35 | + color: #fff; |
| 36 | + position: absolute; |
| 37 | + display: flex; |
| 38 | + align-items: center; |
| 39 | + justify-content: center; |
| 40 | + left: 50%; |
| 41 | + top: 40%; |
| 42 | + transform: translateX(-50%); |
| 43 | + border: #fff solid 0.2rem; |
| 44 | + text-decoration: none; |
| 45 | + font-size: 1rem; |
| 46 | + font-weight: bold; |
| 47 | + text-transform: uppercase; |
| 48 | + width: 15rem; |
| 49 | + padding: 1.5rem; |
| 50 | +} |
| 51 | + |
| 52 | +.split.left .btn:hover { |
| 53 | + background-color: var(--left-btn-hover-color); |
| 54 | + border-color: var(--left-btn-hover-color); |
| 55 | +} |
| 56 | + |
| 57 | +.split.right .btn:hover { |
| 58 | + background-color: var(--right-btn-hover-color); |
| 59 | + border-color: var(--right-btn-hover-color); |
| 60 | +} |
| 61 | + |
| 62 | +.container { |
| 63 | + position: relative; |
| 64 | + width: 100%; |
| 65 | + height: 100%; |
| 66 | + background: #333; |
| 67 | +} |
| 68 | + |
| 69 | +.split { |
| 70 | + position: absolute; |
| 71 | + width: 50%; |
| 72 | + height: 100%; |
| 73 | + overflow: hidden; |
| 74 | +} |
| 75 | + |
| 76 | +.split.left { |
| 77 | + left: 0; |
| 78 | + background: url("https://images.unsplash.com/photo-1606144042614-b2417e99c4e3?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80") |
| 79 | + no-repeat center / cover; |
| 80 | +} |
| 81 | + |
| 82 | +.split.left::before { |
| 83 | + content: ""; |
| 84 | + position: absolute; |
| 85 | + width: 100%; |
| 86 | + height: 100%; |
| 87 | + background-color: var(--left-bg-color); |
| 88 | +} |
| 89 | + |
| 90 | +.split.right { |
| 91 | + right: 0; |
| 92 | + background: url("https://images.unsplash.com/photo-1607853827120-6847830b38b0?ixlib=rb-1.2.1&ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&auto=format&fit=crop&w=1762&q=80") |
| 93 | + no-repeat center / cover; |
| 94 | +} |
| 95 | + |
| 96 | +.split.right::before { |
| 97 | + content: ""; |
| 98 | + position: absolute; |
| 99 | + width: 100%; |
| 100 | + height: 100%; |
| 101 | + background-color: var(--right-bg-color); |
| 102 | +} |
| 103 | + |
| 104 | +.split.left, |
| 105 | +.split.right, |
| 106 | +.split.left::before, |
| 107 | +.split.right::before { |
| 108 | + transition: all var(--transition-speed) ease-in-out; |
| 109 | +} |
| 110 | + |
| 111 | +.hover-left .left { |
| 112 | + width: var(--hover-width); |
| 113 | +} |
| 114 | + |
| 115 | +.hover-left .right { |
| 116 | + width: var(--minimize-width); |
| 117 | +} |
| 118 | + |
| 119 | +.hover-right .right { |
| 120 | + width: var(--hover-width); |
| 121 | +} |
| 122 | + |
| 123 | +.hover-right .left { |
| 124 | + width: var(--minimize-width); |
| 125 | +} |
| 126 | + |
| 127 | +@media (max-width: 800px) { |
| 128 | + h1 { |
| 129 | + font-size: 2rem; |
| 130 | + top: 30%; |
| 131 | + } |
| 132 | + .btn { |
| 133 | + padding: 1.2rem; |
| 134 | + width: 12rem; |
| 135 | + } |
| 136 | +} |
0 commit comments