<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ricardo Moreira</title>
    <description>The latest articles on DEV Community by Ricardo Moreira (@mugas).</description>
    <link>https://dev.to/mugas</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F137240%2F85b4b563-0fdd-489a-ad84-276f12e94a61.jpeg</url>
      <title>DEV Community: Ricardo Moreira</title>
      <link>https://dev.to/mugas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mugas"/>
    <language>en</language>
    <item>
      <title>CSS Units - rem vs em</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Mon, 11 Jul 2022 07:39:47 +0000</pubDate>
      <link>https://dev.to/mugas/css-units-rem-vs-em-1ig3</link>
      <guid>https://dev.to/mugas/css-units-rem-vs-em-1ig3</guid>
      <description>&lt;p&gt;&lt;strong&gt;CSS Relative UNITS – EMS vs REMS&lt;/strong&gt;&lt;br&gt;
When using CSS, units are something you deal with every time. The question is which one should you use and when and for what.&lt;/p&gt;

&lt;p&gt;I will not focus in this post on absolute length units (pixels, cm, and others) but the relative units. Relative units are like the name suggests relative to something. Relative to what is important. There are many relative units, but probably the most used are VW and VH which correspond to viewport width and height respectively, and em and rems that is what I am going to talk about (write?) here today.&lt;/p&gt;

&lt;p&gt;Spoiler alert, EM is relative to the parent(or element), and REM relative to the root element&lt;/p&gt;
&lt;h3&gt;
  
  
  Em units
&lt;/h3&gt;

&lt;p&gt;So when you use em, you need to know that em can be related to the font size of the parent, if we are talking about typography but can be related to the font size of the element if you are talking for example of margin or width.&lt;/p&gt;

&lt;p&gt;So let’s go to an example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gemrDQDU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8u39k3j71ry9kssa447h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gemrDQDU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8u39k3j71ry9kssa447h.png" alt="Image description" width="880" height="116"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"second-box"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;First box&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
 &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"box"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Second box&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
 &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.box&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;orange&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="c"&gt;/* margin-left: 2em; */&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I created a box with an h1 outside the box and an h1 outside the box. Both of them have the same font-size: 2em, but as you can see, they are different sizes. Why is that? I defined the body to have a font size of 10 px, while the font size of the box is 15px. Therefore the 2 em are relative to the font size of each parent respectively. So it ends up that the font size of the h1 outside of the box is 20px, while the one inside the box is 30px.&lt;/p&gt;

&lt;p&gt;What about if we are talking about with or margins? Another example :&lt;/p&gt;

&lt;p&gt;Text with different margins&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hzHC6A5z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c6in0vvs03gf6uf1tclv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hzHC6A5z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c6in0vvs03gf6uf1tclv.png" alt="Image description" width="880" height="189"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.second-box&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;orange&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;left&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To be more clear ( I hope) I put each text in one box. I kept the same font size then as before and both justified left. Then I gave the h1 a margin-left of 2em. As you see in the image, the second box text has a much bigger margin than the first one and that is because the margin is relative to the font size of the element. I hope it makes sense to you. For me at least is the type of example that made me understand better this unit.&lt;/p&gt;

&lt;p&gt;So let’s go to rem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rem Units
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;left&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TxaLjMzX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yb98q6lesvo7b1bzdy82.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TxaLjMzX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yb98q6lesvo7b1bzdy82.png" alt="Image description" width="880" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Text using rem units&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With rem, is in a way more straightforward, as is always relative to the font size of the root. So keeping with the same example, with rem the only difference that I did was to give the body font size, each box has its own. Then I changed the font size of the h1 from em to rem. Just like that both the margin and the font size are now the same on both boxes as with rem is relative to the root. Doesn’t matter what font you put in the box if the h1 has rem font size and that is relative to the font size of the root.&lt;/p&gt;

&lt;p&gt;When to use one or the other?&lt;/p&gt;

&lt;p&gt;That all depends on what you are comfortable with and understand better. With rem is easier to plan your website or project easily as everything is related to the root element. With em, especially in the beginning might be tricky to make it work the way you want when adding different viewports. Besides that, I believe that both are good options to try and play around with.&lt;/p&gt;

&lt;p&gt;This is the first of 3 posts on small topics of CSS, so follow for more if you are interested.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Failed to login in Netlify CMS website</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Mon, 18 Oct 2021 20:43:35 +0000</pubDate>
      <link>https://dev.to/mugas/failed-to-login-in-netlify-cms-website-3273</link>
      <guid>https://dev.to/mugas/failed-to-login-in-netlify-cms-website-3273</guid>
      <description>&lt;p&gt;This was not my first time. I don't know if I lost the password or I changed it in the past and didn't update it, the truth is that I try to login into my website admin and nothing seems to work.&lt;/p&gt;

&lt;p&gt;Then the case get's more strange when I reset the password but the email that is sent to me to reset it opens my website with a token as a link.&lt;/p&gt;

&lt;p&gt;To add an extra layer to this small challenge my two months computer just died basically and nothing inside was salved. Why does this matter?&lt;/p&gt;

&lt;p&gt;Because during those 2 months I changed some backends of my website and end up creating a new one with the front end that I add.&lt;/p&gt;

&lt;p&gt;So I think that in the middle of that, I had lost some pieces of info here and there.&lt;/p&gt;

&lt;p&gt;So let's talk about solutions.&lt;/p&gt;

&lt;p&gt;After some search on our old friend Google, I end up in this &lt;a href="https://spectrum.chat/academic/help/unable-to-get-netlify-cms-to-work~3c8d0e90-a283-46e4-b572-714dac6e2bdd"&gt;thread&lt;/a&gt; that leads to &lt;a href="https://www.netlifycms.org/docs/add-to-your-site/#add-the-netlify-identity-widget"&gt;here&lt;/a&gt;. Then I remember that I did in fact put on my header the code that is mention there.&lt;/p&gt;

&lt;p&gt;So first thing you have to do is include in the header of your website this script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://identity.netlify.com/v1/netlify-identity-widget.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, I realized that nothing was working still as the recovery email was still sending me to my website. &lt;/p&gt;

&lt;p&gt;The thread says that we need more steps but then I start to remember, I did this before but not from here but from the &lt;a href="https://docs.netlify.com/site-deploys/post-processing/snippet-injection/"&gt;snippet injection&lt;/a&gt;. How does this work? &lt;/p&gt;

&lt;p&gt;First, go to the Netlify website, and inside the dashboard of your website in Netlify go to &lt;strong&gt;Site Settings -&amp;gt; Build &amp;amp; Deploy.&lt;/strong&gt; Scroll till you find Snippet Injection and add snippet and chose insert before the body. Past this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://identity.netlify.com/v1/netlify-identity-widget.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;netlifyIdentity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;netlifyIdentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;init&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;netlifyIdentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;login&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/admin/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And just like that, when you press again the link to recover the email it directs you to the page where you can change your password. Happy days. This widget basically is what sends the information from the backend to the frontend about your token and identity.&lt;/p&gt;

&lt;p&gt;And that's all. You are back on your admin page again. If you want more tips about code and productivity, or read about the products I am &lt;a href="https://bizbox.club/"&gt;launching&lt;/a&gt; follow me on &lt;a href="https://twitter.com/moreira_creates"&gt;Twitter&lt;/a&gt; where I keep posting and updated almost daily.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Setting private-friendly web analytics into your website</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Tue, 04 May 2021 09:11:48 +0000</pubDate>
      <link>https://dev.to/mugas/setting-private-friendly-web-analytics-into-your-website-ji6</link>
      <guid>https://dev.to/mugas/setting-private-friendly-web-analytics-into-your-website-ji6</guid>
      <description>&lt;p&gt;Knowing the analytics on your website is important. Know what pages people go, what pages people don't, etc, from where (in the case you work with an international website) makes you understand better your website and your customers for example.&lt;br&gt;
Normally analytics come with privacy issues and cookies and pop-ups, so when I was developing my websites, even that I would like to have analytics on them I would not want to track people or wanted their data shared so I have been avoiding putting analytics till I found an easy solution.&lt;br&gt;
That where &lt;a href="https://plausible.io/"&gt;Plausible&lt;/a&gt; comes in. There are more solutions, some more expensive, others more cheap or free but Plausible at least till now offers a great solution for a great price.&lt;/p&gt;

&lt;p&gt;It's based in Europe ( Estonia), doesn't track or use any cookies so you don't need to add any cookie statement to your website and you get a full report of your website. If that is not enough I also can say that Plausible is open source and easy to install and manage.&lt;/p&gt;

&lt;p&gt;What follows is for websites made with Nuxt, but you can find in Plausible website info to install into other websites.&lt;/p&gt;

