Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 1 year ago

Social links profile using html and vanilla

JacobKnittle•110
@JacobKnittle
A solution to the Social links profile 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?

I am improving with my figma file use.

What challenges did you encounter, and how did you overcome them?

getting the li and anchor tags to work together on a hover which I used the inherit value so that the text would also change on an li hover

What specific areas of your project would you like help with?

not much on this one pretty straight forward for me

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Kira Tantari•180
    @KirativeWD
    Posted about 1 year ago

    Hi there!

    Great job completing this project.

    I noticed you mentioned that you initially had some difficulty getting the hover to work and I wanted to give you a tip from what I saw in your CSS. Currently, the li has the hover state. This can make it confusing for users (if this were an active page) because when the li changes colors, you'd expect to be able to click anywhere for the link to work—but it doesn't work that way. And if a user were to tab to the links, the colors would not change. So what can be updated to improve user experience and make the hover state easier to apply?

    a {
      display: block;
    }
    

    Anchor tags have an initial display value of inline. This makes it so that its width is constricted to its content. When you change the value of display to block, the anchor tags will now behave as any regular block-level element and fill its parent's width and padding can be used to achieve the intended height. However, you will encounter a problem because you're using flex and setting defined heights/widths. This can easily be fixed by adjusting the CSS like so...

    .social-links {
      width: 100%;
    }
    
    /* remove all li styles */
    

    .social-links only needs width: 100% because it's a flex child. But why remove all styles from the li? They're all going to be applied to the anchor tag which is how we'll make applying hover styles much easier! I will show you what selector to use instead.

    li:not(:last-of-type) { // <-- Selects all li except the last in the list
      margin-bottom: 1rem; // <-- So we can get the space between each element
    }
    
    a {
      display: block; // <-- To allow block-level styling applications
      background: #333;
      color: white;
      padding-block: 1rem;
      border-radius: 8px;
      transition: all 200ms ease-in-out; // <-- Just for fancy transitioning
    }
    
    a:is(:hover, :focus-visible) { // <-- Applies styles when hovering and tabbing
      color: black;
      background-color: #c4f82a;
    }
    

    With the prior applications, you now have hoverable links that are clickable within the entire box and change color when hovered and tabbed to.

    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