-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
header design #5386
base: master
Are you sure you want to change the base?
header design #5386
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you've made some great efforts in your code, there are a few critical issues that need addressing before we can move forward. The incorrect use of CSS properties and values, such as display: inline block;
and size
instead of font-size
, can cause visual and functional problems. Also, the lack of responsive design considerations and descriptive class names could impact the maintainability and accessibility of your project. Let's fix these to ensure your code is solid! 🛠️ Remember, these changes are part of the learning process and will help you write more robust and clean code in the future! 💪
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
class="nav__link link2" | ||
> | ||
LAPTOPS & COMPUTERS | ||
</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using spaces and special characters in URL fragments. The href
attribute value #laptops-computers
should be something like #laptops-computers
or #laptops_and_computers
.
src/index.html
Outdated
<li class="nav__item"> | ||
<a | ||
href="#apple" | ||
class="nav__link link1 is-active" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class names should represent the meaning of the content, not the styles or tag names. The class name 'link1' does not describe the content or function of the element. Consider using a name that reflects its role or state, such as 'nav__link--active' if it's meant to indicate the active link.
<a | ||
href="#laptops-computers" | ||
data-qa="hover" | ||
class="nav__link link2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the previous comment, 'link2' is not a descriptive class name. It's better to use a name that conveys the meaning or purpose of the element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there are a few issues that need your attention before we can move forward. Don't worry, though! The majority of the feedback is about keeping your code clean and maintainable, like avoiding redundant styles and using classes instead of tag names for styling. There's also a functional issue with the href
attribute in the <a>
tag. Just a bit of polishing up and you'll be all set! Keep up the good work, and remember, every improvement is a step towards becoming an even better developer! 🌟
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
<link | ||
rel="preconnect" | ||
href="https://fonts.googleapis.com" | ||
/> | ||
<link | ||
rel="preconnect" | ||
href="https://fonts.gstatic.com" | ||
crossorigin="anonymous" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attributes of the link
element should also follow the correct formatting as mentioned above.
<link | ||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap" | ||
rel="stylesheet" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attributes of the link
element should be formatted correctly as mentioned above.
</head> | ||
<body> | ||
<h1>Moyo header</h1> | ||
<header class="header"> | ||
<a href="#logo"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use spaces in <a>
tag's href
property. If you meant to link to the top of the page, use href="#"
.
src/index.html
Outdated
href="##laptops_and_computers" | ||
data-qa="hover" | ||
class="nav__link link2" | ||
> | ||
LAPTOPS & COMPUTERS | ||
</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an error in the href
attribute of the <a>
tag. It contains two #
symbols. It should have only one to work correctly as an anchor link.
class="logo" | ||
/> | ||
</a> | ||
<nav class="nav"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding an empty line before the nav
element for better readability between sibling elements.
line-height: 14px; | ||
} | ||
|
||
* { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use *
selector as it impacts performance. It's better to set styles only for elements that require them.
background-color: gray; | ||
} | ||
|
||
ul { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using tag names for styling. It's better to style elements using classes.
.header { | ||
background-color: white; | ||
display: flex; | ||
max-width: auto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't fix container size with max-width: auto;
and max-height: auto;
, as it's better to let the content size dictate it. This can help avoid overflow or accidental scroll bars.
src/style.css
Outdated
align-items: center; | ||
height: 60px; | ||
justify-content: flex-end; | ||
font-family: Roboto, Arial, sans-serif; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The font-family declaration is redundant here since it's already defined in the html
selector. You can safely remove it to avoid repetition and to keep your CSS DRY (Don't Repeat Yourself).
} | ||
|
||
.nav__item { | ||
margin: 0 10px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be consistent with your vertical margins. It's better to add only top or only bottom margin, but not both, to avoid collapsing margins in some cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary: Great work on your Pull Request! 🌟 You've made some progress, but there are a few important aspects to consider for future improvement. Remember to avoid unnecessary CSS properties like max-width: auto;
and max-height: auto;
as they can lead to unintended layout issues. Use fallback fonts to ensure text is always displayed properly. Be mindful of your naming conventions and aim for meaningful class names that reflect the content's purpose. Watch out for link formatting and text transformation practices for better accessibility. Lastly, pay attention to your code's formatting with proper indentation and spacing for better readability. Keep learning and refining your skills! 👍
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
src/index.html
Outdated
<header class="header"> | ||
<a href="#logo"> | ||
<img src="images/logo.png" alt="Moyo logo" class="logo"/> | ||
</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember about correct indentation between parent and child elements. Each level of nesting should have a 2-space offset.
src/index.html
Outdated
<nav class="nav"> | ||
<ul class="nav__list"> | ||
<li class="nav__item"> | ||
<a href="#apple" class="nav__link link1 is-active">APPLE</a> | ||
</li> | ||
<li class="nav__item"> | ||
<a href="#samsung" class="nav__link">SAMSUNG</a> | ||
</li> | ||
<li class="nav__item"> | ||
<a href="#smartphones" class="nav__link">SMARTPHONES</a> | ||
</li> | ||
<li class="nav__item"> | ||
<a href="#laptops_and_computers" data-qa="hover" class="nav__link link2 ">LAPTOPS & COMPUTERS</a> | ||
</li> | ||
<li class="nav__item"> | ||
<a href="#gadgets" class="nav__link">GADGETS</a> | ||
</li> | ||
<li class="nav__item"> | ||
<a href="#tablets" class="nav__link">TABLETS</a> | ||
</li> | ||
<li class="nav__item"> | ||
<a href="#photo" class="nav__link">PHOTO</a> | ||
</li> | ||
<li class="nav__item"> | ||
<a href="#video" class="nav__link">VIDEO</a> | ||
</li> | ||
</ul> | ||
</nav> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add empty lines between multiline sibling blocks of HTML to add some 'air' and simplify reading.
src/index.html
Outdated
<li class="nav__item"> | ||
<a href="#apple" class="nav__link link1 is-active">APPLE</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text inside the 'a' tag should not be in uppercase due to accessibility concerns. Use CSS to transform text appearance.
src/index.html
Outdated
<a href="#smartphones" class="nav__link">SMARTPHONES</a> | ||
</li> | ||
<li class="nav__item"> | ||
<a href="#laptops_and_computers" data-qa="hover" class="nav__link link2 ">LAPTOPS & COMPUTERS</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use spaces in the 'a' tag's 'href' property. The 'href' for 'LAPTOPS & COMPUTERS' should be '#laptops_and_computers' without spaces.
src/index.html
Outdated
<a href="#smartphones" class="nav__link">SMARTPHONES</a> | ||
</li> | ||
<li class="nav__item"> | ||
<a href="#laptops_and_computers" data-qa="hover" class="nav__link link2 ">LAPTOPS & COMPUTERS</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class 'link2' does not represent the meaning of the content. Class names should represent the meaning of the content, not the styles or tag names.
ul { | ||
list-style: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use tag names for styling. Style all elements using .class
and if needed with :pseudo-class
, pseudo-element
and [attribute]
.
.header { | ||
background-color: white; | ||
display: flex; | ||
max-width: auto; | ||
max-height: auto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid fixing container sizes using max-width: auto;
and max-height: auto;
. Let the content size dictate the container size to prevent overflow or accidental scrollbars.
@@ -1,3 +1,95 @@ | |||
html { | |||
font-family: Roboto, Arial, sans-serif; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to use fallback fonts - alternative font-family in case the main one doesn't work. For example, font-family: Roboto, Arial, sans-serif;
.
.header { | ||
background-color: white; | ||
display: flex; | ||
max-width: auto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The max-width: auto;
is not necessary here. By default, block-level elements like div
take up the full width available to them. If you need to constrain the width, use a specific value or percentage.
background-color: white; | ||
display: flex; | ||
max-width: auto; | ||
max-height: auto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, max-height: auto;
is the default behavior for elements, and it's not needed unless you're explicitly setting a max-height value.
src/index.html
Outdated
<a href="#logo"> | ||
<img src="images/logo.png" alt="Moyo logo" class="logo"/> | ||
</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<a href="#logo"> | |
<img src="images/logo.png" alt="Moyo logo" class="logo"/> | |
</a> | |
<a href="#logo"> | |
<img src="images/logo.png" alt="Moyo logo" class="logo"/> | |
</a> |
src/index.html
Outdated
<li class="nav__item"> | ||
<a href="#apple" class="nav__link link1 is-active">APPLE</a> | ||
</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix tabulation
<li class="nav__item"> | |
<a href="#apple" class="nav__link link1 is-active">APPLE</a> | |
</li> | |
<li class="nav__item"> | |
<a href="#apple" class="nav__link is-active">APPLE</a> | |
</li> |
class link1 is redundant
src/style.css
Outdated
.link1 { | ||
position: relative; | ||
color: #00acdc; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.link1 { | |
position: relative; | |
color: #00acdc; | |
} | |
.is-active { | |
position: relative; | |
color: #00acdc; | |
} |
color: #00acdc; | ||
} | ||
|
||
.link2:hover { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.link2:hover { | |
.nav__link:hover { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job
Help me find the errors