This was super difficult for me but with the help of my friend Emmanuel, I know so much more about responsive design as a whole the project I worked on after getting frustrated with this one was the "Order Summary Component" so I'll be resubmitting this one with my newly heightened abilities in responsive design. any feedback is welcome but understand that I know a lot more now than I did when I stopped working on this one.
riverCodes
@riverCodesAll comments
- @Hazel-BlackSubmitted over 2 years ago
- @nabil4416Submitted over 2 years ago
my head is broken, can someone take a look at this test, I started with the creation of the mobile design, then I wanted to switch to the desktop screen, of course using the flex display, and I I found that the first box is smaller than the others, I found myself having to change the width of the desktop design... what do you say about it?
@riverCodesPosted over 2 years agoI think you should use Grid for this, set a width: 100% on the individual cards and use grid-template-columns to create the mobile and desktop layout. An alternative approach would be to create the mobile design first, then set that width to be the max-width of the <main> and the individual blocks. In the desktop design, triple that width, and if all your cards are of the same width, they should slot into place.
1 - @Rebooting-MeSubmitted over 2 years ago
- I found that including the eye on image hover without the reduced opacity to be quite hard and am unsure of how I could implement it.
- Also I am a newbie in responsive design so if anyone can point me out to the right resources to learn it I would really appreciate that!
@riverCodesPosted over 2 years agoHi, okay, good job on the challenge. Well done on the card-content layout. For feedback,
- To fix your Accessibility and HTML issues,
- change the div that contains the entire card (and only the card) to a <main> tag. Always have a main tag for the main content of your page. Keep the div.attributions (footer) outside of the main tag. You should change that div to a <footer> tag as well.
- Always use one <h1> element on the page.
- Once you do the above, your <main> and <footer> will need to be centered. Using
position: absolute
to center stuff isn't ideal as it lifts it up from the Flow Of The Document. Other elements that you put on the page will ignore the former and slip underneath it. You should try this approach instead. Apply the following styles to your <body>
- min-height: 100vh; (this forces your <body> tag height to be 100% of the viewport height, by default element heights depend upon the inner content size, unlike width.)
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center; (bonus: if u want to push the footer to the bottom of the page, while keeping your main centered check this resource out https://every-layout.dev/layouts/cover/
- For the image overlay effect, you need to first wrap your image in a <a> tag. This is what will redirect users to whatever you want on clicking the image. You have already done this for the title, do the same for the <img>.
- First, wrap with <a>
- Set <img> display to block.
- Use img::before as the color overlay and img::after as the eye-icon.
position: relative
on the img andposition: absolute
on the pseudo elements.- in ::before, set
content: ""
(empty string), and in ::after, setcontent: url(eyeicon.svg)
. style these appropriately. - position the ::before to take up 100% of <img> and ::after to sit in the center. Use z-index property to fix any layering issues
- Next, you should apply the styles on hover (img:hover::before and img:hover::after). (pseudo classes are indicated by : and always go before pseudo elements, indicated by ::, if they are used together)
- Use opacity: 1; and on the non-hovered states, opacity: 0; Put the transition property on the non hovered state.
Aaaaaand that should be it, hope this helps! let me know if you have any doubts, and good luck :)
Marked as helpful1 - @Mathi-AlaganSubmitted over 2 years ago
The tricky part was designing the hovering state of the nft-image, where while hovering the image it should display a translucent cyan color with a icon-view svg at the middle of it. I created a div with the size of the image, inside it kept the icon-view svg. It was set to appear while hovering the nft-image, also I set the cursor to pointer to make it seem like hovering a link. I'm unsure if this technique is good or not. Please suggest me an efficient method where it would be understandable and accessible for all type of users.
Also, please review my code and suggest me your valuable points to improve it more.
@riverCodesPosted over 2 years agoHi, good job on the challenge. Your code is clean and well commented :). For feedback,
- Regarding the image overlay, you have almost got it. Your hover transition isn't applied to when the :hover falls off. But most importantly, you need to wrap the <img> in a <a> tag and redirect to wherever you wish to on click. A better approach would be to use <img> pseudo elements.
- First, wrap with <a>
- Set <img> display to block.
- Use img::before as the color overlay and img::after as the eye-icon.
position: relative
on the img andposition: absolute
on the pseudo elements.- in ::before, set
content: ""
(empty string), and in ::after, setcontent: url(eyeicon.svg)
. style these appropriately. - position the ::before to take up 100% of <img> and ::after to sit in the center. Use z-index property to fix any layering issues
- Next, you should apply the styles on hover (img:hover::before and img:hover::after). (pseudo classes are indicated by : and always go before pseudo elements, indicated by ::, if they are used together)
- Use opacity: 1; and on the non-hovered states, opacity: 0; Put the transition property on the non hovered state.
- You probably want to center your main component vertically on the page. To do this, apply the following styles to your <body>
- min-height: 100vh; (this forces your <body> tag height to be 100% of the viewport height, by default element heights depend upon the inner content size, unlike width.)
- display: flex;
- flex-direction: column;
- justify-content: center;
- To fix your Accessibility and HTML issues,
- change the div that contains the entire card to a <main> tag. Always have a main tag for the main content of your page.
- Always use one <h1> element on the page.
- one of your images doesn't have an alt tag. always put alt tags, and leave them empty if they are decorative.
Pretty long comment, hopefully it helps you :D Good luck
Marked as helpful1 - @FloraBloomblueSubmitted over 2 years ago
I want to know is my code acceptable? It's my first time attempting projects on site and submitting challenges.
@riverCodesPosted over 2 years agoHi, good job on the challenge! You have nailed the inner contents of the card. A few suggestions:
- to fix your Accessibility issues, first change your div.rectangle-box to a <main> tag. (main.rectangle-box) Secondly, your page should always have one <h1> element.
- You probably want to center your main component vertically on the page. To do this, apply the following styles to your <body>
min-height: 100vh; (this forces your <body> tag height to be 100% of the viewport height, by default element heights depend upon the inner content size, unlike width.) display: flex; flex-direction: column; justify-content: center;
hope this helps, good job once again :D
Marked as helpful1 - @mguachunSubmitted over 2 years ago
Is there anything I can do to make this more responsive for different screen sizes?
I had a lot of trouble getting the image to scale within the card
@riverCodesPosted over 2 years agoHi, you don't need media queries or responsive anything for this challenge - this is just a static card design. At most it should be centered vertically and horizontally on the page. Anything more would be overkill. Besides that, I would suggest you a few improvements you could make.
-
Your HTML indentation could be better, at the moment it is not quite readable.
-
Your div.card-body doesn't have a closing tag. I think this is why your div.attribution is inside the card.
-
To fix your HTML and Accessibility issues, wrap your main card in a <main> tag and your .attribution in a <footer> tag. Also, your page should always contain one <h1> element. Also, in line #21 of your HTML you have misspelt your href attribute as hred.
-
Try using nested Flexbox's to create the layout of content inside the card.
-
I can't see the active states in your design.
- You have the right approach in using ::after pseudo element for the eye-icon. You should also use ::before for the color overlay between the thumbnail and the eye-con.
- Next, you should apply the styles on hover (div:hover::before and div:hover::after).
(pseudo classes are indicated by : and always go before pseudo elements, indicated by ::, if they are used together)
- Use opacity: 1; and on the non-hovered states, opacity: 0; Put the transition property on the non hovered state.
I hope that's helpful. Let me know if you would like further clarification. Besides all that, the actual size of your card is spot on. It is centered as well. You don't need to make it anymore responsive. Your image styling is correct as well :D
0 -
- @insertQuirkyNameHereSubmitted over 2 years ago
The styles that I've specified for the overlay don't seem like they're the most accessible. Any suggestions on how to improve that part are very welcome.
Please feel free to comment on any other feature that could be improved on.
@riverCodesPosted over 2 years agoHi, for the image overlay, here's what I would recommend:
-
wrap your <img> tag in a <a> tag. This is what should link to the content page when the user clicks on it.
-
position: relative;
on the <img>. Then, use pseudo elements img::before and img::after.position: absolute;
on both of them. this will create two children of the <img> which will be lifted up from the flow of the document and will be positioned relative to your <img> -
The ::before will be the color. Set
content: "";
(empty string), and top: 0, left: 0, width: 100%, height: 100%. set the color of your choice. -
the ::after will be the eye. Set
content: "url(eye-icon-here)";
and position it to the center similarly. -
Set hover states on the pseudo elements. For example, img:hover::before and img:hover::after. In the hover pseudo elements, apply
opacity: 1;
. In img::before and img::after, applyopacity: 0;
. This will make it so that when the user hovers on the pseudo elements, the styles appear and when not hovered, nothing happens. -
You can make the transition smoother by applying
transition: opacity .5s ease;
to the ::before and ::after elements.
Besides that, good job. You are kinda getting some HTML errors because of commenting that way and whatever secret stuff you implemented :P
1 -
- @neuyannSubmitted over 2 years ago
modified the active state but it doesnt work for the main image..
@riverCodesPosted over 2 years agoSo for the active states, here's what you need to do.
-
wrap your <img> tag in a <a> tag. This is what should link to the content page when the user clicks on it.
-
position: relative;
on the <img>. Then, use pseudo elements img::before and img::after.position: absolute;
on both of them. this will create two children of the <img> which will be lifted up from the flow of the document and will be positioned relative to your <img> -
The ::before will be the color. Set
content: "";
(empty string), and top: 0, left: 0, width: 100%, height: 100%. set the color of your choice. -
the ::after will be the eye. Set
content: "url(eye-icon-here)";
and position it to the center similarly. -
Set hover states on the pseudo elements. For example, img:hover::before and img:hover::after. In the hover pseudo elements, apply
opacity: 1;
. In img::before and img::after, applyopacity: 0;
. This will make it so that when the user hovers on the pseudo elements, the styles appear and when not hovered, nothing happens. -
You can make the transition smoother by applying
transition: opacity .5s ease;
to the ::before and ::after elements. -
Additionally, change your div.attribution to footer.attribution. That will solve the last accessibility issue you have.
Hope this helps!
Marked as helpful0 -
- @knyghttechSubmitted over 2 years ago
I am a complete beginner at HTML and CSS. I found this a difficult challenge. I know that my code does not allow for mobile friendly devices. I am still trying to figure that out along with alot of other things that I need to improve on. I was able to replicate the challenge in my own way, but it definitely is not a good way. I would like any feed back on how I could make this code better and learn how to make it a more reliable and successful site.
Thank you
@riverCodesPosted over 2 years agoHi! Congrats on completing the challenge :D First off, don't be too harsh on yourself! The content inside the card looks great. The fact that you are commenting your code is impressive. The design doesn't need to be responsive in this challenge so don't worry about it being mobile-friendly.
The main issues that you have at the moment is centering your main component (which will tackle the mobile-screen issue) and the light-blue eye overlay on the image hover. You also have a few Accessibility issues. Lets see how you can fix those:
- For your Accessibility issues first,
-put alt attributes on your images and icons. -Change your div.container to main.container (<main class="container">). -The whole page needs to have at least one <h1> tag.
- Check out this resource https://every-layout.dev/layouts/cover/. It provides a standard way of centering your component that you can use in a lot of these single-card frontend-mentor challenges. In short, apply this CSS to your body tag:
min-height: 100vh display: flex; flex-direction: column; align-items: center; justify-content: center;
What this will do is, force your <body> tag to cover 100% of the viewport height (by default, element heights usually depend on inner content height). Then you can turn your <body> into a flex-container, and then use flex-properties to center your content. Then, apply this CSS to your <main>:
margin-block: auto;
. Now your content is properly centered!- Coming to the issue of the image overlay, what you have done by wrapping your image with a <a> tag is absolutely correct. From there,
-you need to set a `position: relative` on your <img>. -then, create two <img> pseudo elements ::before and ::after. use `position: absolute;` on these. -on the ::before, set a `content: ""; (empty string), then style it to cover 100% of your <img> and give it the blue color. -then, set a `content: url(eye-icon-url);` on the ::after. Position it to be at the center. -then, set both ::before and ::after to show only when hovered on the image. (use :hover pseudo classes)
This has been quite a long comment, I hope it is helpful! Good job and keep learning :D
0 - @Rebooting-MeSubmitted over 2 years ago
- I found that including the eye on image hover without the reduced opacity to be quite hard and am unsure of how I could implement it.
- Also I am a newbie in responsive design so if anyone can point me out to the right resources to learn it I would really appreciate that!
@riverCodesPosted over 2 years agoHi, your live site isn't up! Could you check it out, I'll be able to help you out then! :)
0 - @neuyannSubmitted over 2 years ago
modified the active state but it doesnt work for the main image..
@riverCodesPosted over 2 years agoHi, congrats on completing the challenge. The content inside the card looks great! I just commented on someone else's solution of the same challenge, and i notice similar issues in yours as well so I'm going to carry my feedback over to here.
- For the HTML and Accessibility issues,
-put alt attributes on your images and icons. -Change your div.cardBG to main.cardBG (<main class="cardBG">). -Whenever you use a section, it needs to have one heading element inside it, and the whole page needs to have at least one <h1> tag.
- You haven't implemented the active states yet. I don't know if it's because you missed it on the design references and you know how to achieve it, or if its because you don't know how to achieve it. If you want help with this I can help you out further.
Besides that, I think the rest is good! Keep learning!
Marked as helpful0 - @Kratos012Submitted over 2 years ago
First time I worked on something without any issues and it was also the first time I used Grid. Before, I always worked with flex. Felt very satisfied , won't lie😅. Guess there's some progress.
Any feedback will be highly appreciated as always. Thx.
@riverCodesPosted over 2 years agoGrid is amazing! I hope I am not breaking community guidelines but i just wanted to say this >D
1