Here is the codpen link with the code: https://codepen.io/gregelious/pen/zYmLGex
This is a restaurant menu with 3 categories (divs) as 3 separate boxes.
(Detailed instructions here: https://github.com/jhu-ep-coursera/fullstack-course4/blob/master/assignments/assignment2/Assignment-2.md)
These are the instructions:
I gave the div ids for "first", "second" and "third" and this is my css:
@media (min-width: 992) { div { width: 33.33%; } } @media (min-width: 768) and (max-width: 991) { #first, #second { width: 50%; } #third { width: 100%; } }
When I resize the browser window, the size of the div doesn't change and I don't know how to fix it. I received this assignment from a Coursera course and re-watched the video on media queries and other related stuff but made no progress.
I recommend using a container div to control Flex layout, as shown in the next demo:
You have to make the layout work, which is what you do with the
flex
properties (update, you need to set the units tomin-width
andmax- width
attribute, for examplepx
:min-width: 768px
)I also recommend building layouts from small to large screens (mobile first) and setting only the
@media (min-width)
css query. Consider that only if a larger media query is set, the larger media query will overwrite the previous smaller query.This is a working demo: