<?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: Aslam Shah</title>
    <description>The latest articles on Forem by Aslam Shah (@hunzaboy).</description>
    <link>https://forem.com/hunzaboy</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%2F18441%2Ffe186a8a-74e4-4772-a6ff-6c398d439e1b.jpg</url>
      <title>Forem: Aslam Shah</title>
      <link>https://forem.com/hunzaboy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/hunzaboy"/>
    <language>en</language>
    <item>
      <title>Inline if() in CSS 🤔: What You Need to Know About This Upcoming Feature</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Mon, 01 Jul 2024 15:32:30 +0000</pubDate>
      <link>https://forem.com/hunzaboy/inline-if-in-css-what-you-need-to-know-about-this-upcoming-feature-1cak</link>
      <guid>https://forem.com/hunzaboy/inline-if-in-css-what-you-need-to-know-about-this-upcoming-feature-1cak</guid>
      <description>&lt;p&gt;Last week, the CSS Working Group gathered in Spain, and there was some exciting news&lt;/p&gt;

&lt;p&gt;🥁&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;they agreed to add an inline &lt;code&gt;if()&lt;/code&gt; function to CSS&lt;/strong&gt;&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;This idea had been bouncing around for a while, but they finally managed to pin it down to an MVP that could be implemented quickly. After some friendly chats with implementers and putting out a solid proposal, they reached a consensus. It's a significant leap forward for &lt;strong&gt;CSS&lt;/strong&gt;, adding some nifty new tricks to the toolkit 🎉.&lt;/p&gt;

&lt;p&gt;Lets see how this will work ( &lt;a href="https://github.com/w3c/csswg-drafts/issues/10064" rel="noopener noreferrer"&gt;according to the proposal&lt;/a&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;.my-element&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="n"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="err"&gt;?&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--color-active-30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="err"&gt;?&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--color-error-30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c"&gt;/* Add other statuses here */&lt;/span&gt;
        &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--color-default-30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="err"&gt;?&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--color-active-95&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="err"&gt;?&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--color-error-95&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c"&gt;/* Add other statuses here */&lt;/span&gt;
        &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--color-default-95&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Based on the &lt;code&gt;--status&lt;/code&gt; variable, we can conditionally change the &lt;code&gt;css&lt;/code&gt; properties in a single line. &lt;/p&gt;

&lt;p&gt;You can also use it using pre defined variables.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;

&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="py"&gt;--xl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;1600px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="py"&gt;--l&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;1200px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="py"&gt;--m&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;800px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;/* usage */&lt;/span&gt;
&lt;span class="nt"&gt;border-width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;if&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="nt"&gt;var&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;--xl&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nt"&gt;var&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;--size-3&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="nt"&gt;var&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;--l&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nt"&gt;or&lt;/span&gt; &lt;span class="nt"&gt;var&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;--m&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nt"&gt;var&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;--size-2&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="nt"&gt;var&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;--size-1&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;);&lt;/span&gt;




&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Browser Support:
&lt;/h3&gt;

&lt;p&gt;Don’t get too excited just yet—it'll likely take at least 1-2 years for this to make its way into our browsers. So, while the future of CSS looks bright, we’ll need to be patient  😀! &lt;/p&gt;

&lt;p&gt;Stay tuned and follow me for the latest updates and tips on new web development features, so you'll be the first to know when the future of CSS and other web technologies lands in your browser!&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__18441"&gt;
    &lt;a href="/hunzaboy" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&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%2Fuser%2Fprofile_image%2F18441%2Ffe186a8a-74e4-4772-a6ff-6c398d439e1b.jpg" alt="hunzaboy image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hunzaboy"&gt;Aslam Shah&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hunzaboy"&gt;Creator of https://codedmails.com&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@camadams?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" rel="noopener noreferrer"&gt;Cam Adams&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/man-wearing-white-long-sleeved-shirt-on-air-photo-imBSxksI7DA?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>html</category>
      <category>frontend</category>
    </item>
    <item>
      <title>There is now a better way to use @font-face for variable fonts</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Fri, 14 Jul 2023 12:57:09 +0000</pubDate>
      <link>https://forem.com/hunzaboy/there-is-now-a-better-way-to-use-font-face-for-variable-fonts-1a5i</link>
      <guid>https://forem.com/hunzaboy/there-is-now-a-better-way-to-use-font-face-for-variable-fonts-1a5i</guid>
      <description>&lt;p&gt;When it comes to using variable fonts on the web, there's a newer way to do it.&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="k"&gt;@font-face&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Bitstream Vera Serif Bold"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;src&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url("BitstreamVeraSerifBold.woff2")&lt;/span&gt; &lt;span class="n"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;woff2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;tech&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;variations&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;Here is the old ( still working ) syntax:&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="k"&gt;@font-face&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Bitstream Vera Serif Bold"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;src&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url("BitstreamVeraSerifBold.woff2")&lt;/span&gt; &lt;span class="n"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;"woff2-variations"&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;When using variable fonts with &lt;code&gt;@font-face&lt;/code&gt;, it is important to note that the syntax has changed. Instead of using strings, the recommended approach now is to use keywords like &lt;code&gt;woff2&lt;/code&gt;, &lt;code&gt;opentype&lt;/code&gt;, &lt;code&gt;truetype&lt;/code&gt;, &lt;code&gt;woff&lt;/code&gt;, and others within the &lt;code&gt;format()&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;It is necessary to consider the font's capabilities such as variable font, color font etc. To determine if a browser supports these font technologies, one can utilize the &lt;code&gt;tech()&lt;/code&gt; function. By specifying &lt;code&gt;tech(variations)&lt;/code&gt;, it ensures that the font file will only be loaded if the browser supports variable fonts.&lt;/p&gt;

&lt;p&gt;However, it is worth noting that the new syntax is not yet widely supported. Therefore, it is generally advisable to stick with the old version for now. However, if targeting newer browsers specifically, it may be appropriate to consider updating to the new syntax.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face#browser_compatibility"&gt;You can read more about browser compatibility and font technologies here.&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__18441"&gt;
    &lt;a href="/hunzaboy" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aXYUNyxg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://res.cloudinary.com/practicaldev/image/fetch/s--0WqLRk0C--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/18441/fe186a8a-74e4-4772-a6ff-6c398d439e1b.jpg" alt="hunzaboy image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hunzaboy"&gt;Aslam Shah&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hunzaboy"&gt;Creator of https://codedmails.com&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>fonts</category>
      <category>html</category>
      <category>css</category>
    </item>
    <item>
      <title>Text Balance in CSS is coming 🔥</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Wed, 26 Apr 2023 07:19:45 +0000</pubDate>
      <link>https://forem.com/hunzaboy/text-balance-in-css-is-coming-17e3</link>
      <guid>https://forem.com/hunzaboy/text-balance-in-css-is-coming-17e3</guid>
      <description>&lt;p&gt;When it comes to designing a website or application, balancing the text is an essential aspect. It not only improves readability but also adds to the overall aesthetic of the content. CSS provides various properties to achieve this balance, one of which is the &lt;code&gt;text-wrap&lt;/code&gt; property with the value &lt;code&gt;balance&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The text-wrap property is used to control how the text is wrapped within its container. When the value of the &lt;code&gt;text-wrap&lt;/code&gt; property is set to &lt;code&gt;balance&lt;/code&gt;, it ensures that the text is distributed evenly across multiple lines within the container. This results in a well-balanced block of text, without any uneven gaps or breaks.&lt;/p&gt;

&lt;p&gt;Let's take a look at an example to better understand how the &lt;code&gt;text-wrap: balance&lt;/code&gt; property works.&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%2Fvwchji5spnr8zxr9c7e8.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%2Fvwchji5spnr8zxr9c7e8.png" alt="Text Balance"&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;h1&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"heading text-balance"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;This is a heading that will be balanced&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;This is a heading that wont be balanced&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Here, we have a heading. To apply the &lt;code&gt;text-wrap: balance&lt;/code&gt; property, we need to add the following CSS code.&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;.text-balance&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;text-wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;======&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f4f4f4&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 the above CSS code, we have set the width of the heading to 300 pixels, and added the &lt;code&gt;text-wrap: balance&lt;/code&gt; property to the  &lt;code&gt;text-balance&lt;/code&gt; class. This ensures that the headline is distributed evenly across multiple lines, without any uneven gaps or breaks.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's important to note that the &lt;code&gt;text-wrap: balance&lt;/code&gt; property is not supported in all browsers. However, it is supported in Chrome Canary.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://developer.chrome.com/blog/css-text-wrap-balance/" rel="noopener noreferrer"&gt;More information can be found here. &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to get updated on similar topics, don't forget to follow :) &lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__18441"&gt;
    &lt;a href="/hunzaboy" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&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%2Fuser%2Fprofile_image%2F18441%2Ffe186a8a-74e4-4772-a6ff-6c398d439e1b.jpg" alt="hunzaboy image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hunzaboy"&gt;Aslam Shah&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hunzaboy"&gt;Creator of https://codedmails.com&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>css</category>
      <category>webdev</category>
      <category>uidesign</category>
    </item>
    <item>
      <title>An extension for Google Meet Reaction UX?</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Tue, 11 Apr 2023 09:15:20 +0000</pubDate>
      <link>https://forem.com/hunzaboy/react-responsibly-why-i-created-a-extension-for-google-meet--3l0h</link>
      <guid>https://forem.com/hunzaboy/react-responsibly-why-i-created-a-extension-for-google-meet--3l0h</guid>
      <description>&lt;p&gt;If you use Google Meet for online meetings, you may have experienced the frustration of accidentally clicking on the "raise hand" button ✋ instead of the reaction button 😃. This can be embarrassing and disruptive, especially if you are in a large group or a formal setting.&lt;/p&gt;

&lt;p&gt;I was in the same situation a couple of times, so to fix that issue, I created a Chrome extension called "&lt;a href="https://chrome.google.com/webstore/detail/move-reaction-button/nafmbdjhongldkfaecnhjaanmmeeegii"&gt;Move Reaction Button&lt;/a&gt;"&lt;/p&gt;

&lt;p&gt;"Move Reaction Button" is a free and easy-to-use extension that changes the position of the reaction button in Google Meet. Instead of being next to the "raise hand" button, it moves it to the left corner of the buttons, and I also added a colored background to make it more visible. This way, you can express your emotions without unintentionally raising your hand.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There are no special permissions needed for the extension to access the content of your page.&lt;br&gt;
I hope this will be helpful for you.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Feel free to add suggestions in the comments.&lt;/p&gt;

</description>
      <category>googlemeet</category>
      <category>ux</category>
      <category>video</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Finally accent-color in CSS</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Wed, 05 Apr 2023 10:20:43 +0000</pubDate>
      <link>https://forem.com/hunzaboy/finally-accent-color-33l1</link>
      <guid>https://forem.com/hunzaboy/finally-accent-color-33l1</guid>
      <description>&lt;p&gt;If you're a web developer, you're likely familiar with the role of CSS in defining the visual style of a webpage. One key aspect of CSS is the use of color, and recently a new accent color property has been added to the CSS specification.&lt;/p&gt;

&lt;p&gt;The accent-color property is a new addition to CSS that allows you to specify a single color that can be used as an accent throughout your website. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Currently accent-color only works on Checkboxes, Radio Buttons, Range and Progress elements. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/hunzaboy/embed/QWZLVJJ?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;To use the accent-color property in your CSS, simply specify the desired color value using any valid CSS color syntax. Here's an example:&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="nt"&gt;input&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;accent-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#007bff&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;It's worth noting that the accent-color property is still relatively new, and surprisingly the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/accent-color#browser_compatibility"&gt; support is very good. &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More info can be found here: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/accent-color"&gt;https://developer.mozilla.org/en-US/docs/Web/CSS/accent-color&lt;/a&gt; &lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Theming Angular Material Components - Introduction</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Mon, 29 Aug 2022 15:06:00 +0000</pubDate>
      <link>https://forem.com/hunzaboy/theming-angular-material-components-introduction-4ab</link>
      <guid>https://forem.com/hunzaboy/theming-angular-material-components-introduction-4ab</guid>
      <description>&lt;p&gt;In this series, I will explain how to customize the Angular Material &lt;strong&gt;theme&lt;/strong&gt;, &lt;strong&gt;components&lt;/strong&gt; in particular ( that's usually the most irritating part ) and &lt;strong&gt;your own components&lt;/strong&gt; using the Angular Material Way 💅 . I hope this series will help, new developers or anyone who has struggled, to get a better understanding and perspective on the topic. &lt;/p&gt;

&lt;h2&gt;
  
  
  Why am I doing this series?
&lt;/h2&gt;

&lt;p&gt;I have been using Angular Material for a long time and every time I need to do some adjustments to the angular material components, in the past I usually end up ( mostly ) overriding CSS properties in stylesheets instead of customizing the sass variables and generating the component design using the sass mixins available to us ( which I have stopped doing a while ago 😉 ) to have a more &lt;em&gt;systematic&lt;/em&gt;, &lt;em&gt;recommended&lt;/em&gt; and &lt;em&gt;scalable&lt;/em&gt; way.&lt;/p&gt;

&lt;p&gt;Here is a simple example you might relate to: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9ixxqEYJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/koyzt7q98u64aptwp4vw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9ixxqEYJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/koyzt7q98u64aptwp4vw.png" alt="Angular Material Paginator Component" width="800" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us say we want to increase the font size of the &lt;code&gt;mat-paginator&lt;/code&gt; &lt;a href="https://material.angular.io/components/paginator/overview"&gt;component&lt;/a&gt;, as seen by the red border in the picture above,  we have in my opinion 2 ways to increase the font size. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;a. Directly changing the css property for the specific element:&lt;/strong&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;.mat-paginator&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;30px&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;/* you might need to add !Important /*
/* depending on where you add this css or the ViewEncapsulation method you use.*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;b. Updating the Sass Map provided by Angular Material:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the long ( &lt;del&gt;correct&lt;/del&gt; better ) way where you define a typography variable called &lt;code&gt;$caption&lt;/code&gt; and then pass it to the &lt;code&gt;angular-material-typography&lt;/code&gt;, as this variable is used by the components in &lt;a href="https://github.com/angular/components/blob/2f9a59a24c0464cbed7f54cbeb5cba73e6007715/src/material/paginator/_paginator-theme.scss#L50"&gt;its sass definitions&lt;/a&gt;, also along the process initiating the &lt;code&gt;mat-core()&lt;/code&gt; mixing, using the correct variables defined in the &lt;a href="https://sass-lang.com/documentation/values/maps"&gt;sass-map&lt;/a&gt; and lastly passing everything to the &lt;code&gt;mat-light or mat-dark&lt;/code&gt; theme mixin &lt;em&gt;(ignore the order of the steps at the moment)&lt;/em&gt;. This process already seems to be a little complicated just to change the &lt;code&gt;font-size&lt;/code&gt; but once you understand the process, the rest becomes very easy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sass"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* not complete example, we will visit it example in full detail in the series later */
&lt;/span&gt;&lt;span class="nc"&gt;...&lt;/span&gt;

&lt;span class="nv"&gt;$custom-theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;mat-typography-config&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nv"&gt;$caption&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;mat-typography-level&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;14px&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;16px&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;angular-material-typography&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$custom-theme&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;....&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As much as it's easier to do it the first way, it is not recommended to directly change these values as you will end up with a lot of hacks to make the design customizations you want. And if you are going to use other material components ( which you will indeed end up doing ), it will be difficult for new and other team members to understand it if you have a decent codebase. &lt;/p&gt;

&lt;p&gt;Also, the current &lt;a href="https://material.angular.io/guide/theming"&gt;guidelines available on the Angular Material website&lt;/a&gt; are not clear enough or detailed enough and most of the StackOverflow posts use a dirty hack to fix the design using &lt;code&gt;!important&lt;/code&gt; &lt;a href="https://stackoverflow.com/questions/53684763/how-to-remove-space-bottom-mat-form-field"&gt;most of the time&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;So if someone is starting a project then I would recommend doing it in a way that it is scalable and easy to maintain aka the &lt;strong&gt;&lt;em&gt;Angular Way&lt;/em&gt;&lt;/strong&gt; 😌. &lt;/p&gt;

&lt;p&gt;Follow for upcoming articles in this series. And so comment if you have struggled with Angular Material components and share the challenged you have faced. &lt;/p&gt;

&lt;p&gt;See you in the next article.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>angularmaterial</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>🔥 What does the css parent selector :has in for us?</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Wed, 06 Jul 2022 13:37:23 +0000</pubDate>
      <link>https://forem.com/hunzaboy/what-does-the-css-parent-selector-has-in-for-us-ico</link>
      <guid>https://forem.com/hunzaboy/what-does-the-css-parent-selector-has-in-for-us-ico</guid>
      <description>&lt;p&gt;&lt;code&gt;:has&lt;/code&gt; is a parent selector pseudo-class*. It lets you change the parent element properties if it has (&lt;code&gt;:has&lt;/code&gt;) a specific child or a specific element following it. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s). For example, &lt;code&gt;:hover&lt;/code&gt; can be used to change a button's color when the user's pointer hovers over it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is a simple example of &lt;code&gt;:has&lt;/code&gt; pseudo-class:&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;.parent&lt;/span&gt;&lt;span class="nd"&gt;:has&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;.child&lt;/span&gt;&lt;span class="o"&gt;)&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;blue&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 this means is that if the &lt;code&gt;.parent&lt;/code&gt; element contains &lt;code&gt;.child&lt;/code&gt; element, then change the text color of the parent element to blue. This was not possible to implement with &lt;code&gt;css&lt;/code&gt; before. But thanks to &lt;code&gt;:has&lt;/code&gt; selector, now we can add this logic directly in &lt;code&gt;css&lt;/code&gt; and modify &lt;code&gt;.parent&lt;/code&gt; based on what it &lt;code&gt;:has&lt;/code&gt; as a child.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;At the time of writing this article &lt;code&gt;:has&lt;/code&gt; pseudo-class only works in Safari 15.4 and in Chrome Canary. &lt;a href="https://caniuse.com/css-has" rel="noopener noreferrer"&gt;Can i use&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;I am using a screenshot here so that you don't have to open the codepen in compatible browsers ;) &lt;/p&gt;
