Skip to content
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 #5378

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ The page should match the design Pixel Perfect: all the sizes, colors and distan

❗️ Replace `<your_account>` with your Github username and copy the links to `Pull Request` description:

- [DEMO LINK](https://<your_account>.github.io/layout_moyo-header/)
- [TEST REPORT LINK](https://<your_account>.github.io/layout_moyo-header/report/html_report/)
- [DEMO LINK](https://miroshnykow.github.io/layout_moyo-header/)
- [TEST REPORT LINK](https://miroshnykow.github.io/layout_moyo-header/report/html_report/)

❗️ Copy this `Checklist` to the `Pull Request` description after links, and put `- [x]` before each point after you checked it.

Expand Down
96 changes: 95 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,106 @@
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:wght@400;500;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="./style.css"
/>
</head>
<body>
<h1>Moyo header</h1>
<header class="header">
<a
class="logo"
href="#"
>
<img
src="/src/images/logo.png"
alt="logo"
Comment on lines +37 to +39

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alt attribute should describe the image content, not just say 'logo'. It should ideally describe what the logo is about or what company it represents.

/>
</a>
Comment on lines +32 to +41

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. The img element should have a 2-space offset from the a element.


<nav class="nav">
<ul class="nav__list">
<li class="nav__item">
<a
href="#"
class="nav__link is-active"
>
Apple
Comment on lines +46 to +50

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 these are placeholder links, consider using # without any following space.

</a>
</li>
<li class="nav__item">
<a
href="#"
class="nav__link"
>
Samsung
</a>
</li>
<li class="nav__item">
<a
href="#"
class="nav__link"
>
Smartphones
</a>
</li>
<li
class="nav__item"
data-qa="hover"
>
<a
href="#"
class="nav__link"
>
Laptops & Computers
</a>
</li>
<li class="nav__item">
<a
href="#"
class="nav__link"
>
Gadgets
</a>
</li>
<li class="nav__item">
<a
href="#"
class="nav__link"
>
Tablets
</a>
</li>
<li class="nav__item">
<a
href="#"
class="nav__link"
>
Photo
</a>
</li>
<li class="nav__item">
<a
href="#"
class="nav__link"
>
Video
</a>
</li>
</ul>
Comment on lines +44 to +112

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. There should be an empty line between each li element to improve readability.

</nav>
</header>
</body>
</html>
75 changes: 75 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,78 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
list-style: none;
Comment on lines +1 to +5

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use * selector (it impacts performance). Set styles only for elements that require them. Zeroing out your margins, paddings or other styles with '*' is still inefficient for the browser.

}

body {
margin: 0;
padding: 0;
}

.header {
max-width: 1200px;
display: flex;
justify-content: space-between;
align-items: center;
font-family: Roboto, system-ui;

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, 'Roboto', Arial, sans-serif.

font-size: 12px;
font-weight: 500;
position: relative;
padding: 0 50px;
margin: 0 auto;

--nav-link-color: #00acdc;
}

.logo {
display: block;
height: 40px;
width: 40px;
}

.nav__list {
display: flex;
align-items: center;
justify-content: space-between;
text-align: center;
padding: 0;
}

.nav__item {
list-style: none;
Comment on lines +42 to +43

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 (except html and body). Style all elements using .class. Also, the .nav__item class already sets list-style: none;, so it's redundant to declare it here again.

line-height: 60px;
}

.nav__link {
display: block;
height: 60px;
text-decoration: none;
color: #000;
text-transform: uppercase;
position: relative;
}

.is-active {
color: var(--nav-link-color);
}

.is-active::after {
position: absolute;
left: 0;
bottom: 0;
content: '';
display: block;
width: 100%;
height: 4px;
background-color: var(--nav-link-color);
border-radius: 2px;
}

.nav__item:not(:last-child) {
margin-right: 20px;
}

.nav__link:hover {
color: var(--nav-link-color);
}
Loading