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

Filter for SVG color, use only flex

accessibility
Chyunjet•620
@Jetyun
A solution to the Clipboard landing page challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Other than using root and class combination, is there more way to write a easier maintainable and readable CSS?

useful website: https://stackoverflow.com/questions/22252472/how-to-change-the-color-of-an-svg-element

Good god, i tried fill in CSS, change the fill in SVG files, none works. Until I used filter and it worked like magic, the SVG files just turn into Cyan like i want them to be. Thanks Stackoverflow.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • David•7,960
    @DavidMorgade
    Posted almost 3 years ago

    **Hello Jetyun, congrats on finishing the challenge I'm glad that you found out how to change the color for svg, good job with the layout and the responsiveness, it looks great! **

    Let me try to answer your question:

    • First of all, consider moving to a preprocessor like SASS / LESS to have a more readable / mantainable code, you will have everything separated, mixins, variables, indentation, functions... impossible to make a more mantinable code as making CSS almost like a programing language.

    Apart from that point of view, if you don't want to go for SASS, there are a lot of tricks that you can do in your CSS to make it more readable and easyt to change, let me try to resume them:

    1. Use a naming convention such as BEM, it will give your classes more sense, they will be easier to understand and you will also never run about ideas for selectors or classnames.

    2. Try giving the default styles of different elements right on the start of your CSS file, for example the sizes of headings, size of paragraph, colors, for example:

    h1 {
      font-size: 3rem;
      font-weight: 700;
      line-height: 2.2;
      color: #fff;
    }
    h2, h3, h4 {
       font-size: 1.8rem;
      font-weight: 400;
       line-height: 3;
    }
    
    1. Create utility classes like containers, margins etc... Why someone would write margin-top; 4rem for every section? just add the class margin-top that you created to stop repeating margin-top! (I saw that you used this trick in your solution).

    2. Don't use pixels, try to use always relative units such as ems and rems, pixels just for special cases.

    Hope my feedback helps you, great work with the solution, if you have any questions, don't hesitate to ask!

    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