Advertisement
loloof64

Udemy CSS3 course exercise - My solution

Mar 16th, 2021
1,360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 3.36 KB | None | 0 0
  1. * {
  2.   box-sizing: border-box;
  3. }
  4.  
  5. body {
  6.   font-family: "Montserrat", sans-serif;
  7.   margin: 0;
  8. }
  9.  
  10. .backdrop {
  11.   position: fixed;
  12.   display: none;
  13.   top: 0;
  14.   left: 0;
  15.   z-index: 100;
  16.   width: 100vw;
  17.   height: 100vh;
  18.   background: rgba(0, 0, 0, 0.5);
  19. }
  20.  
  21. .main-header {
  22.   width: 100%;
  23.   position: fixed;
  24.   top: 0;
  25.   left: 0;
  26.   background: #2ddf5c;
  27.   padding: 0.5rem 1rem;
  28.   z-index: 1;
  29. }
  30.  
  31. .main-header > div {
  32.   display: inline-block;
  33.   vertical-align: middle;
  34. }
  35.  
  36. .toggle-button {
  37.   width: 3rem;
  38.   background: transparent;
  39.   border: none;
  40.   cursor: pointer;
  41.   padding-top: 0;
  42.   padding-bottom: 0;
  43.   vertical-align: middle;
  44. }
  45.  
  46. .toggle-button:focus {
  47.   outline: none;
  48. }
  49.  
  50. .toggle-button__bar {
  51.   width: 100%;
  52.   height: 0.2rem;
  53.   background: black;
  54.   display: block;
  55.   margin: 0.6rem 0;
  56. }
  57.  
  58. .main-header__brand {
  59.   color: #0e4f1f;
  60.   text-decoration: none;
  61.   font-weight: bold;
  62.   font-size: 1.5rem;
  63.   height: 1.5rem;
  64.   /* width: 20px; */
  65.   display: inline-block;
  66.   vertical-align: middle;
  67. }
  68.  
  69. .main-header__brand img {
  70.   height: 100%;
  71.   /* width: 100%; */
  72. }
  73.  
  74. .main-nav {
  75.   display: inline-block;
  76.   text-align: right;
  77.   width: calc(100% - 122px);
  78.   vertical-align: middle;
  79. }
  80.  
  81. .main-nav__items {
  82.   display: none;
  83. }
  84.  
  85. .main-nav__item {
  86.   display: inline-block;
  87.   margin: 0 1rem;
  88. }
  89.  
  90. .main-nav__item a,
  91. .mobile-nav__item a {
  92.   text-decoration: none;
  93.   color: #0e4f1f;
  94.   font-weight: bold;
  95.   padding: 0.2rem 0;
  96. }
  97.  
  98. .main-nav__item a:hover,
  99. .main-nav__item a:active {
  100.   color: white;
  101.   border-bottom: 5px solid white;
  102. }
  103.  
  104. .main-nav__item--cta a,
  105. .mobile-nav__item--cta a {
  106.   color: white;
  107.   background: #ff1b68;
  108.   padding: 0.5rem 1rem;
  109.   border-radius: 8px;
  110. }
  111.  
  112. .main-nav__item--cta a:hover,
  113. .main-nav__item--cta a:active,
  114. .mobile-nav__item--cta a:hover,
  115. .mobile-nav__item--cta a:active {
  116.   color: #ff1b68;
  117.   background: white;
  118.   border: none;
  119. }
  120.  
  121. .main-footer {
  122.   background: black;
  123.   padding: 2rem;
  124.   margin-top: 3rem;
  125. }
  126.  
  127. .main-footer__links {
  128.   list-style: none;
  129.   margin: 0;
  130.   padding: 0;
  131.   text-align: center;
  132. }
  133.  
  134. .main-footer__link {
  135.   display: block;
  136.   margin: 0 1rem;
  137. }
  138.  
  139. .main-footer__link a {
  140.   color: white;
  141.   text-decoration: none;
  142. }
  143.  
  144. .main-footer__link a:hover,
  145. .main-footer__link a:active {
  146.   color: #ccc;
  147. }
  148.  
  149. .mobile-nav {
  150.   display: none;
  151.   position: fixed;
  152.   z-index: 101;
  153.   top: 0;
  154.   left: 0;
  155.   background: white;
  156.   width: 80%;
  157.   height: 100vh;
  158. }
  159.  
  160. .mobile-nav__items {
  161.   width: 90%;
  162.   height: 100%;
  163.   list-style: none;
  164.   margin: 10% auto;
  165.   padding: 0;
  166.   text-align: center;
  167. }
  168.  
  169. .mobile-nav__item {
  170.   margin: 1rem 0;
  171. }
  172.  
  173. .mobile-nav__item a {
  174.   font-size: 1.5rem;
  175. }
  176.  
  177. .button {
  178.   background: #0e4f1f;
  179.   color: white;
  180.   font: inherit;
  181.   border: 1.5px solid #0e4f1f;
  182.   padding: 0.5rem;
  183.   border-radius: 8px;
  184.   font-weight: bold;
  185.   cursor: pointer;
  186. }
  187.  
  188. .button:hover,
  189. .button:active {
  190.   background: white;
  191.   color: #0e4f1f;
  192. }
  193.  
  194. .button:focus {
  195.   outline: none;
  196. }
  197.  
  198. .open {
  199.   display: block !important;
  200. }
  201.  
  202. @media (min-width: 40rem) {
  203.   .toggle-button {
  204.     display: none;
  205.   }
  206.  
  207.   .main-header__brand {
  208.     height: 2.3rem;
  209.   }
  210.  
  211.   .main-nav__items {
  212.     display: block;
  213.     margin: 0;
  214.     padding: 0;
  215.     list-style: none;
  216.   }
  217. }
  218.  
  219. @media (min-width: 40rem) {
  220.   .main-footer__link {
  221.     display: inline-block;
  222.     margin: 1rem;
  223.   }
  224. }
  225.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement