In this short exercise, you'll practice writing media queries to conditionally apply styles at different screen sizes. Remember, in a mobile-first approach, the default styles are built for small screens, and media rules are written to enhance the layout on larger screens.
This is the desired layout for large screens (>768px):
And this is the layout for small screens:
As described in module-4, start by forking and cloning this repository. Then, in your css/main.css
file, apply the following styles:
- Elements with class
wrapper
should displayinline-block
, have a font-size of2rem
, be wrapped in a2px solid white
border, and have a background of#dad9d9
. - The
<div>
with idphoto
should have a height of 400px and a gray background. - The paragraph inside the div with id
photo
should have a font-size of2rem
, should render text in the colorwhite
, and should align it's text in the center.
Apply the following styles when the screen is larger than 768px:
- Elements with class
wrapper
should have a width of 50%. - The paraphgrah inside the div with id
photo
should be hidden. - The element with id
photo
should have a background image that renders the photo in theimgs/
folder. The background size shouldcover
the div, and it should not repeat.
See complete
branch for answers.