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 1 commit
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
67 changes: 66 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,73 @@
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>
<li>
<a
class="is-active"
href="index.html"
>
Apple
</a>
</li>

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

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

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

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

<li>
<a
class="nav_a"
href="index.html"
>
Tables
</a>
</li>

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

<li>
<a href="index.html">Video</a>
</li>
</ul>
</nav>
</header>
</body>
</html>
77 changes: 76 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,78 @@
body {
:root {
--nav-active: #00acdc;
--header-color: #fff;
--nav-color: #000;
--nav-backgroundcolor: #fff;
}

* {
font-family:

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

system-ui,
roksolanap marked this conversation as resolved.
Show resolved Hide resolved
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Open Sans',
'Helvetica Neue',
sans-serif;
font-size: 12px;
margin: 0;
box-sizing: border-box;
}

.site_header {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
background-color: var(--header-color);
padding: 0 50px;

Choose a reason for hiding this comment

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

This color is default

Suggested change
background-color: var(--header-color);

}

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

.nav li {
display: inline;

Choose a reason for hiding this comment

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

do not add styles using combined selectors without necessary
just add class for all li elements and use this class to add styles

fix all similar cases

align-items: center;
position: relative;
text-transform: uppercase;
white-space: nowrap;
line-height: 60px;
margin-right: 20px;
background-color: var(--nav-backgroundcolor);
}

.nav li a {
text-decoration: none;
color: var(--nav-color);
font-weight: 500;
}

.nav li:last-child {
margin-right: 0;
}

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

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

Choose a reason for hiding this comment

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

you can list selectors with same styles separated by comma:

.example-selector-1,
.example-selector-2,
.example-selector-3:hover {
  // some styles
}

.nav li .is-active::after {
content: '';
position: absolute;
background-color: var(--nav-active);
border-radius: 8px;
height: 4px;
top: 34px;
right: 0;

Choose a reason for hiding this comment

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

bottom: 0 instead of "magic" 34px top

left: 0;
}
Loading