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 #4919

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
93 changes: 92 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,99 @@
rel="stylesheet"
href="./style.css"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap"
/>
</head>
<body>
<h1>Moyo header</h1>
<header class="site_header">
<a
class="logo"
href="index.html"
>
<img
src="./images/logo.png"
alt="logo"
/>
</a>

<nav class="nav">
<ul class="nav__list">
<li class="nav__item">
<a
class="is-active nav__link"
href="index.html"
>
Apple
</a>
</li>

<li class="nav__item">
<a
class="nav__link"
href="index.html"
>
Samsung
</a>
</li>

<li class="nav__item">
<a
class="nav__link"
href="index.html"
>
Smartphones
</a>
</li>

<li class="nav__item">
<a
class="nav__link"
data-qa="hover"
href="index.html"
>
Laptops & Computers
</a>
</li>

<li class="nav__item">
<a
class="nav__link"
href="index.html"
>
Gadgets
</a>
</li>

<li class="nav__item">
<a
class="nav__link"
href="index.html"
>
Tablets
</a>
</li>

<li class="nav__item">
<a
class="nav__link"
href="index.html"
>
Photo
</a>
</li>

<li class="nav__item">
<a
class="nav__link"
href="index.html"
>
Video
</a>
</li>
</ul>
</nav>
</header>
</body>
</html>
71 changes: 71 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
:root {
--nav-active: #00acdc;
--header-color: #fff;
--nav-color: #000;
}

* {

Choose a reason for hiding this comment

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

better not adding a lot of styles to * selector without necessary

For example, if you add font-family and font-size to body they will be inherited by all nested elements
It is not a good idea to reset the margin for all elements, better to do it for the list of tags you really need

What really should be here is box-sizing property

margin: 0;
box-sizing: border-box;
}

body {
margin: 0;
font-family: Roboto, sans-serif;
font-size: 12px;
}

.site_header {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 50px;
}

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

.nav__item {
align-items: center;
text-transform: uppercase;
margin-right: 20px;
}

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

.nav__link {
display: block;
position: relative;
line-height: 60px;
text-decoration: none;
color: var(--nav-color);
font-size: 12px;
font-weight: 500;
}

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

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

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

Choose a reason for hiding this comment

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

Suggested change
.nav__link:hover {
color: var(--nav-active);
}
.is-active {
color: var(--nav-active);
}
.nav__link:hover,
.is-active {
color: var(--nav-active);
}

Copy link
Author

Choose a reason for hiding this comment

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

done, thank you


.is-active::after {
content: '';
position: absolute;
background-color: var(--nav-active);
border-radius: 8px;
height: 4px;
bottom: 0;
right: 0;
left: 0;
}
Loading