&lt;h4&gt;
  
  
  Empty Button vs Button with an SVG
&lt;/h4&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%2F5b74due2rn1i7uykel6l.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%2F5b74due2rn1i7uykel6l.png" alt="Screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instead of having 2 variations of buttons with or without an icon, you can simply use the &lt;code&gt;:has&lt;/code&gt; attribute on the parent.&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="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:has&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;svg&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#bd3c91&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;There is lot more to &lt;code&gt;:has&lt;/code&gt; selector. If you are interested in more usecases, let me know in the comments and i will add more practical usecases. &lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__18441"&gt;
    &lt;a href="/hunzaboy" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&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%2Fuser%2Fprofile_image%2F18441%2Ffe186a8a-74e4-4772-a6ff-6c398d439e1b.jpg" alt="hunzaboy image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hunzaboy"&gt;Aslam Shah&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hunzaboy"&gt;Creator of https://codedmails.com&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why 🗜️ 👈 is the one of the most powerful css function?</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Sat, 16 Apr 2022 20:26:45 +0000</pubDate>
      <link>https://forem.com/hunzaboy/why-is-the-one-of-the-most-powerful-css-function-5ek2</link>
      <guid>https://forem.com/hunzaboy/why-is-the-one-of-the-most-powerful-css-function-5ek2</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Fun fact: 🗜️ is the emoji for clamp according to &lt;a href="https://emojipedia.org/clamp/"&gt;emojipedia&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Lets talk about css &lt;code&gt;clamp()&lt;/code&gt; function.
&lt;/h2&gt;

&lt;p&gt;If you have ever wondered how you can define range to a css property e.g minimum, preferred or/and maximum value, then &lt;code&gt;clamp&lt;/code&gt; is the go to function.&lt;/p&gt;

&lt;p&gt;Here is how you can use. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;clamp(MIN,PREF,MAX)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You give a minimum value, a preferred value and a maximum value. &lt;/p&gt;

&lt;p&gt;One of the most common use of &lt;code&gt;clamp()&lt;/code&gt; is in creating fluid/responsive typography. Your &lt;code&gt;font-size&lt;/code&gt; will change based on the viewport size &lt;strong&gt;without writing any additional media queries&lt;/strong&gt;. You can give a minimum/maximum &lt;code&gt;font-size&lt;/code&gt; but everything in-between will be fluid if you use viewport units like &lt;code&gt;vw&lt;/code&gt; or &lt;code&gt;vh&lt;/code&gt;;&lt;/p&gt;

&lt;p&gt;Here an example ( try to resize the result tab )&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/hunzaboy/embed/BaJGPpv?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;You can use clamp function for lengths, percentages, angles etc. You can read about it more &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/clamp"&gt;here&lt;/a&gt;.&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__18441"&gt;
    &lt;a href="/hunzaboy" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aXYUNyxg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://res.cloudinary.com/practicaldev/image/fetch/s--0WqLRk0C--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/18441/fe186a8a-74e4-4772-a6ff-6c398d439e1b.jpg" alt="hunzaboy image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hunzaboy"&gt;Aslam Shah&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hunzaboy"&gt;Creator of https://codedmails.com&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>css</category>
      <category>html</category>
    </item>
    <item>
      <title>How to reset an elements inherited properties using css?</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Wed, 06 Apr 2022 09:26:31 +0000</pubDate>
      <link>https://forem.com/hunzaboy/how-to-reset-an-elements-inherited-properties-using-css-59c1</link>
      <guid>https://forem.com/hunzaboy/how-to-reset-an-elements-inherited-properties-using-css-59c1</guid>
      <description>&lt;p&gt;If an element is inheriting alot of css properties you can reset all properties to their unset state at once using &lt;code&gt;all: unset&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;This can come handy if your element is inheriting alot of properties due to css frameworks, custom css or any third party css imports.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/hunzaboy/embed/BaJYGZr?height=600&amp;amp;default-tab=html,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;According to MDN:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;all&lt;/code&gt; shorthand CSS property resets all of an element's properties except unicode-bidi, direction, and CSS Custom Properties. It can set properties to their initial or inherited values, or to the values specified in another cascade layer or stylesheet origin.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can read more about &lt;code&gt;all&lt;/code&gt; property &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/all" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__18441"&gt;
    &lt;a href="/hunzaboy" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&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%2Fuser%2Fprofile_image%2F18441%2Ffe186a8a-74e4-4772-a6ff-6c398d439e1b.jpg" alt="hunzaboy image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hunzaboy"&gt;Aslam Shah&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hunzaboy"&gt;Creator of https://codedmails.com&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why z-index doesn't work all the time 🤯 ?</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Thu, 31 Mar 2022 12:23:00 +0000</pubDate>
      <link>https://forem.com/hunzaboy/why-z-index-doesnt-work-all-the-time--5dko</link>
      <guid>https://forem.com/hunzaboy/why-z-index-doesnt-work-all-the-time--5dko</guid>
      <description>&lt;p&gt;&lt;em&gt;If you have struggled with &lt;code&gt;z-index&lt;/code&gt; you are not alone.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;Look at the code snippet below:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/hunzaboy/embed/jOYGNqX?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The circle &lt;code&gt;div&lt;/code&gt; has a &lt;code&gt;z-index&lt;/code&gt; of &lt;code&gt;99999&lt;/code&gt; but it is still showing under the header which has a &lt;code&gt;z-index&lt;/code&gt; of &lt;code&gt;2&lt;/code&gt;. why is this happening? Should &lt;code&gt;circle&lt;/code&gt; be on top as it has the highest &lt;code&gt;z-index&lt;/code&gt;? &lt;/p&gt;