&lt;p&gt;First I installed Plausible into my project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="nx"&gt;vue&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;plausible&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After installed open your &lt;code&gt;nuxt.config.js&lt;/code&gt; and in the module section:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;modules&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vue-plausible&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that you set the module you need to put your domain set. Still in the &lt;code&gt;nuxt.config.js&lt;/code&gt;, for example right after the modules put this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;plausible&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yourdomain&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In there don't put the &lt;code&gt;https&lt;/code&gt; just your domain. In my case is &lt;code&gt;ricardomoreira.io&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And that's all you need to do. Of course that you also need to go to &lt;a href="https://plausible.io/"&gt;Plausible &lt;/a&gt;website, register your account and put your website there. &lt;br&gt;
In case you have more than one website, Plausible lets you add as many websites as you need at the same price.&lt;br&gt;
You can try the trial version, just register and you are free to go.&lt;/p&gt;

&lt;p&gt;I am happy with Plausible until the moment and gives exactly what I want, easy analytics with zero trackings.&lt;/p&gt;

&lt;p&gt;If you like this post, feel free to follow me on &lt;a href="https://twitter.com/mugas11/"&gt;Twitter&lt;/a&gt; and send me a message in case you have any doubt about this post 😊&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>vue</category>
    </item>
    <item>
      <title>Web sustainability - Benefits and Resources</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Thu, 29 Apr 2021 02:29:12 +0000</pubDate>
      <link>https://dev.to/mugas/web-sustainability-benefits-and-resources-3ei9</link>
      <guid>https://dev.to/mugas/web-sustainability-benefits-and-resources-3ei9</guid>
      <description>&lt;p&gt;I love to create websites and products, but I also need that the customers love their product because in the end is for them.&lt;/p&gt;

&lt;p&gt;Deciding to go to a more sustainable approach can be trickier when talking to a customer and some benefits are necessary to be said. Also because sustainability as a whole sometimes is not explained in a way that people want to take action. Or because It’s (or one might think it is) difficult to implement, understand, or too expensive.&lt;/p&gt;

&lt;p&gt;So let’s talk about the benefits of a more sustainable website:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce Video Calls – Yes this is not so much as a website itself but indirectly it affects. By reducing the number of video calls, not only your co-workers are more &lt;strong&gt;productive&lt;/strong&gt; but also happier. And yes it’s good for the environment.&lt;/li&gt;
&lt;li&gt;I talk about this &lt;a href="https://www.gscreations.io/blog/why-seo-is-important-for-your-business"&gt;before&lt;/a&gt; but better performance leads to better &lt;strong&gt;SEO&lt;/strong&gt;. With better SEO, your chances of having more and better customers grow.&lt;/li&gt;
&lt;li&gt;By focusing on the content and in the user, you create a better &lt;strong&gt;user experience&lt;/strong&gt; and of course a more happy client.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Branding&lt;/strong&gt;. There is no way to deny it but being sustainable is trendy and creating a business and a website that is also focused on sustainability is good for your brand, therefore is good for your business.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faster websites.&lt;/strong&gt; We have all been there. You go to a website, it takes centuries to load (in this century equals 3 seconds) and we just go to a different website. If your website is faster you have more chances for your customer to hold into your website.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope these benefits have made you at least thinking about having a better approach towards web sustainability. If not think that all these benefits bring more benefits and the sooner you apply some of the solutions said before the faster you are on the right track.&lt;/p&gt;

&lt;p&gt;Resources.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://www.sustainablewebmanifesto.com/"&gt;Sustainable Web Manifesto&lt;/a&gt; – Read, sign it and start making part of the solution&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.onepercentfortheplanet.org/"&gt;One percent –&lt;/a&gt; One percent at the time&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.mightybytes.com/"&gt;Mightybytes&lt;/a&gt; – Digital Agency and Certified B Corp committed to sustainability  &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://ecograder.com/"&gt;Ecograder&lt;/a&gt; – How green is your website&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.websitecarbon.com/"&gt;Website Carbon Calculator&lt;/a&gt; – How your website is measuring the planet?&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.thegreenwebfoundation.org/"&gt;Green Web Foundation&lt;/a&gt; – Green hosts around the world&lt;/li&gt;
&lt;li&gt;Books – &lt;a href="https://abookapart.com/products/sustainable-web-design"&gt;Sustainable Web Design&lt;/a&gt; and &lt;a href="https://www.oreilly.com/library/view/designing-for-sustainability/9781491935767/"&gt;Designing for Sustainability&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you have more resources than you know feel free to share them and we all win something out of it. &lt;/p&gt;

&lt;p&gt;Say tuned and follow the &lt;a href="https://twitter.com/mugas11"&gt;ride&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title>Web Sustainability - Practical Solutions for your website</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Wed, 21 Apr 2021 08:35:59 +0000</pubDate>
      <link>https://dev.to/mugas/web-sustainability-practical-solutions-for-your-website-6k9</link>
      <guid>https://dev.to/mugas/web-sustainability-practical-solutions-for-your-website-6k9</guid>
      <description>&lt;p&gt;Last week, I talk about what is web sustainability and why we need it. I also mention some of the problems that affect the internet to become more sustainable.&lt;/p&gt;

&lt;p&gt;Today I will talk about the good parts. The solutions, the small steps that can lead to a better website that can lead for a better company that leads to the benefits.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Green Hosting&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is given, you need a green host, a hosting service that is 100% powered by renewable energy and/or carbon offsets.&lt;/p&gt;

&lt;p&gt;The decision to choose one might be trickier than you think. You can find a green hosting data center but it’s on the other side of the world. So all your data has to travel around the world to be accessed ending up not be really energy efficient. You can check &lt;a href="https://www.thegreenwebfoundation.org/"&gt;here&lt;/a&gt; to find green hosts around the world. They try to become updated as some hosting might stop becoming green hosting or can start become one.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Development&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the great ways to achieve a website more sustainable is building with a modern tech stack or in case you use Wordpress for example, use a newer version and updated plugins.&lt;/p&gt;

&lt;p&gt;For example, PHP 7 ( Wordpress is based on PHP) is almost twice as fast as PHP 5.6. The faster website delivers better performance do more efficiency.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Designing&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the best if not the best way to start thinking about a website focusing on sustainability is building for &lt;a href="https://www.gscreations.io/blog/mobile-friendly-vs-responsive-design/"&gt;mobile&lt;/a&gt;. By focusing on mobile-first, you focus on what is important for the customer saving them time. The content needs to be easy to find, never use “dark pattern” systems( Have you tried to close &lt;a href="https://digitalsynopsis.com/design/dark-patterns-ui-ux-design-that-tricks-users/"&gt;your account to Amazon?)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A more &lt;a href="https://www.gscreations.io/blog/what-is-accessibility-on-the-web-and-why-it-is-important/"&gt;accessible&lt;/a&gt; website is also a great way to a website more sustainable. Why? By reducing inequality you are checking a sustainability goal from United Nations. The truth is that web sustainability is not closed only to how to make a website more efficient but is related to anything related to sustainability as a &lt;a href="https://www.un.org/sustainabledevelopment/sustainable-development-goals/"&gt;global goal&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Images and Videos&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Are also a big topic when it comes to planning a website. Many believe that a website with lots of images and videos in the background is pretty and it’s what the customer wants but, most of the time the simpler the better. If you need to use images and /or videos, if you think that they add value to the user, take always into consideration compressing images and reducing the videos.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fonts&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fonts can make your website look prettier but you know you can achieve a great design with fonts build up in the system and that you don’t need many different fonts for your website?&lt;/p&gt;

&lt;p&gt;One, a maximum of two is more than enough.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Wordpress&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Around 20% of the internet uses wordpress and sometimes is there that some of the problems exist. There are some ways you can achieve a better and more sustainable website with wordpress. Take into consideration that all that was said above is also 100% useful to Wordpress sites: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fast and light theme&lt;/li&gt;
&lt;li&gt;Limit Plugins – choose the necessary ones.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I could go deeper (I will in the future) about more solutions and how to implement them, but this is a short series about a huge topic so I want to mention and talk about the most important.&lt;/p&gt;

&lt;p&gt;Next week will be my last about this topic and I will focus on the benefits and resources to put in practice sustainable web development.&lt;/p&gt;

&lt;p&gt;I am &lt;a href="https://twitter.com/mugas11"&gt;here &lt;/a&gt;if you want to follow or just have a chat.&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title>Web Sustainability. What is it and how to approach it?</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Wed, 14 Apr 2021 08:55:38 +0000</pubDate>
      <link>https://dev.to/mugas/web-sustainability-what-is-it-and-how-to-approach-it-5fo4</link>
      <guid>https://dev.to/mugas/web-sustainability-what-is-it-and-how-to-approach-it-5fo4</guid>
      <description>&lt;p&gt;It was not long time ago when I first heard about web sustainability. I never thought deeply about how much the internet we use, and how we use it can affect the planet. We are just using our computer right? &lt;/p&gt;

&lt;p&gt;It’s true and, by using the computer and the internet, we save paper and time but where is the catch?&lt;/p&gt;

