<?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: Ibrahim Ibrahim</title>
    <description>The latest articles on DEV Community by Ibrahim Ibrahim (@devwraithe).</description>
    <link>https://dev.to/devwraithe</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%2F783594%2F84ee6be6-1ab3-41ee-a2c3-b2d9a9a86346.png</url>
      <title>DEV Community: Ibrahim Ibrahim</title>
      <link>https://dev.to/devwraithe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devwraithe"/>
    <language>en</language>
    <item>
      <title>Bidirectional Centering with CSS</title>
      <dc:creator>Ibrahim Ibrahim</dc:creator>
      <pubDate>Thu, 03 Feb 2022 11:40:38 +0000</pubDate>
      <link>https://dev.to/devwraithe/bidirectional-centering-with-css-78g</link>
      <guid>https://dev.to/devwraithe/bidirectional-centering-with-css-78g</guid>
      <description>&lt;p&gt;Sometimes, you may want to have your elements centered vertically and horizontally on the webpage (hence bidirectional). In this guide, we’ll look at two simple CSS techniques you can use to do this. These CSS techniques are the position and flexbox.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;To understand the content of this guide, you need to have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A code editor (I’m using Visual Studio Code)&lt;/li&gt;
&lt;li&gt;Basic knowledge of HTML and CSS (especially position and flexbox)&lt;/li&gt;
&lt;li&gt;A web browser (I’m using Google Chrome)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Using the Position Technique
&lt;/h2&gt;

&lt;p&gt;We can place our child elements anywhere within the parent element using the position property (and the transform property) for bidirectional centering. When the parent element has the position: relative, the direct child becomes limited to its dimensions, i.e. its width and height. Let’s have a look at how it’s done:&lt;/p&gt;

&lt;p&gt;HTML Markup:&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;"container"&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;"element"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Element to be centered!&lt;span class="nt"&gt;&amp;lt;/div&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;p&gt;CSS Stylesheet:&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;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.element&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&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;left&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;translate&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="m"&gt;-50%&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;The position: absolute; property applied to the .element {} enables the .element to be placeable anywhere within the .container.&lt;br&gt;
The top: 50% and left: 50% moves the .element to the absolute center vertically and horizontally and the transform: translate(-50%, -50%) corrects them to be in the perfect center.&lt;br&gt;
The height: 100vh; controls the parent element's height i.e. the .container that we will center the child element in.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LfPxusNU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aasnnnmk7waj104yg3f8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LfPxusNU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aasnnnmk7waj104yg3f8.png" alt="Output of the code above" width="880" height="416"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Using the Flexbox Technique
&lt;/h2&gt;

&lt;p&gt;Using CSS Flexbox for bidirectional centering, you can control the placement of elements within other elements. When the display: flex property is applied to the parent element, the direct children becomes flex items, and so you can add alignment properties to control those children (flex items). Let’s take a look at how this works:&lt;/p&gt;

&lt;p&gt;HTML Markup:&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;"container"&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;"element"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Element to be centered!&lt;span class="nt"&gt;&amp;lt;/div&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;p&gt;CSS Stylesheet:&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;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;align-items&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;justify-content&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;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&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;The align-items: center; property applied to the .container vertically centers the child element while the justify-content: center; makes it horizontally centered. On certain occasions, the align-items: center; may seem ineffective. This could be because your parent element does not have a height property. In this guide, we’ll include a height: 100vh; within the .container {} for the align-items: center; to be effective.&lt;/p&gt;

&lt;p&gt;Maintainability, flexibility and ease of use are some of the key advantages of this technique over the position technique.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AqWHb08o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/albxclmobgs2wz9o0h0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AqWHb08o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/albxclmobgs2wz9o0h0y.png" alt="Output of the code above" width="880" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Bidirectional centering is an essential part of frontend development, and as we have learnt in this article, they’re effortless to handle if you understand how they work. The two standard techniques to implement bidirectional centering in CSS are the position and flexbox properties covered in this article.&lt;/p&gt;