&lt;p&gt;&lt;code&gt;z-index&lt;/code&gt; doesn't simply place element on top of lower &lt;code&gt;z-index&lt;/code&gt; or no &lt;code&gt;z-index&lt;/code&gt; items. There is a logic to it. If you understand this logic, then next time when you add a z-index property, you will know where to put it and why.&lt;/p&gt;

&lt;p&gt;Lets dig into it:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;z-index&lt;/code&gt; is based on the stacking context of the HTML elements. Stacking context simply means how the elements are stacked in the HTML tree whether the elements are in same stacking context or not e.g in the code snippet above the stacking context of &lt;code&gt;header&lt;/code&gt; and &lt;code&gt;main&lt;/code&gt; is different than &lt;code&gt;circle&lt;/code&gt;. We can create new stacking context as soon as we add z-index properties to the elements. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There are also many other ways of creating stacking context. If you want to dig deeper you can read about it &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;if we add z-index to header element then it will create a new stacking context comparing &lt;code&gt;main&lt;/code&gt; and &lt;code&gt;header&lt;/code&gt;. The circle z-index will have no effect as it has its own stacking context inside the &lt;code&gt;main&lt;/code&gt; element's context. But if we create a z-index on the circle &lt;code&gt;div&lt;/code&gt; then the context will be between it siblings ( if any ). &lt;/p&gt;