&lt;p&gt;It all started when I read that if the internet was a country would be the 6th most polluted country in the world (Now it's &lt;a href="https://www.sustainablewebmanifesto.com/"&gt;the 7th&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Then I decided to go deeper into this subject that I was not aware of it, therefore this month I will focus on Web Sustainability and I will divide it into 3 posts for easier reading:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Definition and Problem&lt;/strong&gt; – Today&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solutions&lt;/strong&gt; – 21/04/2021&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits and Resources&lt;/strong&gt; – 28/04/2021&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Web sustainability?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Gary Cook leads the campaign from Greenpeace to challenge global IT companies to become 100% renewably powered. He once said that:&lt;br&gt;
“&lt;em&gt;This (the internet) is something that if we build it the right way, with the right sources of energy, could help power our transition to renewables. If we build it the wrong way, it could exacerbate the problem&lt;/em&gt;.”&lt;/p&gt;

&lt;p&gt;A sustainable web can be defined by designing an internet that focuses on the needs of the present time but without compromising the future and the future generations. When creating digital products with web sustainability as a method you put people and the planet first.  &lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://www.sustainablewebmanifesto.com/"&gt;Sustainable Web Manifesto&lt;/a&gt;, a public declaration that you can also be part of, they call for internet that:&lt;/p&gt;

&lt;p&gt;·        &lt;strong&gt;Clean:&lt;/strong&gt; Services provided and used will be powered by renewable energy.&lt;/p&gt;

&lt;p&gt;·        &lt;strong&gt;Efficient:&lt;/strong&gt; Products and services will use the least amount of energy and material resources possible.&lt;/p&gt;

&lt;p&gt;·        &lt;strong&gt;Open:&lt;/strong&gt; Products and services will be accessible, allow users to control their data, and enable the open exchange of information.&lt;/p&gt;

&lt;p&gt;·        &lt;strong&gt;Honest:&lt;/strong&gt; Products and services will not mislead or exploit users.&lt;/p&gt;

&lt;p&gt;·        &lt;strong&gt;Regenerative:&lt;/strong&gt; Products and services will support an economy that nourishes people and the planet.&lt;/p&gt;

&lt;p&gt;·        &lt;strong&gt;Resilient:&lt;/strong&gt; Products and services will function in times and places where users need them most.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem(s)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Energy/ electricity&lt;/strong&gt;  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The big or the more direct problem with web sustainability is electricity. Internet is run on electricity. To have your website running you need electricity. The server that runs the hosting of your website needs to run 24/7 so of course that electricity can become a problem because it can be “dirty” electricity that runs on fossil fuels not using renewable energy. &lt;/p&gt;

&lt;p&gt;Globally renewables made up 26.2% of global electricity generation and should expect to raise 45% by &lt;a href="https://www.c2es.org/content/renewable-energy/"&gt;2040&lt;/a&gt;. So as you can see much electricity is still running on non-renewable energies making your webpage (maybe) not running on renewable energy.&lt;/p&gt;

&lt;p&gt;Many hosting providers are quite secrete about mentioning the sources of the energy used, and greenwashing is practiced by many, so it becomes quite difficult to choose the right hosting for it ( In the last post of this series I will focus on resources to check that situation).&lt;/p&gt;

&lt;p&gt;So by not running your website on green hosting (hosting that is served by renewable energy), the Carbon footprint of it becomes bigger.&lt;/p&gt;

&lt;p&gt;Even that many big companies nowadays use exclusively renewable energy for hosting ( and sometimes it can be difficult to achieve that) the truth is some bigger players are not yet fully &lt;a href="https://www.wired.co.uk/article/netflix-carbon-footprint"&gt;committed to it&lt;/a&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Web Performance&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Web performance is also a problem when it comes to sustainability on the web. I know, I am back at it &lt;a href="https://www.gscreations.io/blog/web-performance-what-is-it-and-how-to-improve-it"&gt;again&lt;/a&gt; but with a website optimized for performance you can achieve much more than you might think. &lt;/p&gt;

&lt;p&gt;If your website is slow if you are misleading your customers to stay more time on your website then they should make it difficult to access some button or info. Your customers will spend more( unnecessary) time on your website, spending more time on the internet and spending more electricity, therefore a bigger carbon footprint. I will address more this topic when I will talk about solutions in the next week.&lt;/p&gt;

&lt;p&gt;The energy of your website is also determined by the size of the page and that means that the more files, images, and videos your website has, the bigger the size, the slower it gets and more electricity it will consume.&lt;/p&gt;

&lt;p&gt;I believe that not from the developer side or the client side, nobody wants to build a website that is going to be heavy and consuming a lot of energy. The truth is that adding a new picture, a carousel of images, more videos, unnecessary pages makes step by step your website slow and more energy-consuming.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Emails and Video Calls&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We’ve been sending emails for a long time and we don’t even realize anymore. We write and press send and there it goes. Truth is that a simple (unnecessary) email can spend 1 gCo2 and an email with attachments and long text can reach up to 50. And that’s per email. Only in 2020, over &lt;a href="https://www.statista.com/statistics/456500/daily-number-of-e-mails-worldwide/"&gt;300 billion&lt;/a&gt; emails were sent in total.&lt;/p&gt;

&lt;p&gt;Video calls are not recent but Covid made them a must every day at all times. But are they all necessary? An hour of streaming can use up to 1000g of CO2. An ultra-definition video call is an &lt;a href="https://gerrymcgovern.com/the-hidden-pollution-cost-of-online-meetings/"&gt;equivalent of driving 23km&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;These are just a few examples of how “small” things we do in our website and/or company can affect the environment and our or in this case your company's carbon footprint.&lt;/p&gt;

&lt;p&gt;Next week I will focus on the solutions that we apply to a website/ company that can reduce the environmental impact.&lt;/p&gt;

&lt;p&gt;Web sustainability is a world inside a world and needs to be addressed fast to the majority of people.&lt;/p&gt;

&lt;p&gt; I am no expert myself but by sharing I am learning and hopefully reach someone to also start taking small steps that lead to big steps into a better sustainable world.&lt;/p&gt;

&lt;p&gt;You can follow me on &lt;a href="https://twitter.com/mugas11"&gt;Twitter &lt;/a&gt;where lately I have been focusing on building a project/ product by sharing all the processes.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Why SEO is important for your business</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Fri, 26 Mar 2021 07:36:45 +0000</pubDate>
      <link>https://dev.to/mugas/why-seo-is-important-for-your-business-k1j</link>
      <guid>https://dev.to/mugas/why-seo-is-important-for-your-business-k1j</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;What is SEO?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;You probably heard it before the word SEO, and how important it is for your site but how can we define SEO? &lt;br&gt;
SEO stands for &lt;strong&gt;Search Engine Optimization&lt;/strong&gt;. In other words, SEO is the tactics and practices that make your website stands out among other websites. Those tactics increase the quantity of traffic in your website but also the quality.&lt;/p&gt;

&lt;p&gt;That’s why SEO is important for your business because it’s with SEO that your page shows up in a better place in search results in Google or any search engine.&lt;/p&gt;

&lt;p&gt;There are many search engines, but the fact is Google takes almost 90% of all over web &lt;a href="https://www.statista.com/statistics/216573/worldwide-market-share-of-search-engines/"&gt;results &lt;/a&gt;so the majority of your customers will search for your product/service/information there. We also know that the first three results that show up in Google results are where around 70% of people click. We don’t know what goes into the algorithm of Google ( and it’s always changing) that makes or not makes your page stands out but we know what we can do best to optimize your website to make it more favorable to show up.&lt;/p&gt;

&lt;p&gt;So how SEO works? Search engines have bots, small software programs, that crawl all over the internet and all the information that they found the gather, and index it. The same way that you open a book and go to the index and search the topics of every book, Google and all search engines do that to all pages and all info. So the better your webpage is optimized and the better content it has, the more chances you have to show up in better results on Google. How we do that? I will talk about it in a moment but first, let’s just take something out of the way.&lt;/p&gt;

&lt;p&gt;You might are thinking, so if I pay for advertising for my website, does that affect the SEO of my page? Well in this case we are talking about SEM. Let’s see the differences between…&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;SEO VS SEM&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;SEO&lt;/strong&gt; is what optimizes your website for ORGANIC search results. It’s all about your content and how your website is made and prepared for SEO. &lt;strong&gt;SEM&lt;/strong&gt;, on the other hand, SEM uses paid strategies that make your website stands.&lt;/p&gt;

&lt;p&gt;Many consider that SEM includes both, organic and paid results because even that you buy a lot of ads for your website, in some instances the website has to be optimized to take these results. To create a clear distinction, if you are paying for an ad you are using SEM, while if you are optimizing your website content, metatags, etc you are working for organic search SEO.&lt;br&gt;
Now that we take this out of the way, let’s see what are the best…&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;SEO Best practices&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;We know now that if we want that our website stands outs, we need good SEO but how we do that?&lt;/p&gt;

&lt;p&gt;Seo is not a one-time job thing. SEO practices take time to take effect and need improvement always. Yes, you can when making a website, for example, create the website to be fully optimized for SEO, but that optimization needs to be grown. The good thing is, SEO takes time to implement but stays for long. So imagine that you have some blog posts that hit the point and it’s getting many hits and start show-ups in Google results, those good results will take effect for quite some time most of the time.&lt;/p&gt;

&lt;p&gt;There are many tactics and SEO is a big world so I will mention the biggest tactics and explain briefly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Keywords&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So keywords are important and should be put (in a smart way) on your webpage. So if you have a webpage that talks about organic vegetables, you should use these keywords in your content. Where you use that content is also important, for example, the title of the webpage and even the link. I will say it again: the title and the link of your webpage are really important for SEO and should contain the main keyword.&lt;/p&gt;

&lt;p&gt;Don’t overdo it also. It doesn’t help that you just put as many keywords as possible in your title or content. Search engines also know that and when you are stuffing keywords doesn’t help your webpage to show up in results&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Uniqueness&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your content, your title, your description of the webpage have to be unique. Google doesn’t like if you have content that is not unique so the chances that don’t show up in results are bigger.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Webpage not website&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You might have realized that I am writing a webpage and not a website. That’s because if your website has 2 pages, each page should be optimized individually.&lt;br&gt;
  For example, if you have 2 different services, you should use 2 different pages as it better for SEO.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Speed&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;I&lt;/strong&gt;n these 4 weeks, I have been talking about &lt;a href="https://www.gscreations.io/blog/web-performance-what-is-it-and-how-to-improve-it/"&gt;web performance&lt;/a&gt; and all the topics connected. So a website that is not optimized for &lt;a href="https://www.gscreations.io/blog/what-is-accessibility-on-the-web-and-why-it-is-important/"&gt;accessibility&lt;/a&gt; might not be&lt;a href="https://www.gscreations.io/blog/mobile-friendly-vs-responsive-design/"&gt; mobile friendly&lt;/a&gt; and it will decrease the speed of the website on mobile. Therefore it will affect the SEO of the page. Yes, all is connected.&lt;/p&gt;

&lt;p&gt;So a fast website, especially in mobile is a ranking factor for SEO for Google at least.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Images, videos&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Again, something that was mentioned in a late article, but when you have images or videos on your webpage they need to be optimized. Not only the size but also give a description, and an alternative text to each one of them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Content&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You want better SEO? Write (good) content. Not only content. A long bad blog post worth less than a short but amazing one. So it’s important that you feel your webpage with content but more importantly, it’s that content is unique and insightful to one is reading but also to your business.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;On-Site Seo vs Off-Site Seo&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;On-site-SEO&lt;/strong&gt; is all you can do to make your website optimized and with better performance to rank higher in search results. That includes all that I mentioned above and much more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Off-site-SEO&lt;/strong&gt; is what is made outside your website that gives a good impact on your website rankings. These off-site SEO tactics are not necessarily controlled by you, but all the good tactics that you do as on-site SEO affects the off-site SEO.&lt;/p&gt;

&lt;p&gt;The main topic of off-site SEO is backlinks that are links outside your website that point to your website/blog post, etc. That can be links that you don’t have any influence there – someone that likes a post or your company and decides to share the link. These are the best are they are natural links.&lt;/p&gt;

&lt;p&gt;There are also more manual links or self-made. Those are good but they have to be treated lightly as Google and other search results, know this and can see it as bad SEO, and instead of adding value to your website, it takes it away. What are they?&lt;/p&gt;

&lt;p&gt;Are links that you put in your customer's website that point to your website, are the links that you create in a forum or blog that points to your website. &lt;br&gt;
  All those of them create backlinks but if not backed up with some content they might even affect negatively your SEO.&lt;/p&gt;

&lt;p&gt;Also bought backlinks…&lt;strong&gt;Please don’t.&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;SEO Measuring results&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;So you know you have all these tactics above implemented, how do you measure it?&lt;br&gt;
It’s not straightforward the measurement, as I mentioned before, to see results in SEO, like measuring results you need &lt;strong&gt;Patience&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Think about SEO as the relationship between your website and Google and other search results. Like any relationship, it takes time to create bonds. You don’t ask your future partner to marry you on the first date right?&lt;/p&gt;

&lt;p&gt;So yes patience is necessary to see any results.&lt;/p&gt;

&lt;p&gt;Besides that how can you measure?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Organic Traffic&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Is your website getting more hits? When you do search for your company or something related you see any change in the search results? If so that is a good sign that your SEO is in practice and you start to see some results.&lt;/p&gt;

&lt;p&gt;You can do that with Google Analytics or there are some other &lt;a href="https://usefathom.com/"&gt;options&lt;/a&gt;, more private that you can use&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Keywords measure&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Like organic traffic, measuring the power of your keywords is a great way to know who your website is ranking.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Conversion Rate&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From this organic traffic how much of it is converted into real paying customers? That is the conversion rate and the bigger the better.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Time, mobile, backlinks&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are many other ways to measure SEO. How much time your customers spend on your website? How many people go to your website through mobile? Do you have a lot of backlinks to your webpage? These are other ways to measure your results.&lt;/p&gt;

&lt;p&gt;You might think that this is only for big companies that want to be in first on Google results, but the fact is SEO is everywhere and you can be the first in search results in one term (keyword) but not even show up in the 3 pages on another.&lt;/p&gt;

&lt;p&gt;For example, imagine that you have a barbershop in Helsinki If you go to Google and write barbershop the chance of you show up in the first results might be slim in the beginning, but you don’t need that barber shows in results in London or even maybe in Turku. So you might want that your business shows when the search is for example barbershop Helsinki, or even barbershop Punavuori right?&lt;/p&gt;

&lt;p&gt;That’s why we also talk about…&lt;/p&gt;

&lt;h1&gt;
  
  
  Local SEO
&lt;/h1&gt;

&lt;p&gt;Yes, there is local SEO. Some businesses don't want or need that their business shows up in google results globally. Don’t think that local SEO is not important as almost 50% of the searches in Google need information about local services/products…&lt;/p&gt;

&lt;p&gt;Did you know that 76% of people that search for something on a mobile visit a business within 24h?&lt;br&gt;
How you make your website prepared for local SEO?&lt;br&gt;
The tactics said above are all necessary, just more adapted to a local search but other things are important for Local Seo.&lt;/p&gt;

&lt;p&gt;For example having your business in google maps, in Google My Business, or and not less important reviews of your website are great ways to grow your local SEO&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is not only your website SEO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To end this post I need to refer that SEO is not only used for your website but for all the platforms you use. If you have a Youtube channel you also have to optimize the SEO of your channel to show up in the results. The same goes for Instagram, etc.&lt;br&gt;
Yes, SEO is everywhere basically online and it’s important to know about it and to know how to use it on your behalf.&lt;/p&gt;

&lt;p&gt;I hope you had liked this series and more will come&lt;/p&gt;

&lt;p&gt;Feel free to follow me on &lt;a href="https://twitter.com/mugas11"&gt;Twitte&lt;/a&gt;r to know more about my projects and ideas.&lt;/p&gt;

</description>
    </item>
    <item>
      <title> What is  Web Accessibility and why it is important?</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Fri, 19 Mar 2021 09:54:29 +0000</pubDate>
      <link>https://dev.to/mugas/what-is-web-accessibility-and-why-it-is-important-2e9h</link>
      <guid>https://dev.to/mugas/what-is-web-accessibility-and-why-it-is-important-2e9h</guid>
      <description>&lt;p&gt;Have you heard about accessibility in websites and apps and why it’s important? So what is accessibility? &lt;br&gt;
Accessibility as generally speaking can be defined as making your workplace, city, the public building where you work accessible to as many people as possible no matter what is their disability.  &lt;/p&gt;

&lt;p&gt;Does your favorite restaurant have a ramp for a wheelchair? Has the city hall building text in braille? Are people with disabilities given the same chances to work as a person with no disability? &lt;br&gt;
That is accessibility in the world, right?&lt;/p&gt;

&lt;p&gt;On the web, it works the same way. Accessibility on the web is how well prepared your website/app is for a person with a disability ( we will focus on main points on the next topic). Can a person with any disability access the website and have access to the same information as a person with no disability with the same amount of work? &lt;/p&gt;

&lt;p&gt;If you are thinking that not many people with disabilities go to your website, think again -  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Over 1 billion people in the world live with some form of disability (around 15% of the population)”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The important thing to retain is that accessibility is having the content of your website available to anyone. &lt;br&gt;
Many websites are still not improved for accessibility but every day more, developers consider that and hopefully also entrepreneurs when they decide that want a website for their business. &lt;br&gt;
When it comes to the public sector, in Europe since 2016 all apps and websites are required to have an accessibility statement for each website and provide people with disabilities better access to the website.&lt;br&gt;
Ok, so now that we know that accessibility is important we need to check…&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it is applied&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Where and how you apply accessibility standards on your website? For example, if you go to any website can you navigate through the main points of the website without touching your mouse, using only the tab button?&lt;/p&gt;

&lt;p&gt;That is an example of how accessibility can be applied to a website.&lt;/p&gt;

&lt;p&gt;The accessibility topics list would be long if I would explain it all. No matter how much I am learning about this subject, there is still much more for me to learn and discover.&lt;/p&gt;

&lt;p&gt;There are tough main topics that need to be followed when it comes to accessibility.&lt;/p&gt;

&lt;p&gt;I will talk slightly about the most important:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Color choice&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The color pallet of your website that you choose can be difficult to understand for many people. So it’s important to choose colors that provide maximum contrast. So between background color and text try to give enough contrast and choose colors that can be easy to read.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Link Style&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Links should explain what the link you are pressing is about. A link saying “click here” doesn’t help much. If you use an image as a link, works the same. That image has to have an alternative text explaining what that link does.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Buttons&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One feature that almost every website has, is buttons. And many of them when they are created, for stylish purposes, are not developed as buttons in the HTML. Therefore when a person is using the screen reader to access the website and is passing that "button", because was not created as a button, the screen reader would not say it’s a button.&lt;/p&gt;

&lt;p&gt;The solution would be or create the button as a button, or in the case, that this is not possible ( it’s almost always is), give a role to the element created as a button.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Form&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Almost every website has a form no matter if it's in for contact or subscription they are really important. &lt;/p&gt;

&lt;p&gt;Consequently, when building the form, every input should have a label for the user to know what the input is for. When grouping more than one form element, you should also label that group.&lt;/p&gt;

&lt;p&gt;If you use checkboxes or radio buttons, tag them as what they are.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Alternatives&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When building a website use the “alt” text on an image. So you have an image on your website, but if a person with blindness or some vision disability goes to your website might not see the image, so images must have an alternative text to it, for these cases. The same goes for audio or video content. They also need an alternative.&lt;/p&gt;

&lt;p&gt;But accessibility is not only made for people with disability. In fact...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accessibility for all&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's give the example of a vision disability, it's important to reiterate that we're not only talking about people that are blind but also people that are visually impaired (e.g. low vision or color blind). The same goes for people with motor/cognitive disabilities, etc.&lt;/p&gt;

&lt;p&gt;For example, carpal tunnel affects many people and it might not be your first thought when thinking of disability but the fact is that someone with carpal tunnel will be accessing your website mostly with the keyboard only, so is your website prepared? &lt;/p&gt;

&lt;p&gt;Therefore temporary disabilities should also be taken into consideration.&lt;/p&gt;

&lt;p&gt;Even that you don’t have any disability when going to a website and if for some reason the image doesn’t load, you don’t know what is there. But if you have an alt text on it, even that the image would not show up, there will be the text about that image.&lt;/p&gt;

&lt;p&gt;Another example is people that have a small phone with a small screen, they deserve as much to access your website as someone with a big mobile (this was also covered in last week &lt;a href="https://www.gscreations.io/blog/mobile-friendly-vs-responsive-design"&gt;post&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;We only now need to discover about...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it can improve the SEO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Even that you think that is a lot of work for a small website (that is not), what if I tell you that having &lt;/p&gt;

&lt;p&gt;a website accessible improves SEO and of course, good performance of your &lt;a href="https://www.gscreations.io/blog/web-performance-what-is-it-and-how-to-improve-it"&gt;website&lt;/a&gt; leads to more clients finding you online.&lt;/p&gt;

&lt;p&gt; "Alt" text we talked a coupled of times here but the truth is one main topic of good SEO is having alt text on all images. The same goes for video&lt;/p&gt;

&lt;p&gt;Using page titles and headings to define your pages. That also is accessibility has helped people with some disability know what the page they are is about.&lt;/p&gt;

&lt;p&gt;Anchor links are also important both for SEO and for accessibility as help the user and Google 😊 know what link it is and where it leads. &lt;/p&gt;

&lt;p&gt;Great now if you want to know more here are some...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Below are some links to test the accessibility of a website and as well know more about it.&lt;/p&gt;

&lt;p&gt;Hope after this I may have reached someone to have another approach about accessibility on the web. Next week will be my last post for this series and will focus on SEO.&lt;/p&gt;

&lt;p&gt;If you want to know more and follow my next projects and topics to talk about, follow me on &lt;a href="https://twitter.com/mugas11"&gt;Twitter&lt;/a&gt; and feel free to contact me with any questions, comments, or anything.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://khan.github.io/tota11y/"&gt;Khan Academy visualization kit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://a11yresources.webflow.io/"&gt;Accessibility resources from A11y&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wave.webaim.org/"&gt;Accessibility evaluation tool&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Dom Manipulation with 3 examples</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Tue, 16 Mar 2021 08:51:07 +0000</pubDate>
      <link>https://dev.to/mugas/dom-manipulation-with-3-examples-2pap</link>
      <guid>https://dev.to/mugas/dom-manipulation-with-3-examples-2pap</guid>
      <description>&lt;p&gt;When you are starting learning javascript I believe that one of the first things you will hear is about DOM Manipulation. Unless you are only using the console, you will need some knowledge of how to use javascript within the Dom.&lt;/p&gt;

&lt;p&gt;I don't want to focus too much on the theory as I learn more by doing and creating things, but let's define the DOM and what it means to "manipulate it".&lt;/p&gt;

&lt;p&gt;DOM stands for Document Object Model and works as a tree and in that tree, there are all elements of the page. That tree has different relationships(parent, children, sibling, etc) depending on their position. If a tree is difficult to imagine, think about a family. There are the parents, so when they have a kid their kid is their children right? If they have another, that child is going to have a sibling. Makes sense? So are the parents the main parents of that family? Well, it depends. Those parents are children of someone, so then they became children and their parents are the main parent element...&lt;/p&gt;

&lt;p&gt;So the main parent is the HTML document but every element has its own direct parent element. The main idea to get here is it's good to know where you are in the DOM to be able to manipulate it.&lt;/p&gt;

&lt;p&gt;Now let's go to our project:&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gscreationsdom.netlify.app/"&gt;Project page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mugas/Blog-Post/tree/master/DOM"&gt;GitHub page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://codepen.io/mugas/pen/QWGJrRa"&gt;Code Pen&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some things we will not cover in this post: The CSS, and the &lt;code&gt;show the code&lt;/code&gt; function ( note at the end of the post).&lt;/p&gt;

&lt;p&gt;So what topics are we going to cover in this post?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accessing the DOM&lt;/li&gt;
&lt;li&gt;Manipulating the DOM&lt;/li&gt;
&lt;li&gt;Creating new elements DOM&lt;/li&gt;
&lt;li&gt;Adding event listeners&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We will cover all these topics with 3 small examples:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We have some text, we will select it and add changes to it &lt;/li&gt;
&lt;li&gt;We have a picture and add some different style to it&lt;/li&gt;
&lt;li&gt;Insert a recipe into the Dom&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Take this html:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;     &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"query-selector-all"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"queries"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"first_element"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"first__title"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Query Selector All - Select all elements&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;I am a paragraph and I am selected also&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"second_element"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Query Selector All - Select all elements&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;I am a paragraph and I am selected also&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have a section that inside as 2 different sections. Inside of these sections there is an article with a div. The magic of Dom is that you can access the elements that exist on the DOM. How we do that? There is a couple of methods we can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementsByClassName&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// If instead of an id your element has a class, this is the method where you can access it.&lt;/span&gt;

&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementsByTagName&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;//You don't even need to add a class name or id, you can access the element straight from the tag&lt;/span&gt;

&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;//The most used to access the DOM, because with it you can access class, id and tag. So each case would be:&lt;/span&gt;

&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.classname&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;section&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are the ways to access the DOM. I only use the &lt;code&gt;querySelector&lt;/code&gt; and the &lt;code&gt;querySelectorAll&lt;/code&gt; as it gives me all the info I want.&lt;br&gt;
To access the section with the class query-selector-al. we go to our js and write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;allElements&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.query-selector-all&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;allElements&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why the &lt;code&gt;querySelectorAll&lt;/code&gt;and, not the &lt;code&gt;querySelector&lt;/code&gt;? Because this class name has more than one element, so with querySelectorwe only access the first element and we want to access all. &lt;/p&gt;

&lt;p&gt;But if you check your console we see that &lt;code&gt;allElements&lt;/code&gt; return a Nodelist, so it returns all the elements inside that class. Ok, so we access the DOM and the section we wanted to manipulate but how we do it when it returns a Node list? You have to loop all over those elements with a forEach for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;allElements&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;eachElement&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;eachElement&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you open the console you see that now you have access to all elements that are inside the class Name. I want that when we load the page the all the text changes color. First, we go to our CSS and create that style inside a new class. Let's name it &lt;code&gt;selector__all&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.selector__all&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#edbd54&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="m"&gt;2s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Basically, we just add color to the text with some transition to have some delay. &lt;br&gt;
We just need to add this class name to all elements inside the section and because we already loop over them and have access we just need to go to the loop and add the class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;allElements&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;eachElement&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;eachElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;selector__all&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What we are doing here? Because we are looping each element we have access to each one of them when looping. Then we are just adding the class, that has the code of color change, to each of the elements.&lt;br&gt;
And just like this, our text now shows in a different color after 2 secs.&lt;br&gt;
The main thing to remember, when you want to access/manipulate more than one element at a time, use the &lt;code&gt;document.querySelectorAll()&lt;/code&gt; and loop over it to access each of the elements inside.&lt;/p&gt;

&lt;p&gt;What if you only have one element?&lt;br&gt;
It's easier and you probably know the answer now.&lt;/p&gt;

&lt;p&gt;This is your HTML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt; &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"query-selector"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"first__image"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://picsum.photos/420"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"random image from picsum "&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"black__board"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"second__code"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;How to select one element?&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"code__show__second"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Show me the code&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have a section, and inside of it, there are 2 articles. But we only want to access the image that is inside the first article.&lt;br&gt;
The image has the class &lt;code&gt;first__image&lt;/code&gt; Then in your js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;firstImage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.first__image&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we console it we see that we have access to the image. I want that by clicking on the image, it will turn 360 degrees and the borders will be round.&lt;br&gt;
We talk about access the DOM, manipulating the Dom, now we go add event listeners.&lt;/p&gt;

&lt;p&gt;Event listeners are basically to some element you attach some action(event) that will trigger something. In this case, we will add an event(click) that will trigger the manipulating of the image.&lt;/p&gt;

&lt;p&gt;How we do that?&lt;br&gt;
we have now &lt;code&gt;firstImage&lt;/code&gt;. To add the event listener we need to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;firstImage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, you write the element. In this case, is the &lt;code&gt;firstImage&lt;/code&gt;, then you add event listener; in this case, is the 'click' function. There are &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Events"&gt;plenty &lt;/a&gt;more.&lt;br&gt;
And then has any function, you write the code you want to add inside that function. I just console a "hello" for now. If you open the console it should show up there every time you click the image&lt;/p&gt;

&lt;p&gt;Ok, now we add an event listener to the image when we click on it. So we go to our css and :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.round&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rotate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;360deg&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="m"&gt;10s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Like we did in the first example, we create a class, in this case, names &lt;code&gt;round&lt;/code&gt; and add the style we want. Here we add a border-radius of 50% to make it round and rotate 360 degrees.&lt;br&gt;
Now that we have the class we go to our js event listener and rewrite:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;firstImage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;firstImage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;round&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And just like that when you reload the page, and click the image, it became round while rotating 360 degrees.&lt;br&gt;
Great right? With a couple of lines of code we already talk about 3 of the 4 topics I mentioned above about DOM Manipulation&lt;/p&gt;

&lt;p&gt;Now we go to the more fun for me that is creating new elements on the DOM.&lt;br&gt;
How?&lt;br&gt;
Let's say you have a recipe app that you want to add a new recipe and show up on the page. By adding a new recipe to the dom you are indeed creating new elements on it.&lt;/p&gt;

&lt;p&gt;Here is our html:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"recipes-manager"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

      &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"recipes-manager_docs"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"recipe-background"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"first"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Recipe Name&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"cuisine"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Type of cuisine&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"cuisine"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"cuisine"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"second"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"number"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;How many people&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"number"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"number"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"number"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"buttons"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"file"&lt;/span&gt;  &lt;span class="na"&gt;accept=&lt;/span&gt;&lt;span class="s"&gt;"image/*"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"file"&lt;/span&gt; &lt;span class="na"&gt;onchange=&lt;/span&gt;&lt;span class="s"&gt;"loadFile(event)"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"display: none;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"upload"&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"file"&lt;/span&gt;  &lt;span class="na"&gt;tabindex=&lt;/span&gt;&lt;span class="s"&gt;"0"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"cursor: pointer;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Upload Image&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt; 
          &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button-recipe"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Show recipe&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;


      &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;

      &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"recipe-menu"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"recipe"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"output"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's explain what we have here.&lt;br&gt;
There is a big section with the class &lt;code&gt;recipes-manager&lt;/code&gt;.Inside that section, there are 2 articles that include the form to add the recipe and the "area" where the recipe is going to show up. The first is the article with the class &lt;code&gt;recipes-manager_docs&lt;/code&gt;. Inside of it, I add also an event to be able to upload the image from your pc( &lt;code&gt;onchange="loadFile(event)"&lt;/code&gt;).&lt;br&gt;
How we do this?&lt;/p&gt;

&lt;p&gt;First, we add to our js, our recipe name, cuisine, and for how many people&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.recipe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;buttonRecipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.button-recipe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recipeName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recipeType&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.cuisine&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;numberPeople&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.number&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We also add the button to show up the recipe and also the div where the recipe is going to sit.&lt;br&gt;
To add new elements there are some ways like for example &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement"&gt;this&lt;/a&gt; but I will focus only on the template strings that is the most forward way for me.&lt;br&gt;
Note: In production be aware of&lt;a href="https://owasp.org/www-community/attacks/xss/"&gt;Cross Site Scriptings &lt;/a&gt;when using the template literals.&lt;/p&gt;

&lt;p&gt;How do template literals work?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;` I am a templare literal`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You create a variable and inside backticks, you write some text. Now you want to add that text on the HTML, in this case to the &lt;code&gt;recipe&lt;/code&gt;&lt;br&gt;
So you would do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;myHTML&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And just like this, the text that is inside the variable &lt;code&gt;myHTML&lt;/code&gt; will show up on the page ( in the end I will explain the inner HTML with the text Content).&lt;br&gt;
We just add the first text into the DOM. Can we make it better? Of course&lt;/p&gt;

&lt;p&gt;Instead of the text above we could put for example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;` 
&amp;lt;h1&amp;gt;This is a heading&amp;lt;/h1&amp;gt;
&amp;lt;p class="style-me"&amp;gt;This is a paragraph&amp;lt;/p&amp;gt;
`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we create a template literal that has a heading and a paragraph. We even add a class to the paragraph that we can style on CSS.&lt;br&gt;
For me that is really useful and great has with only one string template we can completely change the DOM.&lt;br&gt;
So back to our example, let's make it work.&lt;/p&gt;

&lt;p&gt;Before we add to our javascript our input but that doesnt get the value that is going to be inserted. To get that value we can easily do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recipeNames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;recipeName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;typeOfRecipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;recipeType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;numberPeoplePerRecipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;numberPeople&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#output&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;//image we get to the function loadFile and then we add it to the output that is going to where we are going to add the recipe&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By doing this now, &lt;code&gt;recipeNames&lt;/code&gt;, &lt;code&gt;typeOfRecipe&lt;/code&gt;,  and &lt;code&gt;numberPeoplePerRecipe&lt;/code&gt; will get the real value that the user will put.&lt;/p&gt;

&lt;p&gt;Now we create our template string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`
&amp;lt;section class="recipe-card"&amp;gt;
  &amp;lt;div class="card"&amp;gt;
    &amp;lt;p class="recipe-name"&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;recipeNames&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/p&amp;gt;
    &amp;lt;p class="recipe-type"&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;typeOfRecipe&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/p&amp;gt;
    &amp;lt;p class="recipe-number"&amp;gt; Serves &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;numberPeoplePerRecipe&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="recipe-image"&amp;gt;
    &amp;lt;img src="&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;" alt="ola" class="recipe-image"/&amp;gt;
  &amp;lt;/div&amp;gt;

&amp;lt;/section&amp;gt;
`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We created now a new piece of HTML with template string interpolation. Interpolation means that we get the value from Javascript and then send it to HTML. How we do that? We know that &lt;code&gt;recipeNames&lt;/code&gt;gets the value of the name of the recipe the user puts. We have that value in Javascript. Because we are using template literal to "send" back that value to HTML inside the backticks we have to use the &lt;code&gt;${value}&lt;/code&gt;. &lt;br&gt;
Makes sense? Now we have the template and it will show up in the DOM as we before set to :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;myHTML&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But we want that this happens when the button &lt;code&gt;Show Recipe&lt;/code&gt; it's pressed.&lt;br&gt;
Let's refactor our code.&lt;br&gt;
We create a function called &lt;code&gt;insertRecipe&lt;/code&gt; where we add the code that we wrote before&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;insertRecipe&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recipeNames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;recipeName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;typeOfRecipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;recipeType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;numberPeoplePerRecipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;numberPeople&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#output&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`
&amp;lt;section class="recipe-card"&amp;gt;
  &amp;lt;div class="card"&amp;gt;
    &amp;lt;p class="recipe-name"&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;recipeNames&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/p&amp;gt;
    &amp;lt;p class="recipe-type"&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;typeOfRecipe&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/p&amp;gt;
    &amp;lt;p class="recipe-number"&amp;gt; Serves &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;numberPeoplePerRecipe&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="recipe-image"&amp;gt;
    &amp;lt;img src="&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;" alt="ola" class="recipe-image"/&amp;gt;
  &amp;lt;/div&amp;gt;

&amp;lt;/section&amp;gt;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;myHTML&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;myHTML&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We now add an event listener to the button that when the button is clicked this function is run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;buttonRecipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;insertRecipe&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It should work now. Fill up all the info for the recipe, press the button and it shows up.&lt;/p&gt;

&lt;p&gt;Before we finnish this tutorial some notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;InnerHtml vs Text Content vs outerHTML&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To understand better the differences between these 3 properties nothing is better than see an example.&lt;/p&gt;

&lt;p&gt;So our html is like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;section class="queries"&amp;gt;
        &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"first_element"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"first__title"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Query Selector All - Select all elements&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;I am a paragraph and I am selected also&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"second_element"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Query Selector All - Select all elements&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;I am a paragraph and I am selected also&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In our js we select the &lt;code&gt;queries&lt;/code&gt;element and console each one of the properties:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.queries&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;outerHTML&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TextContent as the name it says it returns the content of elements that were selected. No there are no tags involved only the text. &lt;br&gt;
It's useful also when you want to change the text of the DOM. Imagine that when pressing the button the text changes. We can use text Content for this.&lt;/p&gt;

&lt;p&gt;InnerHtml returns the HTML that is inside of what we select. So what is inside the section with the class named "queries"? It is the article and then the heading and the paragraph and then it's what's is shown. That is why it's used with template literals. In our recipe example, we selected the div where we want to insert the recipe. So we want our recipe in the inner part of our div :)&lt;/p&gt;

&lt;p&gt;OuterHTML includes the element that is selected. In this case the class "queries".&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parent Element vs Children vs Child Element Count&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's always good where we are in the DOM. One way to know what is using the parentElement and the children's property. &lt;/p&gt;

&lt;p&gt;Let's look to another HTML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt; &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"query-selector-all"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"queries"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"first_element"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"first__title"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Query Selector All - Select all elements&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;I am a paragraph and I am selected also&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"second_element"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Query Selector All - Select all elements&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;I am a paragraph and I am selected also&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"black__board"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"first__code"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;How to select all elements?&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"code__show__first"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Show me the code&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
         &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In our js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blackBoard&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.first__code&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;group&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;blackBoard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parentElement&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;blackBoard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;blackBoard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;childElementCount&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What we get here? with the parentElement we can see who is the element that is a parent and the children... Well, the children Element.&lt;br&gt;
You can even do:&lt;br&gt;
&lt;code&gt;blackBoard.parentElement.parentElement&lt;/code&gt;&lt;br&gt;
to see who is the element above if any. You can do this till it reaches the HTML element.&lt;br&gt;
In the last one &lt;code&gt;chilElementCount&lt;/code&gt; you can check how many children elements the parent has.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Show me the Code section&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you see in the final project, there are 2 sections where is a section to see part of the code that got to manipulate the DOM, as explained above. I will not explain here what was done as it's the same almost as the template literal that was used for the recipe.&lt;/p&gt;

&lt;p&gt;Even though, if you want to know more, or if something that is not well explained please get in &lt;a href="https://twitter.com/mugas11"&gt;touch &lt;/a&gt;and I try to make it more understandable.&lt;/p&gt;

&lt;p&gt;*Performance and Responsiveness &lt;/p&gt;

&lt;p&gt;I tried that in all posts they are optimized for performance. So that includes SEO + Accessibility mostly. Also, I make the effort that the final project is available also on mobile. It's not 100% perfect but I believe you can access and understand it.&lt;/p&gt;

&lt;p&gt;If you like this post or want to know more follow me on &lt;a href="https://twitter.com/mugas11"&gt;Twitter&lt;/a&gt;.   There I talk about programming, entrepreneurship and occasionally food and parenting :)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>dom</category>
    </item>
    <item>
      <title>Prismjs + Nuxtjs -Easy set up</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Mon, 15 Mar 2021 11:43:33 +0000</pubDate>
      <link>https://dev.to/mugas/prismjs-nuxtjs-easy-set-up-204l</link>
      <guid>https://dev.to/mugas/prismjs-nuxtjs-easy-set-up-204l</guid>
      <description>&lt;p&gt;This website is an ongoing project. It's not perfect, and it never will be; in fact, as you search the website you will see many things that you might see me &lt;a href="https://twitter.com/mugas11/status/1367772956533915648?s=20"&gt;advocate&lt;/a&gt; that I am not doing on the website.&lt;/p&gt;

&lt;p&gt;I know it might seem an easy way out, but the fact is that I want to upgrade the website as I upgrade myself, so I want to share when I update the website with something new. Like that, I learn better, get documented and hopefully, it helps someone in the future. &lt;/p&gt;

&lt;p&gt;So expect many posts about things I did on this website. &lt;/p&gt;

&lt;p&gt;Today it will be about code snippets and their highlight while writing for example a code post. &lt;/p&gt;

&lt;p&gt;When I created this website and started to write code posts I realize that the code was not highlighted and would not look good.&lt;/p&gt;

&lt;p&gt;The best solution was adding &lt;a href="https://prismjs.com/"&gt;Prismjs&lt;/a&gt; and after some fast search was easy to implement.&lt;/p&gt;

&lt;p&gt;So let's do it:&lt;/p&gt;

&lt;p&gt;First, we install Prismjs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt; &lt;span class="nx"&gt;prismjs&lt;/span&gt; &lt;span class="nx"&gt;clipboard&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in the file &lt;code&gt;nuxt.config.js&lt;/code&gt; add the plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="nx"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;~/plugins/prism&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that go to your plugin folder in Nuxt and create a file named  &lt;code&gt;prism.js&lt;/code&gt;. Open it and write this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Prism&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;prismjs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;prismjs/themes/prism-tomorrow.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// You can add other themes if you want&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Prism&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are many options besides the ones above, but there are the basics to make it work.&lt;/p&gt;

&lt;p&gt;So now Prism is installed and we informed Nuxt about it we just need to add it to the page we need, normally &lt;code&gt;_slug.vue&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Prism&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;~/plugins/prism&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="nx"&gt;mounted&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Prism&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;highlightAll&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that is all. With a few steps, you have nice highlights on your blog page.&lt;br&gt;
If you like this post, feel free to follow me on &lt;a href="https://twitter.com/mugas11/"&gt;Twitter&lt;/a&gt; and send me a message in case you have any doubt about this post 😊&lt;/p&gt;

</description>
      <category>prismjs</category>
      <category>nuxt</category>
    </item>
    <item>
      <title>Mobile Friendly vs Responsive Design</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Fri, 12 Mar 2021 11:15:05 +0000</pubDate>
      <link>https://dev.to/mugas/mobile-friendly-vs-responsive-design-k55</link>
      <guid>https://dev.to/mugas/mobile-friendly-vs-responsive-design-k55</guid>
      <description>&lt;p&gt;When creating a website, not only the desktop version counts but also the mobile version. One of the reasons behind that is the mobile traffic worldwide has grown over 220% in the last 7 years. Nowadays more people use mobile over desktop. &lt;/p&gt;

&lt;p&gt;A website that features their content and product or service easily and attractively on mobile is a way to go. Not only for the user but the company, for the SEO, and even for the search engines.&lt;/p&gt;

&lt;p&gt;What is looking good on mobile? The answer is not straightforward but let’s try. Image a website that on the desktop looks great. Then you think that you want to get that look also on mobile but what is the best way? We “shrink it up” till all fit on one page? Many websites are still like that and it’s not a good experience. It’s difficult to find or press the buttons, the information is all clumsy., etc...&lt;/p&gt;

&lt;p&gt;What are the main features of your product or service? What is the most important call to action you want to show? Figure that out and then you can plan how is going to look on mobile. But you need to make it responsive, hence the responsive design, that more than 50% of websites are now using. &lt;/p&gt;

&lt;p&gt;Let’s focus then on 3 aspects of mobile development, what they are, and should you use them or not: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mobile Optimized vs Mobile Friendly&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Responsive design vs Adaptive Design&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mobile-First Approach&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Mobile-Friendly vs Mobile Optimized&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Mobile-Friendly&lt;/strong&gt; is the minimum that your website should have. Normally that is enough for Google. You can check if your website is mobile “approved” &lt;a href="https://search.google.com/test/mobile-friendly?utm_source=mft&amp;amp;utm_medium=redirect&amp;amp;utm_campaign=mft-redirect"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Mobile-friendly is not enough, as what happens, in that case, is that the mobile version gets a scaled-down version of your website. You can access all the features but not in an easy way leading to a bad user experience. Also, this approach is not adapted to different screens.&lt;/p&gt;

&lt;p&gt;Because that mobile-optimized came to the rescue. With &lt;strong&gt;mobile optimization&lt;/strong&gt;, the mobile version is taken into consideration. What does that mean? It means that the images, buttons, text, links are adapted for the mobile version. Can be size, place, color, or any other feature to make it look better on mobile. I mention before that for mobile is important where and what content there is on mobile. That is &lt;strong&gt;mobile optimized&lt;/strong&gt;. So the website on mobile is more minimalist but as or more functional than the desktop version. &lt;/p&gt;

&lt;p&gt;Normally mobile-optimized website is only a column website, which makes it easier to scroll So a mobile-optimized website is mobile-friendly but not the other way around. &lt;/p&gt;

&lt;p&gt;The winner here: &lt;strong&gt;Mobile Optimized.&lt;/strong&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Responsive design vs Adaptive Design
&lt;/h2&gt;

&lt;p&gt;What is &lt;strong&gt;adaptive design&lt;/strong&gt;? A mobile website with adaptive design changes the appearance based on the browser width, but so responsive design.&lt;/p&gt;

&lt;p&gt;The important feature is that adaptive design adapts the browser width at a specific point while responsive not. What I mean is when an adaptive design is created, that browser adaptation is based on mobile screen sizes for example. So that browser adaptation is based on fixed sizes. It works and it’s used on desktop websites that are created before and you have to create a mobile version. &lt;/p&gt;

&lt;p&gt;It’s a good way but it’s not fluid as even that it has multiple layouts( one for each type of screen size), these multiple layouts are with fixed sizes.&lt;/p&gt;

&lt;p&gt;What is responsive design? &lt;strong&gt;Responsive design&lt;/strong&gt; has only one layout and that layout will be adapted to the screen size in percentage normally. Is easier to implement and it’s most used nowadays. Instead of focusing on straight sizes of the screen, the layout will adapt to the % of the size. Responsive has much more to it than that, but without going too much technical I leave it here.&lt;/p&gt;

&lt;p&gt;I think there are no winners here as both of them as great advantages and can be used accordingly with the situation. Remember that you know better where your customers are and what they want. If they use your website on mobile then it makes all sense to use... &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Mobile-First Approach&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The name kind of says it all so no plot twist here. The &lt;strong&gt;Mobile-first approach&lt;/strong&gt; means that when a product/website/service is created is focused on how it looks on mobile-first. &lt;/p&gt;

&lt;p&gt;Why? Because of progressive enhancement. Progressive enhancement put simply focus on the content. So when you are on mobile is important that the right content is displayed in a straight and simple way for the user. That is difficult, as you have to know what to focus on to show off first.&lt;/p&gt;

&lt;p&gt;First, you focus on the content that is important to show no matter what, and then you build the website based on that.&lt;/p&gt;

&lt;p&gt;Is it challenging but after that is done, all the other layouts became easier. You have put the important content and information on the lowest browse, so now you “ have to scale up”. &lt;/p&gt;

&lt;p&gt;Simply mobile-first approach builds the website with the users that are on mobile on their mind by improving their user’s experience. This was my short approach to websites on mobile. What are your experiences on mobile and what is for you a good mobile experience when visiting a website? &lt;br&gt;
Follow me on &lt;a href="https://twitter.com/mugas11"&gt;Twitter &lt;/a&gt;where I talk more about programming, entrepreneurship among other subjects.&lt;/p&gt;

&lt;p&gt;Next week I will focus on the next topic of web performance: accessibility.&lt;/p&gt;

&lt;p&gt;Attributions:&lt;/p&gt;

&lt;p&gt;image: Freepik.com&lt;/p&gt;

</description>
      <category>responsivedesign</category>
      <category>webdev</category>
      <category>performance</category>
    </item>
    <item>
      <title>Web performance - What is it and how to improve it?</title>
      <dc:creator>Ricardo Moreira</dc:creator>
      <pubDate>Fri, 05 Mar 2021 10:34:16 +0000</pubDate>
      <link>https://dev.to/mugas/web-performance-what-is-it-and-how-to-improve-it-4ppn</link>
      <guid>https://dev.to/mugas/web-performance-what-is-it-and-how-to-improve-it-4ppn</guid>
      <description>&lt;p&gt;This post was originaly posted in my &lt;a href="https://www.gscreations.io/blog/web-performance-what-is-it-and-how-to-improve-it"&gt;website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Web performance is a keystone of any website. Your website might look amazing but if it doesn't have a good performance, does it show on google search results? Might be a challenge.&lt;/p&gt;

&lt;p&gt;So what is web performance? Putting simply, Web performance is the measure of the page speed of your website. User doesn’t have much patience when going to a website, and if that website is slow you know what happens right? They seek another alternative. Of course that this is not linear but more and more everyday web performance is important.&lt;/p&gt;

&lt;p&gt;Some statistic to back it up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If your e-commerce website is too slow, the basket abandonment can reach 75%&lt;/li&gt;
&lt;li&gt;74% users leave the website on mobile if it doesn’t load after 5sec&lt;/li&gt;
&lt;li&gt;44% of customers will tell their friends about a bad experience online&lt;/li&gt;
&lt;li&gt;Amazon realizes that “only” one second in their website could cost 1.6 billion in sales each year&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Besides the load speed, all site performance is important to determine how your website stands among others.&lt;/p&gt;

&lt;p&gt;If your website has a bad performance, no matter how good is your product, you have few chances to show up good in the search results of Google. Therefore, a website with good performance has much more chances to show up in many searches. Web performance in the most basic form, or put differently, a website with good performance is a website with minimal waiting time load. Even that your website is fast but on mobile is not responsive, your customer ends up going to a different website right? Thus responsive website, i.e. a website that is mobile friendly is a good check web performance checklist for any website.&lt;/p&gt;

&lt;p&gt;Then what makes a website with good performance? Web performance focuses not only on speed but on many different topics. All those topics are possible to achieve on your website.&lt;/p&gt;

&lt;p&gt;For now, I will just mention the 5 main topics about web performance that you should take into consideration, in my opinion,  on your website. Let’s go through them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mobile Friendly&lt;/strong&gt; 📱&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A responsive website has more chances to show on Google search results. When you have a website with a good user experience on mobile your customers are happier. Nowadays many websites are built with a mobile-first approach design&lt;/p&gt;

&lt;p&gt;Statistics : 94% of People Judge Websites on Responsive Web Design&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Accessibility&lt;/strong&gt; 🦻🏻&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since a directive from 2016, all websites or apps of the public sector are demanded to meet technical accessibility standards. Most private companies are now also implementing the same standards to their websites. What does this mean? Accessibility is when a website or apps are designed that people with disabilities can use them. Can be color contrasts, images with no alternative text, no enough labels in the forms, etc. Main point: Your website has to be accessible.&lt;/p&gt;

&lt;p&gt;Statistics : About 217 million people worldwide have moderate to severe vision impairment, which is expected to triple from 36 million to 115 million by 2050. In addition, 826 million people live with a near-vision impairment&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Speed&lt;/strong&gt; 🚄&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Well, this is the first one that comes to everyone's mind right? Your website has to be fast. The load time. How fast? For mobile, your website should load in 1-2 seconds. It’s crazy but pages that take more than 3 seconds tend to be abandoned by the users ( around 53% of mobiles sites).&lt;/p&gt;

&lt;p&gt;Statistics: 1 sec delay reduces customer satisfaction by 16%&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Images&lt;/strong&gt; 🖼️&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everyone likes images on their websites. The bigger the better right? Well, when images are not optimized they take too much space, and by taking too much space what happens to your website? Yes, it goes slow, really slow.&lt;/p&gt;

&lt;p&gt;On the other end if you shrink all images to the point that the products are not appealing, then sales can be affected again. It’s all about finding the sweet spot .&lt;/p&gt;

&lt;p&gt;Statistics: 39% of people will stop engaging with a website if images won’t load or take too long to load.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deserve be mentioned&lt;/strong&gt; 🍢&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are other topics you should ask/discuss when it comes to web performance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not the best web hosting&lt;/li&gt;
&lt;li&gt;Delete plugins or ask if you need that plugin&lt;/li&gt;
&lt;li&gt;Remove not used CSS&lt;/li&gt;
&lt;li&gt;Minify files(js, CSS, HTML)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was a small and fast introduction to web performance. What are for you, your main topics about web performance? I will go back to this subject focusing on each topic in the next posts. You can always follow me on &lt;a href="https://twitter.com/mugas11"&gt;Twitter&lt;/a&gt; where I talk about web development and entrepreneurship among other subjects 😊.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>seo</category>
      <category>webperf</category>
    </item>
  </channel>
</rss>
