-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
add task solution #5368
base: master
Are you sure you want to change the base?
add task solution #5368
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,12 +11,75 @@ | |
content="ie=edge" | ||
/> | ||
<title>Moyo header</title> | ||
<link | ||
rel="preconnect" | ||
href="https://fonts.googleapis.com" | ||
/> | ||
<link | ||
rel="preconnect" | ||
href="https://fonts.gstatic.com" | ||
/> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="./style.css" | ||
/> | ||
</head> | ||
<body> | ||
<h1>Moyo header</h1> | ||
<header class="header"> | ||
<a | ||
class="header__link" | ||
href="images/logo.png" | ||
> | ||
Comment on lines
+35
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
<img | ||
src="images/logo.png" | ||
alt="logo" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
/> | ||
</a> | ||
|
||
<nav class="nav"> | ||
<ul class="nav__list"> | ||
<li class="nav__item"> | ||
<a class="nav__link is-active">Apple</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
</li> | ||
|
||
<li class="nav__item"> | ||
<a class="nav__link">Samsung</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
</li> | ||
|
||
<li class="nav__item"> | ||
<a class="nav__link">Smartphones</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
</li> | ||
|
||
<li class="nav__item"> | ||
<a | ||
class="nav__link" | ||
data-qa="hover" | ||
> | ||
Laptops & Computers | ||
</a> | ||
</li> | ||
|
||
<li class="nav__item"> | ||
<a class="nav__link">Gadgets</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
</li> | ||
|
||
<li class="nav__item"> | ||
<a class="nav__link">Tablets</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
</li> | ||
|
||
<li class="nav__item"> | ||
<a class="nav__link">Photo</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
</li> | ||
|
||
<li class="nav__item"> | ||
<a class="nav__link">Video</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
</li> | ||
</ul> | ||
</nav> | ||
</header> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,3 +1,71 @@ | ||||
:root { | ||||
--active-color: #00acdc; | ||||
} | ||||
|
||||
body { | ||||
margin: 0; | ||||
} | ||||
|
||||
html { | ||||
font-family: Roboto, sans-serif; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding fallback font-families to improve robustness of your CSS in case the primary font isn't available. For example, 'Roboto, Arial, sans-serif'. |
||||
font-size: 12px; | ||||
font-weight: 500; | ||||
text-transform: uppercase; | ||||
} | ||||
|
||||
.header { | ||||
position: relative; | ||||
display: flex; | ||||
align-items: center; | ||||
justify-content: space-between; | ||||
box-shadow: 0 2px 4px 0 #0000000d; | ||||
padding: 0 50px; | ||||
} | ||||
|
||||
.nav__list { | ||||
display: flex; | ||||
list-style: none; | ||||
padding-left: 0; | ||||
margin: 0; | ||||
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid using tag names for styling. You should use classes instead to ensure that the styling is specific and doesn't inadvertently affect other list elements that might be added to the page in the future. |
||||
} | ||||
|
||||
.nav__link { | ||||
position: relative; | ||||
display: flex; | ||||
height: 60px; | ||||
margin-left: 20px; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Be consistent with vertical margins: it's recommended to apply either top or bottom margin, but not both, to elements to avoid unexpected margin collapsing. In this case, you have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the checklist, be consistent with your vertical margins. It is recommended to use either top or bottom margin, but not both to avoid collapsing margins issues. In this case, 'margin-top' and 'margin-bottom' are set on '.header__link' (lines 60-61), which could potentially lead to such issues. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Be consistent with your vertical margins (Add only top or only bottom margin, but not both). Here you have a left margin, which is fine, but make sure to avoid having both top and bottom margins for vertical consistency. |
||||
align-items: center; | ||||
} | ||||
|
||||
.nav__item { | ||||
cursor: default; | ||||
justify-content: center; | ||||
} | ||||
|
||||
.is-active { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The '.is-active' class has a 'margin-left' property which is redundant since it's already defined in the '.nav__link' class (line 36) and '.is-active' is expected to override '.nav__link'. If the intention is to set 'margin-left' to 0 for the '.is-active' class, then this is correct. However, if the intention is to maintain the same 'margin-left' as '.nav__link', then this line can be removed. |
||||
margin-left: 0; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
it's bad practice to reset the margin in this class, because we can make the third link active, but we don't need in the third link margin-left:0 |
||||
color: var(--active-color); | ||||
} | ||||
|
||||
.nav__link:hover { | ||||
color: var(--active-color); | ||||
} | ||||
|
||||
.header__link { | ||||
display: flex; | ||||
width: 40px; | ||||
height: 40px; | ||||
margin-top: 10px; | ||||
margin-bottom: 10px; | ||||
Comment on lines
+59
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Be consistent with your vertical margins (Add only top or only bottom margin, but not both). Here you've added both top and bottom margins, consider using only one to maintain consistency and to avoid margin collapse issues. |
||||
} | ||||
|
||||
.is-active::after { | ||||
content: ''; | ||||
display: block; | ||||
height: 4px; | ||||
width: 100%; | ||||
background-color: var(--active-color); | ||||
position: absolute; | ||||
bottom: 0; | ||||
border-radius: 8px; | ||||
} |
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'shref
property. It seems like you're linking to an image, which should be displayed using an<img>
tag, not linked via<a>
withhref
.