Product preview card component

Solution retrospective
there is my first projection after I learn css and html myself for a month. There are a lot of mistakes, I would like to gain advices from everybody. In addition, I would like to ask How to make a box sized to hold images and content without having to set the width to be half the width of the box containing them.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @fibonacci001
hi, @Meowmeow11120 congrats on completing your tasks, about the question you asked, i have some advice for you. There are a few different ways to create a box that can hold images and content without having to set the width to be half the width of the container. Here are a few options:
- Use the "display: flex" property on the container element, and set the "flex-wrap" property to "wrap". This will allow the items inside the container to automatically wrap to the next line if there isn't enough horizontal space. Here's an example CSS: .container { display: flex; flex-wrap: wrap; }
- Use the "max-width" property instead of the "width" property on the container element. This will allow the container to shrink to the size of its contents, but won't expand beyond the maximum width specified. Here's an example CSS: .container { max-width: 800px; /* set your desired maximum width */ }
- Use the "inline-block" display property on the items inside the container, and set the "vertical-align" property to "top". This will allow the items to stack vertically, and the container will automatically adjust to the height of the tallest item. Here's an example CSS: .item { display: inline-block; vertical-align: top; } i hope you find them useful on your next tasks
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord