What are you most proud of, and what would you do differently next time?
I'm proud of contributing to accessibility by putting the <h1>
element (the product's name) first in the HTML file, followed by the category ("perfume"). The two elements appear in the reverse order when rendered on the page, to match the design file; this was achieved by wrapping the two elements in a container div, and setting the container div to display:flex; flex-direction:column-reverse
.
I'm also proud of being detail-oriented and noticing that the provided shopping-cart image was different than the one shown in the design file. I exported a replacement image from the design file, as an .svg file.
In this challenge, I used flexbox to vertically center-align the two price tags; next time I see a problem like this I'd like to do more research to try to find a different approach, because I rely on flexbox so much already.
What challenges did you encounter, and how did you overcome them?
The main challenge I came across was getting border-radius
to work with background-image
.
I had chosen to use background-image
to insert the product image, so that I could use a media query to serve either the desktop or mobile version of the image. (Another option could have been to add an <img>
element, and use a script to listen for device type and swap out the src
attribute of the <img>
as needed. However, I didn't want to risk content-jumping side effects.)
The problem I found was that when I added border-radius
to the product card, it worked fine on the corners adjacent to text, but the corners of the image were not getting rounded.
I asked a search engine, and found this page: https://floriankempenich.com/background-image-with-rounded-corners. It recommended applying container {overflow:hidden}
. I tried this and it solved the problem for me.
What specific areas of your project would you like help with?
I'd love to hear any feedback. In particular, I'm interested in: (1) how to vertically center text without using flexbox; (2) recommendations for how to include the image without using background-image
, but while still being able to serve either the desktop or the mobile version of the image, as appropriate.