Product Page Project - Javascript and CSS

Solution retrospective
Main thing would do differently is not procrastinating so hard, the project wasn't hard but for whatever reason I stalled out for the last month losing all the momentum I had from my prior FEM projects.
On upside an example of my growing abilities is that could jump straight back in without needing to shake off the rust or needing to figure out why I made what decisions I did. Although I wouldn't be surprised if the CSS is a bit more complicated than needed due to that.
I also enjoyed writing the JS, including some elements that I struggled with in a prior project from another course last year.
What challenges did you encounter, and how did you overcome them?Was fairly smooth except for after I uploaded it to github pages it punished me for taking the lazy option of hardcoding the image number index which changed between my PC and the host. To overcome just took splitting out the image part of the address then finding the number, from there didn't need to change anything.
What specific areas of your project would you like help with?There was one thing I could not figure out what doing wrong no matter what tried, and that is the way "Fall Limited Edition Sneakers" wraps to next line after "Limited" even if there more than enough space for the whole thing. For whatever reason it seems like Edition and Sneakers are stuck together as if they one word.
Please log in to post a comment
Log in with GitHubCommunity feedback
- P@huyphan2210
Hi, @Crystalis89,
I've seen your solution and your question. Here's a possible answer:
You're using
text-wrap: balance
on your headings.The
text-wrap: balance
property in CSS is a feature that aims to improve the visual appearance of text wrapping, particularly for multiline text. Here's how it differs from the default text-wrap behavior:Default
text-wrap
Behavior- When
text-wrap
is not explicitly set (or set to its default), the browser uses its standard text-wrapping rules. - Text wraps at the nearest breaking point within the container (e.g., spaces, hyphens) to ensure the text fits within the width of the container.
- The lines of text may end up uneven in length, with some lines being much longer or shorter than others.
text-wrap: balance
Behavior- Introduced to address the aesthetic concerns of text wrapping, particularly for multiline text like headings, captions, or callouts.
- Balances the line lengths by distributing text more evenly across lines, creating a more visually appealing block of text.
- Works by calculating optimal breaking points to minimize the difference in length between the lines.
Example for Comparison
Default Wrapping:
h1 { text-wrap: normal; /* Default behavior */ }
Result:
A long heading with unbalanced wrapping
Balanced Wrapping:
h1 { text-wrap: balance; }
Result:
A long heading with balanced wrapping
In conclusion, if you don't want your
h1
to be wrapped like you described, just overwrite thetext-wrap: balance
attribute withtext-wrap: normal
. It should work like you'd like it to.Hope this helps!
Marked as helpful - When
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