I had difficult with aligning the prices to the center and the right side height wasn't aligning with the left.
I'm not sure of the positioning code that why I didn't use it. Also not sure whether the site adapts to any display screen properly.
use main and footer for semantics. Change <div class="section"> to <main class="section">, and <div class="attribution"> to <footer class="attribution">.
look at the picture element for providing different images to the different viewport widths, plus it has a lot more uses, check it up.
don't use id for styling, use only classes.
look at providing additional information for people who use screen readers as they will not understand what two prices mean. I'm still learning about accessibility...
Your CSS has some issues, keep learning and you will notice them yourself. Feel free to look at other people's solutions for learning purposes.
alt attribute should describe the image or its function, and be empty if is only decorative. alt="Card Hero Image" gives no information. Don't use word image in alt, screen readers will read img as Image, Card Hero Image. The same with the music icon.
CSS
I wouldn't recommend splitting CSS into three files, especially in such a small project. The server will have to make additional requests to fetch each file. Look at Sass/SCSS for this.
Don't use this trick html {font-size: 62.5%;}. Read this article for more detailed information.
Setting max-width: 144rem; margin: 0 auto; to .container makes no sense as it does nothing.
Font size is too small, in the style-guide.md body text is 16px
Use resets, like displaying images as block elements, and most important making buttons inherit font from parent elements because font-family is right now set to default Arial
What did you find difficult while building the project?
-- I learn that <picture> git line height from the parent - I had white space after <picture> and I fix it with add line-height: 0; to the parent tag.
Do you have any questions about best practices?
it will be nice to know Your feedback.
Just a few suggestions/issues. I'm only studying so take my advice with a grant of salt.
component breaks from 700px to 900px, limit the width of the component or set media query to trigger earlier.
img is an inline element, most people use resets to make it display as block element that way there's no need in setting line-height to 0, especially when you need then to set it again on text elements
for centering elements we use flexbox but it doesn't work if the parent element has no height, so that is why we set min-height: 100vh; to the parent element. You don't need to repeat it on body element and on main element, use only on main. And remove min-width from both of them
Sass is a great tool but be aware of too much nesting. It creates problems with specificity in big projects. .prouduct_outer .prouduct_body .old_price {} is the same as .old_price{}.
change <div class="container"> to <main class="container">`
use relative units for the width of elements and for media queries (inside the picture element too). Change the font size in the browser to 18px and you will see the component break.
NFT preview card, made with HTML and CSS only. Had to use a bit of sass to make the eye and cyan color appear at the same time on hover, since I couldn´t figure out how to place the selectors with vanilla CSS to make it happen
Wrap in main element only card and leave attribution on its own in the footer tag.
Use relative units for media queries too. If you change the font size in the browser setting you will see that the component will break, 18px is enough to see that.
This is my first Frontend Mentor project and it was heaps of fun since it's been a while (read: 4 years) since I've built anything! Who knew trying to figure out spacing and font-sizes from just a jpg was going to be this hard? 😂 I'm sure I'll get better at it!
I didn't come across any issues, but if someone could comment on how I structured and annotated my code, that would be great! I just want to know if I'm on the right path here. Although if there are any other issues, feel free to point those out, too! :)
ETA: Okay, so I just saw the FM image preview and it looks all wack, which is weird considering it looks perfect on my browser :(
ETA: I figured out the issue! Well, not an issue really. It's just that the default font size on my browser is set to 12px (my personal preference) instead of 16px, hence the supersized look. Should I change this?
There is one issue that I found and trust that was hard because everything is perfect.
Change px to rem or em for the max-width of the card, for media queries, and for a media query in the picture element. For media queries is better to use em. Why do I consider it an issue? If you slightly increase the font size in the settings card breaks.
use main element for accessibility. Change <div class="container">...</div> to <main class="container">...</main>
alt attribute should describe an image or its function. Don't use the word image because screen readers read the tag as "image". In this case use QR code to frontendmentor.io. Read this article for more information
use h1 instead of h2, don't skip levels
CSS
use relative units to make your solution accessible
I found only a few issues with using absolute and relative units. I will explain as much as I can but here is a great article if you need more information.
Generally, you would want to use relative units like em or rem. Using rem is easier as it is based on the root font size which is by default 16px, but users can change it in the browser settings. em is based on the parent element font size that way it is harder to set precise font size, read more in the article.
In your code you set body { font-size: 15pt; }. pt is an absolute unit, which is used in print. In this case set font-size to 0,9375rem (15 / 16, 15 is your target size, and 16 is the default).
But then you set the font size of the p element to 1rem (and you override previous rule) which is 16px (by default) and h1 to 22px. This makes p change its font size according to user preferences and h1 would be stuck and not change its font size.
line-height: calc(1.27 * var(--header-font-size)); and line-heigth: 1.27; mean exactly the same.
So, generally, people set font in rem to the body element which makes other elements inherit from body
I've changed my very first project according to some good advice.
This time, I can't understand why my text area is higher than the design file's text area. I checked my elements positions and they are in the same positions as the figma files. What should I do? Thanks.
Also, are the nested structure of the semantic containing elements and BEM notation correct?
Mostly the same issues read my comment on your previous challenge.
I noticed only one thing. Don't set width and height to card element. Right now it is completely fine because you have a fixed font size and a card with a fixed size. But later on, when you will work on bigger challenges or projects it might create problems, like overflows, text on top of another text. As a quick fix, use rem units for width and don't use height at all
please read more about semantic HTML and how to use article and section. I, myself, still don't understand how to use them correctly. Here is a great article. That is why HTML validation report have 2 unresolved issues
don't set html { font-size: 16px; } because it destroys your later use of relative units. By default in most browsers font size is 16px and setting it to absolute units prevents people from setting their own font size.
Hey guys! I am uploading new challenge! I hope I will get some feedback from you. And also how can I style fonts on this website? I mean frontendmentor.io Cause somebody is using bold, bullet points and etc.
I have almost nothing to add, just look at the picture element for providing different images at different breakpoints. Hopefully, others will provide more useful feedback 😁
To answer your question. It is called Markdown (.md) it has many uses and different structures which depend on the website or app that uses it. At frontendmentor.io you can see at the top of the feedback box MARKDOWN HELP. It contains all the syntax. It is recommended that all GitHub repositories should have README.md file. Markdown there is more extensive than here.
use semantic elements. Wrap your code in main element or rename div class="box" to main class="box". Use h1 instead of general div element
don't use <br> because screen readers will make pause in these places which will break the whole message, just let the text wrap by itself or use padding/margin to limit available space
don't set width and height attributes in img element, specify those with CSS like this max-width: 100% that way image will occupy available space and resize according to it
CSS
I wouldn't set * { margin: auto; }. It can create problems later on because in different cases margin: auto; behaves differently. Plus you use margin afterward and thus you overide previous rule.
there's no need in specifying background-color for each element as by default it is set to transparent
don't limit width and height of card component, set only widthor better max-width
to create space around image and text use padding on .box
wrap your code in main tags or change div class="container" to main="container
I personally wouldn't exclude P E R F U M E text from HTML as it provides additional information to people who use screen readers, but that is definitely a cool example of using ::before pseudo-selector 👍
use h1 instead of h2
I don't know a lot about accessibility but use del or s for the old price, plus some read-only text to provide more information
use the `picture`` element for providing two images that will change if the viewport gets to a certain width. Read this article it has great examples for different use cases
CSS
it is not recommended to set font-size: 62.5%; read about it here
use min-height: 100vh on the body element to allow scrolling, if you try to resize the window you will see that
I wouldn't separate CSS in two different files only if you use media queries in the head element so there wouldn't be additional calls to the server
I would recommend starting from more simple projects like QR card
If you feel like you still don't know enough [freeCodeCamp]{https://www.freecodecamp.org/learn/} is a great free resource for learning HTML and CSS
picture element can only contain one img element and as many as you need source elements. Change it to general div
change color text in the footer and change div to footer
using Scss nesting creates problems with specificity
body main .preview-card .nft__info .flexbox-item .nft__time-left p {}
.nft__time-left p {}
Both selectors target the same element but the first one is more specific which in the big project might create a problem. As I could guess it is your first time using SCSS or is it?
Some solutions to this can be leaving body and main selectors alone and then renaming .preview-card to .nft so you can target elements by specifying the next part with &
Something like that
Hello, everyone. This is my second sharing in frontend mentor. It would be helpful if I got any comments to improve the code. Also, I faced some issues when I was coding the nft card. It would be great if it got answered. THX
1.Should I wrap every image into a container for styling the image instead of adding to the image directly, like the size or the border radius?
2.Are there any difference between adding the svg under <svg> tag and <image> tag ?
empty alt attribute is okay for icons but add some description to the main image and avatar image.
about not using font-size: 62.5%; I wrote in your previous challenge.
To your questions
I'm not sure. Looked at existing websites. Mainly they style the img element, but they nest them in divs for additional styling or for adding Javascript.
In this example or you can use both. svg allows you to change the color of SVG with CSS or to use Javascript to add change SVG in real-time (from style to shape)
wrap your code in main tag or change div class="card" to main class="card"
change div class="attribution" to footer class="attribution"
alt should describe an image or its function and be empty only if it is only decorative, read more about alternative text here. In this challenge alt can be QR code to frontendmentor.io so you can show the image function in this case
CSS
it is not recommended to set font-size: 62.5%; read about it here
use min-height: 100vh; on body element so that in case of overflow it will allow scrolling
change the background color to match to the design
Please look at HTML validation report. As a fix to it just rename span elements to div elements. You can remove nested divs, svg and text are inline elements so they would be next to each other by default, and no other styling to needed
It is not recommended to use html: {font-size: 62.5%;} you can read about it here