<?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>Forem: Ayoazeez26</title>
    <description>The latest articles on Forem by Ayoazeez26 (@ayoazeez26).</description>
    <link>https://forem.com/ayoazeez26</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%2F292250%2F3f888f8f-d225-4bea-9434-dd0b79d35fde.jpeg</url>
      <title>Forem: Ayoazeez26</title>
      <link>https://forem.com/ayoazeez26</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ayoazeez26"/>
    <language>en</language>
    <item>
      <title>Using vue-clickaway for your dropdowns</title>
      <dc:creator>Ayoazeez26</dc:creator>
      <pubDate>Thu, 05 Jan 2023 00:45:16 +0000</pubDate>
      <link>https://forem.com/ayoazeez26/using-vue-clickaway-for-your-dropdowns-3lkb</link>
      <guid>https://forem.com/ayoazeez26/using-vue-clickaway-for-your-dropdowns-3lkb</guid>
      <description>&lt;p&gt;Do you ever want to close a dropdown anytime the user clicks outside of it? vue-clickaway is a package that covers listening for clicks outside an element so you can perform actions when it happens. I will be taking you on the easy installation process and how to use it within your components.&lt;/p&gt;

&lt;h2&gt;
  
  
  PREREQUISITE
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Knowledge of &lt;a href="https://vuejs.org/guide/quick-start.html"&gt;Vue&lt;/a&gt; or &lt;a href="https://nuxtjs.org/docs/get-started/installation"&gt;Nuxt&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install &lt;a href="https://www.npmjs.com/package/vue-clickaway"&gt;vue-clickaway&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click &lt;a href="https://www.npmjs.com/package/vue-clickaway"&gt;here&lt;/a&gt; to install the package via npm or yarn. After installing, the recommended way of usage is to import clickaway into the component you intend to use it as a mixin like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import { mixin as clickaway } from 'vue-clickaway';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The next step is to call the mixin inside your&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export default&lt;/code&gt; like this &lt;code&gt;mixins: [ clickaway ]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After that, you call the method you want to trigger on clickaway in your template on your dropdown parent element.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;v-on-clickaway="away"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Final step is to create the &lt;code&gt;away&lt;/code&gt; function and watch the magic happen. Let's go ahead to demonstrate an example for you so you can understand how it works, if you don't already.&lt;/p&gt;

&lt;p&gt;This example was built on a Nuxt.js project. The first thing I did after installing clickaway was to create it as a plugin so I would not have to import it and use it as a mixin on every component I intend to use it on&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="c1"&gt;// plugins/clickaway.js&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;mixin&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;clickaway&lt;/span&gt; &lt;span class="p"&gt;}&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;vue-clickaway&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Vue&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;vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="nx"&gt;Vue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mixin&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;mixins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;clickaway&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 add the clickaway file inside the plugins array in your nuxt.config.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="c1"&gt;// nuxt.config.js&lt;/span&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;~/plugins/clickaway&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;Now we can go ahead to call our method on the clickaway directive&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="c1"&gt;// components/Navbar.vue&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;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;data&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="na"&gt;showCityDrop&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;cityDrop&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;Monday&lt;/span&gt;&lt;span class="dl"&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;Tuesday&lt;/span&gt;&lt;span class="dl"&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;Wednesday&lt;/span&gt;&lt;span class="dl"&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;Thursday&lt;/span&gt;&lt;span class="dl"&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;Friday&lt;/span&gt;&lt;span class="dl"&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;Saturday&lt;/span&gt;&lt;span class="dl"&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;Sunday&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="na"&gt;methods&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;closeCityDrop&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;showCityDrop&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&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;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;showCityDrop&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;clickaway&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;closeCityDrop&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;item in cityDrop&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;index&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;item.to&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;drop flex items-start text-primary mb-4&lt;/span&gt;&lt;span class="dl"&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;item&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;/p&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="sr"&gt;/div&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="sr"&gt;/template&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 that's all you need to do to use clickaway to close your dropdown when the user clicks outside of it. It has other use cases aside the use case demonstrated above. You can use vue clickaway whenever you need to listen outside of an element to perform actions.&lt;/p&gt;

&lt;p&gt;I hope you find this helpful&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>vue</category>
      <category>newbie</category>
    </item>
    <item>
      <title>What are topics a Junior Vue Developer can write about</title>
      <dc:creator>Ayoazeez26</dc:creator>
      <pubDate>Sun, 13 Nov 2022 01:25:54 +0000</pubDate>
      <link>https://forem.com/ayoazeez26/what-are-topics-a-junior-vue-developer-can-write-about-2ogj</link>
      <guid>https://forem.com/ayoazeez26/what-are-topics-a-junior-vue-developer-can-write-about-2ogj</guid>
      <description>&lt;p&gt;This is a question I have been pondering on subconsciously for a while now. I would love topic suggestions on what I could write about as a Junior Vuejs developer with over 2 years experience writing Vue. I have a goal of increasing the rate at which I write articles and this would help a lot. Thanks&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>vue</category>
      <category>javascript</category>
      <category>discuss</category>
    </item>
    <item>
      <title>I used the SPREAD OPERATOR for the first time 🤯🤯</title>
      <dc:creator>Ayoazeez26</dc:creator>
      <pubDate>Wed, 19 May 2021 13:30:00 +0000</pubDate>
      <link>https://forem.com/ayoazeez26/i-used-the-spread-operator-for-the-first-time-2hjj</link>
      <guid>https://forem.com/ayoazeez26/i-used-the-spread-operator-for-the-first-time-2hjj</guid>
      <description>&lt;h2&gt;
  
  
  What is a spread operator?
&lt;/h2&gt;

&lt;p&gt;The spread operator is used when all elements of an iterable variable such as an object or an array needs to be included in some sort of a list. This has a lot of use cases, below is a basic description of what using the spread operator looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F588fa9wcepzy62w4afrb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F588fa9wcepzy62w4afrb.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was recently consuming API endpoints and I came across an endpoint whose response is an array of arrays and each array item contains several objects which I needed to get. First instance was to do a forEach() to loop through each arrays. Then I proceeded to do another forEach() to get to the individual objects of each of the arrays. All was going fine until I decided to render those items to the DOM and it turns out only the last array of objects was getting rendered. This was a point of confusion because everything seems to be working fine. After a lot of trying to figure things out, I decided to use a spread operator after the first forEach loop to push each item in each of the arrays to an empty array. This makes it that all objects are in a single array&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbyhnkgvbz23tr1rej60j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbyhnkgvbz23tr1rej60j.png" alt="spread in action"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Centering content in the middle of a page</title>
      <dc:creator>Ayoazeez26</dc:creator>
      <pubDate>Tue, 30 Mar 2021 23:22:37 +0000</pubDate>
      <link>https://forem.com/ayoazeez26/centering-content-in-the-middle-of-a-page-3ob</link>
      <guid>https://forem.com/ayoazeez26/centering-content-in-the-middle-of-a-page-3ob</guid>
      <description>&lt;p&gt;Have you ever needed to center an element to the middle of a page? I would proceed to explain the simple way you can achieve that :)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3cG8yqNI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fklsfow0di05bzyifxsp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3cG8yqNI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fklsfow0di05bzyifxsp.png" alt="Challenge Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The image above was gotten from a chellenge on &lt;a href="https://www.frontendmentor.io"&gt;Frontend Mentors&lt;/a&gt; where you sign up and take challenges and try to make your solution look as close to the design as possible.&lt;/p&gt;

&lt;p&gt;As you can see from the image above, the container of the whole content is centered in the page. This is what my solution currently looks like&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zua-3V6W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8yav15zfn56mb655fwzw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zua-3V6W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8yav15zfn56mb655fwzw.png" alt="Unfinished Solution"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, it's perfect with the exception of the container being in the center of the page. We will proceed to make it centered now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nTgfq6Rv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12nfw64ewpqejzjccghb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nTgfq6Rv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12nfw64ewpqejzjccghb.png" alt="Absolute position styling to parent class"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Setting the position of the container to absolute takes it out of the flow of the document. Next thing to do is to set the top and left properties to 50% each.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pzUlzpoD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s1fqmcnldse3z9v4u3wz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pzUlzpoD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s1fqmcnldse3z9v4u3wz.png" alt="set top and left properties to 50%"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The reason we did that was to set the container to 50% from the top of the page and 50% from the left. Our container now looks like this &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZkmJ1gCl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cnxprofhe9hrl2rc459z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZkmJ1gCl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cnxprofhe9hrl2rc459z.png" alt="challenge after adding 50% to left and top"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;what actually happens here is that the origin of the container is its top left position, looking objectively at our solution would show you that the top left corner of our container is actually at the center of the page.&lt;/p&gt;

&lt;p&gt;To make our container body appear at the body instead of just the top-left corner, we add a final style property.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--28uVpQtC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vu3997e3c4q8xz4jd0mx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--28uVpQtC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vu3997e3c4q8xz4jd0mx.png" alt="Final code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What the transform translate property does is to move the container and in general, it acts relative to the body of the container so the (-50%,-50%) moves the container backwards half of it's width and height, so originally if we had our width set to 600px, -50% moves it backward 300px and same goes for the height.&lt;/p&gt;

&lt;p&gt;Our container should now look like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---X6I_O1k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/otme47vcnj43c75i2da8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---X6I_O1k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/otme47vcnj43c75i2da8.png" alt="Final challenge look"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, with just 4 style properties, we were able to style our container and center it on our page. I hope you have a better understanding of how centering an element works now.&lt;/p&gt;

&lt;p&gt;Here's a link to the &lt;a href="https://github.com/Ayoazeez26/bootstrap-grid-challenge"&gt;github repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>css</category>
    </item>
    <item>
      <title>My Cry for Help</title>
      <dc:creator>Ayoazeez26</dc:creator>
      <pubDate>Mon, 13 Jul 2020 12:38:01 +0000</pubDate>
      <link>https://forem.com/ayoazeez26/my-cry-for-help-4md4</link>
      <guid>https://forem.com/ayoazeez26/my-cry-for-help-4md4</guid>
      <description>&lt;p&gt;Hey guys, so I'm on Hackerrank and I decided to take on their 30 days of code challenge and lo and behold, I get stuck on day 1, so so frustrating. I decided to leave it for a while and came back to it after a few weeks but still with no positive results, so this is my cry for help for anyone willing to assist me in passing through day 1. Thank you in anticipation&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>100daysofcode</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>The CSS :not() Selector</title>
      <dc:creator>Ayoazeez26</dc:creator>
      <pubDate>Fri, 26 Jun 2020 07:05:42 +0000</pubDate>
      <link>https://forem.com/ayoazeez26/the-css-not-selector-4jaf</link>
      <guid>https://forem.com/ayoazeez26/the-css-not-selector-4jaf</guid>
      <description>&lt;p&gt;I stumbled upon this selector in CSS recently and I did a little reading on it and found its use cases very interesting so I decided to share it.&lt;/p&gt;

&lt;p&gt;The :not() CSS selector has a wide range of use cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases
&lt;/h2&gt;

&lt;p&gt;The general idea behind it's use case is to prevent certain items from being selected, hence it is known as the negation pseudo-class.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--44beiseA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5uvi4qpwdzp8mhbp898b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--44beiseA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5uvi4qpwdzp8mhbp898b.png" alt="An example of a :not() Selector"&gt;&lt;/a&gt;&lt;br&gt;
Using this saves you time and more lines of code, as in this case you would have had to give the remaining p tags a specific class name and apply the style to that class.&lt;/p&gt;

&lt;h2&gt;
  
  
  Linking :not() with other pseudo selectors
&lt;/h2&gt;

&lt;p&gt;This selector can also be used together with other pseudo-class and pseudo-element selectors. For example, the following will add a box shadow and a background color to all buttons that do not contain the plump class when they are being hovered on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y9WDerJj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hno9t6sqt63euzft7vq3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y9WDerJj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hno9t6sqt63euzft7vq3.png" alt="An example of a :not() Selector"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Using :not() globally
&lt;/h2&gt;

&lt;p&gt;You can also use the tag :not() selector globally in the sense that you are not applying it to an element so it selects all elements in the document except the ones specified in the brackets&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eyLcNEFE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2680ko99hbqfwrnv2ch3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eyLcNEFE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2680ko99hbqfwrnv2ch3.png" alt="An example of a :not() Selector"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The CSS style above styles the color of every element in the document except the buttons.&lt;br&gt;
Another example of the :not() Selector use case is this:&lt;/p&gt;

&lt;h2&gt;
  
  
  More Examples
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Q65y1ucH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ua9ljg07erb7s0ps2kub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q65y1ucH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ua9ljg07erb7s0ps2kub.png" alt="An example of a :not() Selector"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above example will style all input text fields that are not disabled.&lt;br&gt;
I hope you understand the basics and the general idea behind this awesome CSS Selector.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources for more insights
&lt;/h2&gt;

&lt;p&gt;For further insights on the :not() Selector, I would recommend you check:&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:not"&gt;https://developer.mozilla.org/en-US/docs/Web/CSS/:not&lt;/a&gt;&lt;br&gt;
&lt;a href="https://tympanus.net/codrops/css_reference/not/"&gt;https://tympanus.net/codrops/css_reference/not/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>100daysofcode</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