&lt;p&gt;In order to solve the problem, all we need to do is remove the z-index from the main which will remove the new stacking context. Now it will simply be &lt;code&gt;header&lt;/code&gt; and then &lt;code&gt;circle&lt;/code&gt; in terms of stacking context. &lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/hunzaboy/embed/LYezEYa?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Related Links:&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context" rel="noopener noreferrer"&gt;Stacking Context&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Stacking_without_z-index" rel="noopener noreferrer"&gt;Stacking without z-index&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you enjoyed this article. Follow for more css tips and tricks. &lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__18441"&gt;
    &lt;a href="/hunzaboy" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&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%2Fuser%2Fprofile_image%2F18441%2Ffe186a8a-74e4-4772-a6ff-6c398d439e1b.jpg" alt="hunzaboy image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hunzaboy"&gt;Aslam Shah&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hunzaboy"&gt;Creator of https://codedmails.com&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>css</category>
      <category>html</category>
    </item>
    <item>
      <title>💡 Animate newly added HTML elements with CSS</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Tue, 01 Mar 2022 16:00:22 +0000</pubDate>
      <link>https://forem.com/hunzaboy/animate-newly-added-html-elements-with-css-1o21</link>
      <guid>https://forem.com/hunzaboy/animate-newly-added-html-elements-with-css-1o21</guid>
      <description>&lt;p&gt;We all have been in a situation where we need to animate newly added HTML elements. We tinker with timeouts, initial state or any other scripting logic to add/remove classes etc.&lt;/p&gt;

