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

task solution #5381

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://D0dgerJ.github.io/layout_moyo-header/)
- [TEST REPORT LINK](https://D0dgerJ.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
101 changes: 95 additions & 6 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<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"
/>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
/>
<meta
http-equiv="X-UA-Compatible"
content="ie=edge"
content="width=device-width, initial-scale=1.0"
/>
<title>Moyo header</title>
<link
Expand All @@ -17,6 +25,87 @@
/>
</head>
<body>
<h1>Moyo header</h1>
<header class="header">
<a
href="/"
class="logo-link"
>
<img
src="images/logo.png"
alt="MOYO Electronics Brand Logo'"

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, but avoid using special characters like single quotes at the end unless they are part of the actual description. It should be alt="MOYO Electronics Brand Logo".

class="logo"
/>
</a>

<nav class="nav">
<ul class="nav__list">
<li class="nav__item">
<a
href="#apple"
class="nav__link 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-computers"
class="nav__link"
data-qa="hover"

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. The href for 'Laptops & Computers' contains a space, which should be replaced with a hyphen or underscore (e.g., href="#laptops-computers").

>
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>
</header>
</body>
</html>
88 changes: 87 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,89 @@
body {
:root {
--main-color: #00acdc;
}

ul,
ol {
padding: 0;
}

Comment on lines +5 to +8

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 elements using .class. In your case, you could create a class like .list-reset and apply it to ul or ol where necessary.

body,
h1,
h2,
h3,
h4,
p,
ul,
ol,
li,
figure,
figcaption,
blockquote,
dl,
dd {
margin: 0;
list-style: none;
}

Comment on lines +10 to +26

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 use classes to avoid unintended side effects on other elements of the same type. For example, you might not want all p tags to have no margin in every context.

html {
font-family: Roboto, Arial, sans-serif;
}

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 instance, 'Roboto', 'Arial', sans-serif could be specified as 'Roboto', 'Arial', 'Helvetica', sans-serif.


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

.nav__item {
margin-right: 20px;
}

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 recommended to add only top or only bottom margin, but not both, to prevent issues with margin collapse. In this case, consider using only margin-bottom for .nav__item.


.nav__item:last-child {
margin-right: 0;
}

Comment on lines +38 to +44

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. You're adding right margin to .nav__item which is horizontal, but make sure you apply the same principle to vertical margins as well, by adding only top or only bottom margin but not both.

.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 50px;
}

.nav__list {
list-style: none;
display: flex;
}

.nav__link {
height: 60px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
font-weight: 500;
font-size: 12px;
text-transform: uppercase;
color: #000;
text-decoration: none;
}

.nav__link:hover {
color: var(--main-color);
}

.is-active {
color: var(--main-color);
position: relative;
}

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