Design comparison
Solution retrospective
Hey, guys! I would appreciate some advice.
- Is there a way for me to transition button that has gradient color?
- Is there a better way to fill the screen when viewing in mobile?
- The mobile layout gets destroyed when width of screen is below 300px. How can I fix this?
Community feedback
- @Shadow-IO-oIPosted over 1 year ago
γγγ«γ‘γ―
I looked at your code and have some ideas to resolve some issues.
- There are several ways to solve the hover issue for the button:
/* 1 */ button { margin-top: 2.5625rem; width: 18rem; height: 3.5rem; border-radius: 8rem; font-style: normal; font-weight: 700; font-size: 1.125rem; line-height: 1.4375rem; text-align: center; color: #FFFFFF; background: linear-gradient(180deg, #303B59, transparent), #303B59; transition: background-color 1s; } button:hover { cursor: pointer; background: linear-gradient(180deg, #7755FF, transparent), #2F2CE9; background-color: #2F2CE9; color: #fff; }
The second way to solve the issue is by creating a pseudo-object.
/* 2 */ button { margin-top: 2.5625rem; width: 18rem; height: 3.5rem; border-radius: 8rem; font-style: normal; font-weight: 700; font-size: 1.125rem; line-height: 1.4375rem; text-align: center; color: #FFFFFF; position: relative; z-index: 2; background: #303B59; overflow: hidden; } button::after{ content: ''; position: absolute; width: 100%; height: 100%; top: 100%; left: 0%; background: linear-gradient(180deg, #7755FF, transparent), #2F2CE9; z-index: -1; transition: all 0.3s ease 0s; } button:hover{ cursor: pointer; } button:hover::after{ top: 0%; }
2 To solve other issues, it is necessary to rewrite the code a bit.
Write to me if you're interested.
Happy coding!
I wrote γγγ«γ‘γ― because I saw <html lang="ja"> in your code. So, I apologize if I offended you.
Marked as helpful0@ANS0025Posted over 1 year ago@Shadow-IO-oI
Thanks for the feedback! I'll try the solutions you've shared.
Also, I would appreciate it if you could share the solutions to my other issues too. (Maybe share a github link of the revised code?)
p.s. I'm based in Japan so no offense taken!
0@Shadow-IO-oIPosted over 1 year ago@ANS0025 I looked at your code one more time and fixed the problems. If you are interested, here's a link to my repository on GitHub: π¦- Click me - π¦. Also, I made a third solution for the button that seems to be better than what I had before.
0 - @0xabdulkhaliqPosted over 1 year ago
Hello there π. Congratulations on successfully completing the challenge! π
- I have other recommendations regarding your code that I believe will be of great interest to you.
DECORATIVE SVG'S β¨οΈ:
- The
alt
attribute is used to provide alternative text for images in HTML documents. Thealt
attribute is used by screen readers to describe the image to visually impaired users, which is essential for web accessibility.
- Now, when it comes to decorative
SVGs
, they are used purely for aesthetic purposes and do not convey any important information or functionality to the user.
- Since these images do not convey any important information or functionality, there is no need for an
alt
attribute.
- So feel free to set the
alt
attribute as""
for decorativesvg's
, becausealt=""
will be skipped by screen readers they will consider the image as decoration
Example:
<img src="images/decorative.svg" alt="">
<img src="images/icon-reaction.svg" alt="thunderbolt icon"> π <img src="images/icon-reaction.svg" alt="">
.
I hope you find this helpful π Above all, the solution you submitted is great !
Happy coding!
Marked as helpful0@ANS0025Posted over 1 year ago@0xAbdulKhalid
Thanks for the helpful advice as always!
0
Please log in to post a comment
Log in with GitHubJoin 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