&lt;p&gt;If you want a simple solution, here is one for you. It only uses a single animation &lt;code&gt;keyframe&lt;/code&gt; to take care of the newly added elements. CSS Animations with take care of the default state based on the initial element styles.&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="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;animate&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also play with the properties using &lt;code&gt;css&lt;/code&gt; transforms to achieve the animation you need. &lt;/p&gt;

&lt;p&gt;In the example below you have 2 versions.&lt;br&gt;
Normal Item which uses &lt;code&gt;opacity&lt;/code&gt; to create a fadeIn effect while the Fancy Item also has some &lt;code&gt;transform&lt;/code&gt; properties attached to it. &lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/hunzaboy/embed/QWOJvzM?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Enjoy! :) &lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>animation</category>
    </item>
    <item>
      <title>A css tip to remember</title>
      <dc:creator>Aslam Shah</dc:creator>
      <pubDate>Mon, 17 Jan 2022 14:47:48 +0000</pubDate>
      <link>https://forem.com/hunzaboy/a-css-tip-to-remember-4h50</link>
      <guid>https://forem.com/hunzaboy/a-css-tip-to-remember-4h50</guid>
      <description>&lt;p&gt;Hey everyone! 👋&lt;/p&gt;

&lt;p&gt;Here is a quick tip you might find helpful while writing &lt;code&gt;css&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;You might be surprised how &lt;code&gt;css&lt;/code&gt; can confuse you doing something very simple as positioning an element. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;The order by which you use the properties for a css &lt;code&gt;transform&lt;/code&gt; property can give you different results.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;e.g Using a &lt;code&gt;translate&lt;/code&gt; and &lt;code&gt;rotate&lt;/code&gt; in a &lt;code&gt;transform&lt;/code&gt; property together might give you different results based on what order you use them.&lt;/p&gt;

&lt;p&gt;Checkout the codepen below:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/hunzaboy/embed/rNGRvJJ?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Enjoy :) &lt;/p&gt;

&lt;p&gt;Cover photo by &lt;a href="https://unsplash.com/@brucemars?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;bruce mars&lt;/a&gt; on &lt;a href="https://unsplash.com/?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>transform</category>
      <category>tips</category>
    </item>
  </channel>
</rss>
