Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 3 years ago

HTML and responsive CSS with a mobile 1st approach

Bechara Aad•10
@Bechara-Aad
A solution to the Profile card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi everyone!

1st challenge! putting my HTML/CSS learning to the test.

Through this challenge, I appreciated learning more about manipulating the background in the body for it to dynamically adapt to different screens.

One small niggle that I noticed, I believe the white border around the profile image in the card is not completely 100% enclosing the image. As if there is a very thin circle in-between the white border and the image where I can see through into the backround. This effect is more visible on some zoom levels in the browser.

How can this be corrected in code? Also, thank you for reviewing my solution and offering any instructive feedback.

The support of this community is truly appreciated, and I'm looking forward to more challenges that help us grow together.

Bechara,

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Noemi Gali•280
    @NomiDomi
    Posted over 3 years ago

    Hey @Bechara-Aad,

    First I'd like to congratulate you on completing your first challenge! :) Great job!

    You are completely right about the border not enclosing 100% the image. One way around this is to put a background-color: white in the same class where you set the border. In your case

    .profile {
      border: 0.3rem solid white;
      border-radius: 50%;
      position: relative;
      bottom: 1rem;
    }
    

    becomes

    .profile {
      border: 0.3rem solid white;
      border-radius: 50%;
      position: relative;
      bottom: 1rem;
      background-color: white;
    }
    

    This works great for this project, but sometimes it might not be sufficient. Read this for other methods of dealing with the issue.

    Now looking at your code, here are some additional tips on my side:

    • best practice is to use kebab case when naming your classes. So basically your class card__header should have been written like card-header
    • great job on not using divs everywhere. It's really great to see you picking things like <header class="card__header"> instead. However if you use html tags like this, there is no need to give them a class name same as the html tag. Just simply write <header> and put your css style on header instead of the class .card__header
    • even though I am happy to see you trying out other tags than div, the use of header and footer in this case could have been replaced with section. Headers and footers are usually part of a page (like in Word). They aren't really used for inside a card container like in this case
    • I see that you are having your styles divided between your html and css files. Best practice is to keep everything in one place (in the css file), so in your case move the style section from your html in your styles.css file.
    • for clean code, I would suggest you take a look at CSS variables. On big projects this is a must. :)
    • great use of the different type of units. Keep that up!

    Hope this helps! Again, great job and keep coding! :)

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