&lt;p&gt;Suppose you have any questions or comments concerning this article. In that case, you can drop them in the comments section, and if you have other frontend related topics, do not hesitate to reach out to me via &lt;a href="https://www.twitter.com/devwraithe"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/ibrahimaibrahim"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Introduction to Mixins in Sass</title>
      <dc:creator>Ibrahim Ibrahim</dc:creator>
      <pubDate>Tue, 25 Jan 2022 15:15:51 +0000</pubDate>
      <link>https://dev.to/devwraithe/introduction-to-mixins-in-sass-2h2j</link>
      <guid>https://dev.to/devwraithe/introduction-to-mixins-in-sass-2h2j</guid>
      <description>&lt;p&gt;Sass is a CSS preprocessor and whether using it as SCSS or Sass itself, it’s incredible. It lets us do more with CSS and makes complex CSS tasks easy. Mixins in Sass are exceptional and valuable to speed up development. This article will introduce you to how Sass Mixins work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Sass Mixins?
&lt;/h2&gt;

&lt;p&gt;According to the official Sass website, “Mixins allow you to define styles that you can reuse throughout your stylesheet”. In other words, Mixins are reusable blocks of code that you can write your CSS styles in and use throughout your entire stylesheet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of using Sass Mixins
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;They prevent the repetition of code&lt;/li&gt;
&lt;li&gt;They make the stylesheet less crowded&lt;/li&gt;
&lt;li&gt;They help reduce the size of the stylesheet file&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating a Mixin
&lt;/h2&gt;

&lt;p&gt;Creating a mixin is straightforward. All you have to do is use the &lt;code&gt;@mixin&lt;/code&gt; directive followed by the name of the mixin, then open and close curly braces. The &lt;code&gt;@mixin&lt;/code&gt; syntax is shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="c1"&gt;// css goes here…&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is an example code to get a better understanding of how it works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;red-text&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="no"&gt;red&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;25px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&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;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;red&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;The red-text style can be added anywhere in the stylesheet by using the &lt;code&gt;@include&lt;/code&gt; directive to call the &lt;code&gt;@mixin&lt;/code&gt; defined above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using a Mixin
&lt;/h2&gt;

&lt;p&gt;Now that you’ve declared your mixin, it’s time for you to learn how you can use them in your SCSS stylesheet. To use a mixin, you simply need to use the &lt;code&gt;@include&lt;/code&gt; directive followed by the mixin's name and a semicolon. The &lt;code&gt;@include&lt;/code&gt; syntax is shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nt"&gt;selector&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;mixin-name&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 here is how you will use the mixin defined in the previous section within your selector. Let’s say we have a .text class that we want to style:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nc"&gt;.text&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;letter-spacing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;red-text&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;The CSS transpiler will then convert the above code to the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nc"&gt;.text&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;letter-spacing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&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="no"&gt;red&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;25px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&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;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;red&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;You can also have multiple mixins within a selector:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nt"&gt;selector&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;mixin-a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;mixin-b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;mixin-c&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;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Sass Mixins are simple and powerful. They can help you build faster without repeating yourself and help keep your stylesheet simple. To work with the basics of SCSS Mixins, all you need to understand are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;@mixin&lt;/code&gt; directive for creating the mixins.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;@include&lt;/code&gt; directive for using the created mixins.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have any questions concerning this article or other frontend related topics, do not hesitate to contact me either on &lt;a href="https://www.twitter/devwraithe"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/ibrahimaibrahim"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>sass</category>
    </item>
    <item>
      <title>Opening a link in a new browser tab with HTML</title>
      <dc:creator>Ibrahim Ibrahim</dc:creator>
      <pubDate>Sat, 15 Jan 2022 00:59:11 +0000</pubDate>
      <link>https://dev.to/devwraithe/opening-a-link-in-a-new-browser-tab-using-html-7gh</link>
      <guid>https://dev.to/devwraithe/opening-a-link-in-a-new-browser-tab-using-html-7gh</guid>
      <description>&lt;p&gt;Have you ever clicked a link on a website, and it’s opened on a new tab in the browser? If you’ve been wondering how you can do that with your links, this article will act as your guide.&lt;/p&gt;

