-
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 all commits
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,111 @@ | |
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="moyo-logo" | ||
/> | ||
Comment on lines
+33
to
+40
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 |
||
</a> | ||
|
||
<nav class="nav"> | ||
<ul class="nav__list"> | ||
<li class="nav__item"> | ||
<a | ||
class="nav__link is-active" | ||
href="#apple" | ||
> | ||
Apple | ||
</a> | ||
</li> | ||
|
||
<li class="nav__item"> | ||
<a | ||
class="nav__link" | ||
href="#samsung" | ||
> | ||
Samsung | ||
</a> | ||
</li> | ||
|
||
<li class="nav__item"> | ||
<a | ||
class="nav__link" | ||
href="#smartphones" | ||
> | ||
Smartphones | ||
</a> | ||
</li> | ||
|
||
<li class="nav__item"> | ||
<a | ||
class="nav__link" | ||
href="#laptops-computers" | ||
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 |
||
data-qa="hover" | ||
Comment on lines
+75
to
+76
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 spaces in the |
||
> | ||
Laptops & Computers | ||
</a> | ||
</li> | ||
|
||
<li class="nav__item"> | ||
<a | ||
class="nav__link" | ||
href="#gadgets" | ||
> | ||
Gadgets | ||
</a> | ||
</li> | ||
|
||
<li class="nav__item"> | ||
<a | ||
class="nav__link" | ||
href="#tablets" | ||
> | ||
Tablets | ||
</a> | ||
</li> | ||
|
||
<li class="nav__item"> | ||
<a | ||
class="nav__link" | ||
href="#photo" | ||
> | ||
Photo | ||
</a> | ||
</li> | ||
|
||
<li class="nav__item"> | ||
<a | ||
class="nav__link" | ||
href="#video" | ||
> | ||
Video | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
</header> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,76 @@ | ||
:root { | ||
--active-color: #00acdc; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
} | ||
|
||
html { | ||
font-family: Roboto, Arial, 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 specifying fallback font-families in case 'Roboto' is not available. For instance, 'font-family: Roboto, Arial, sans-serif;' ensures that if 'Roboto' fails to load, 'Arial' will be used, and if both custom fonts fail, the browser's default sans-serif font will be used. 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. Remember to use fallback fonts - alternative font-family in case the main one doesn't work. Consider adding a generic font family as a fallback after 'Arial', such as '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; | ||
text-decoration: none; | ||
color: #000; | ||
} | ||
|
||
.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. |
||
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; | ||
} | ||
|
||
.nav__item:first-child .nav__link { | ||
margin-left: 0; | ||
} |
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
.