Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 5 months ago

Product Page Project - Javascript and CSS

Crystalis89•460
@Crystalis89
A solution to the E-commerce product page challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

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.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Huy Phan•3,430
    @huyphan2210
    Posted 5 months ago

    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 the text-wrap: balance attribute with text-wrap: normal. It should work like you'd like it to.

    Hope this helps!

    Marked as helpful

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub