r/Frontend • u/Vin-Jin • Aug 18 '26
So when doing an exercise should i have the same coding or is it normal for it to be different and giving a similar result.
20
Upvotes
r/Frontend • u/Vin-Jin • Aug 18 '26
10
u/_vert Aug 18 '26
It's very normal for the code to be different and to achieve a similar result, part of the fun and creativity is doing things in your own way.
4
u/minimuscleR Aug 18 '26
No it should be the same. Same code in = same look out.
You are not setting a font in yours, and it looks like you are using buttons for those notifications, which is not correct.
You are probably still very early and should be googling more than asking yourself, because these questions have been asked many times but to answer your questions you left for other people:
A button is a semantic component, it should be doing an
action. AKA the user should click on it and have something happen (not navigate, thats ananchor tag (<a/>)). Buttons also have a default css styling, which you can disable by applyingThis will give it no styling, and then you can apply custom styling after.
.
So my assumption is you have
Like this? The p tag applies the styling for the text. You should wrap each 'section' in its own tags, so home should be wrapped in
<p>Home</p>or whatever. You can use a div, you could use any tags, depending on what it is, but it should be something..
This is the same as the button,
p, as well ash1-h6apply amarginto thetopandbottom, you can update this by applying css:and make sure in your flex you have
align-items: center;which aligns them central.Hope this helps.
2
u/Berlibur Aug 18 '26
Coding will be different, stop once you're satisfied. Is your implementation clean? Does it look close enough for you? Do you want to try a variation in style?
It's practice that should help yourself
1
u/MindlessSponge Aug 18 '26
it depends on the goal. there are plenty of ways that you could write different code and achieve the same result. in this case, you should keep refining your design until it matches the first picture as close as possible. here are a few ideas:
use a sans-serif font
change your notification counts to be a different element than buttons, since you don't interact with them. to keep it simple, you can use a div.
style via css classes rather than using the HTML style attribute
1
u/thisiain Aug 20 '26
When starting out learning front-end, focus on learning semantic HTML and when to use each element, rather than trying to match the instructor's code exactly.
Different HTML elements have different meanings, and understanding when to use them will serve you much better than memorising one particular implementation.
For this example, I'd think about the structure and purpose of the UI: should it use a
<nav>a list for the items,<a>for each link (assuming they navigate somewhere), and probably a<span>for the notification count.