&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;p&gt;To follow and completely understand this guide, you will need to have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A web browser (I’m using &lt;strong&gt;Google Chrome&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Basic understanding of HTML tags and attributes.&lt;/li&gt;
&lt;li&gt;A text editor (I'm using &lt;strong&gt;Visual Studio Code&lt;/strong&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;h3&gt;
  
  
  What is the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag?
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag (also known as the anchor element or the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; element) is an HTML tag that defines a hyperlink, which is used to point from one webpage to another. The anchor element has several attributes, but we will focus specifically on the href and target attributes in this article and a little of the rel attribute.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are attributes?
&lt;/h3&gt;

&lt;p&gt;Attributes in HTML are special words used inside the opening tag of an element to control the element's behavior. HTML attributes are a modifier of an HTML element type.&lt;/p&gt;

&lt;h3&gt;
  
  
  What do the href and target attributes do?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;href&lt;/strong&gt; - Specifies the URL of the page the link goes to&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;target&lt;/strong&gt; - Specifies where to open the linked document&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Using the “href” attribute
&lt;/h2&gt;

&lt;p&gt;The href attribute specifies the URL of the page the link goes to when it’s clicked. Below is an example of how to use the href attribute within the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; element:&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;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://www.dev.to/devwraithe"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;My profile&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code consists of the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; element which specifies the element as a hyperlink, the href attribute, which wraps the URL to point to and the line of text between the opening and closing tags which is the clickable link of the hyperlink.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Page 1:
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kym279Sq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/io8619u9ylc0xrjpt4k2.png" alt="Page One - Links open in the current tab" width="880" height="469"&gt;
&lt;/li&gt;
&lt;li&gt;Page 2, opened in the &lt;strong&gt;current tab&lt;/strong&gt;:
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fTcQwGFs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7i1x9boinuveutlp4u7d.png" alt="Page Two - Links open in the current tab" width="880" height="469"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Using the “target” attribute
&lt;/h2&gt;

&lt;p&gt;The target attribute specifies where to open the linked document. If the link is clicked while the target attribute is present, the value of the target attribute will instruct the browser on where it will open the link.&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;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://www.dev.to/devwraithe"&lt;/span&gt; &lt;span class="na"&gt;target=&lt;/span&gt;&lt;span class="s"&gt;"_blank"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;My Profile&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The target attribute and the value “_blank” included in the &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; element above basically states that “when this link is clicked, open the URL in a new tab”. However, this attribute has some drawbacks, but we’ll discuss how you can prevent these drawbacks in the next section.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Page 1:
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Csb_VNof--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4ds1nmtiztu7ntx5z9y.png" alt="Page One - Links open in a new tab" width="880" height="469"&gt;
&lt;/li&gt;
&lt;li&gt;Page 2, opened in a &lt;strong&gt;new tab&lt;/strong&gt;:
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gzXsWZdK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9rhezt93umhk0bigl6xs.png" alt="Page Two - Links open in a new tab" width="880" height="469"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Security concerns and the target=”_blank” attribute
&lt;/h2&gt;

&lt;p&gt;It is recommended that whenever the target="blank" attribute is present in an anchor element, you should include the rel="noopener noreferrer" attribute to prevent a type of phishing known as &lt;a href="https://medium.com/@shatabda/security-tabnabbing-what-how-b038a70d300e"&gt;Tabnabbing&lt;/a&gt;. The rel attribute helps to specify the relationship between the current document and the linked document.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;It’s straightforward to use the HTML anchor element to open links in a new browser tab. As you have learnt in this article, all you need are three simple, easy-to-remember attributes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The href attribute sets the URL of the page you want to link to.&lt;/li&gt;
&lt;li&gt;The target attribute is set to “_blank” to tell the browser to open the link in a new tab (or window, depending on the browser settings).&lt;/li&gt;
&lt;li&gt;The rel attribute is set to “noreferrer noopener” to prevent malicious attacks from the pages you link to.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have any questions concerning this article or other frontend-related topics, do not hesitate to contact me either on &lt;a href="https://www.twitter.com/devwraithe"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/ibrahimaibrahim"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>html</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
