Omnifood Project - Optimizations Flashcards

1
Q

What to do to make the nav bar invisible when it size is mobile (step 1-3)?

  .main-nav {
    background-color: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(10px);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    transform: translateX(100%);
 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease-in;
 
    /* 1) Hide it visually */
     
    /* 2) Make it unaccessible to mouse and keyboard */
     
    /* 3) Hide it from screen readers */
     
A
  /* 1) Hide it visually */
    opacity: 0;
 
    /* 2) Make it unaccessible to mouse and keyboard */
    pointer-events: none;
 
    /* 3) Hide it from screen readers */
    visibility: hidden;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In the following example the .nav-open is set on the header instead of the nav element (child of header). Why is that?

const btnNavEl = document.querySelector(".btn-mobile-nav");
const headerEl = document.querySelector(".header");
 
btnNavEl.addEventListener("click", function () {
  headerEl.classList.toggle("nav-open");
});
A

Putting the class on the parent element isn’t required, but is a common practice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to reach both buttons while they have the same class name?

<button class="btn-mobile-nav">
		<ion-icon class="icon-mobile-nav" name="menu-outline"></ion-icon>
		<ion-icon class="icon-mobile-nav" name="close-outline"></ion-icon>
	</button>
A

Use descended selectors:

  .nav-open .icon-mobile-nav[name="close-outline"] {
      }
 
  .nav-open .icon-mobile-nav[name="menu-outline"] {
      }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When the nav bar is opened, the icon should become a close button. How is this done?

<button class="btn-mobile-nav">
		<ion-icon class="icon-mobile-nav" name="menu-outline"></ion-icon>
		<ion-icon class="icon-mobile-nav" name="close-outline"></ion-icon>
	</button>
A
  .nav-open .icon-mobile-nav[name="close-outline"] {
    display: block;
  }
 
  .nav-open .icon-mobile-nav[name="menu-outline"] {
    display: none;
  }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What to do with the button so it always stays on top:

.btn-mobile-nav {
    display: block;
  }
A
.btn-mobile-nav {
    display: block;
    z-index: 9999;
  }

Use the z-index

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Where will this link take you?

<header class="header">
      <a href="#">
        <img class="logo" alt="Omnifood logo" src="img/omnifood-logo.png" />
      </a>
A

This will simply lead to the top of the page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What to fill in here to scroll to the section underneath:

section class="section-cta" >
        <div class="container">

And button:
~~~
<a>Start eating well</a>
~~~

A
section class="section-cta" id="cta">
        <div class="container">
 <a href="#cta" class="btn btn--full margin-right-sm"
              >Start eating well</a
            >

So fill in the id in the section and use it in the href

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which method can you use to blur out the background? Are there exception in browsers?

A

backdrop-filter: blur(10px);

Safari, firefox

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How could you tell the html that by default you want a scrollbar in case of overflow and that the scrolling must be smoothly.

html {
  font-size: 62.5%;
}
A
html {
  font-size: 62.5%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

However this does NOT work on Safari

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Where can you test whether design tools are available for web browsers?

A

caniuse.com

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How would you do a backdrop in Safari?

A

Add the -webkit- prefix to the backdrop filter

 .main-nav {
    background-color: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(5px);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How would you do a backdrop in Firefox?

A

As a resolution increase the alpha channel of the background-color

So that is looks acceptable in firefox as well

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Is it possible to write two of the same media queries?

A

Yes, no problem at all. Happens a lot actually.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Lighthouse used for? Can you use it with Chrome?

A

Used for adding some improvements to the website
Created by Google so available in the Inspect menu

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What test results will Lighthouse give you?

A

Performance (note that you are loading from your own computer)

Accessibility

Best practices

SEO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to add a description to your page?

A

Start a new meta tag with name and content attribute

name="description"
content = insert your description
15
Q

How to add a title to your page?

A
<title>Omnifood &mdash; Never cook again!</title>
16
Q

What is the process of adding a fav icon?

A
  1. Resize the image to a small size like 64 x 64
  2. <link rel="icon" href="img/favicon.png" />
17
Q

How to represent the website in a touch icon?

A
  1. Resize the image to about 192 x 192 for the icon
  2. <link rel="apple-touch-icon" href="img/apple-touch-icon.png" />
18
Q

What is a good rule of thumb regarding image size?

A

The original image size should always be twice the size of the image displayed on screen
The reason is that high density screens need 2 pixels to display 1

You can see the image size in the inspect menu by hovering over image

19
Q

What could be a way of upgrading an image dimensions?

A

Use squoosh online app

20
Q

What is Netlify?

A

A highly recommended platform for deploying your website

21
Q

Gebleven bij Notes 146

A