How to have opposite paragraphs on same line closer?
when I reduce the size of the window is ok but the item and the price are too far away from each other on full desktop view
the problem is the width definition for .product
it says that you want that one element (the first left-hand-side paragraph) to take up 75% of available width space.
Instead of that, use auto for the width and modify the margins if you want to make a specific type of spacing.
You can alternatively look into using CSS flex layout (google for more info).
Give the parent container with the class “.item” the max width in %, how much is depending on how close you want the products and prizes togther. Here I used 75%:
thanks I tried it, basically it is either more gap that I intend to have in the desktop view or not enough gap in the mobile view between .product and .cost
The goal is to make this online menu similar to a menu you would get physically
I am re-doing the freeCodeCamp projects from Responsive Web Design Certification but giving them my personal twist writing code learnt up to that specific lesson
@lasjorg In this case I am re-doing the Cafe Menu from lesson 2. I will double-check the original project and see how it looks on mobile and desktop because in that case no flexbox and no media queries were used
I think I would need to add a media query to balance the desktop and mobile view gap between .product and .cost
I figured as much, but unless you want to practice using inline-block elements and widths (for whatever reason) I still suggest using modern CSS.
There is no reason to use inline-block elements for this layout. The challenge comes before flexbox has been taught so that is probably why it is doing the layout like that, or just to show it. It isn’t bad to know about, but it also isn’t how I would do it if flexbox was an option.
All the inline-block, width, and text-align can be replaced with two lines of CSS on the .item container.
I commented out the CSS that is replaced by flexbox: