<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ali Calimli]]></title><description><![CDATA[Ali Calimli]]></description><link>https://blog.alicalimli.com</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Nov 2026 19:55:30 GMT</lastBuildDate><atom:link href="https://blog.alicalimli.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[CSS clamp() for Fluid Typography Explained]]></title><description><![CDATA[Use CSS clamp() for fluid typography that scales smoothly without media queries. Learn the safer rem + vw pattern, cqi variant, and common gotchas.]]></description><link>https://blog.alicalimli.com/css-clamp-for-fluid-typography-explained</link><guid isPermaLink="true">https://blog.alicalimli.com/css-clamp-for-fluid-typography-explained</guid><category><![CDATA[CSS]]></category><category><![CDATA[HTML]]></category><category><![CDATA[webdev]]></category><category><![CDATA[webdevelopment]]></category><category><![CDATA[tips and tricks]]></category><category><![CDATA[Developer]]></category><dc:creator><![CDATA[Ali Calimli]]></dc:creator><pubDate>Wed, 19 Aug 2026 11:51:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/61fd31d88d15cb3e7ce61084/2aba7526-b7e2-4c30-9fb5-4f9b66e33494.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h6>Use CSS clamp() for fluid typography that scales smoothly without media queries. Learn the safer rem + vw pattern, cqi variant, and common gotchas.</h6>
<p>You can make text responsive without media queries by using <code>clamp()</code> for the font size.</p>
<pre><code class="language-css">font-size: clamp(24px, 10vw, 48px);
</code></pre>
<p>This gives the browser a minimum size, a fluid middle value, and a maximum size. The text scales smoothly instead of jumping at each breakpoint.</p>
<h2>Why media queries feel rough for type</h2>
<p>A text size scale that uses breakpoints may look like this:</p>
<pre><code class="language-css">h1 {
  font-size: 24px;
}

@media (min-width: 480px) {
  h1 {
    font-size: 32px;
  }
}

@media (min-width: 768px) {
  h1 {
    font-size: 40px;
  }
}

@media (min-width: 1200px) {
  h1 {
    font-size: 48px;
  }
}
</code></pre>
<p>This works, but the text jumps from one size to the next.</p>
<p>When you slowly change the browser width, the heading jumps at each breakpoint. It does not grow or shrink in a smooth way. You also have more CSS to care for, and each new breakpoint adds one more number that you may need to change later.</p>
<h2>How <code>clamp()</code> works</h2>
<p><code>clamp()</code> accepts three values:</p>
<pre><code class="language-css">font-size: clamp(MINIMUM, PREFERRED, MAXIMUM);
</code></pre>
<p>For <code>clamp(24px, 10vw, 48px)</code>, each value does a different job:</p>
<ul>
<li><p><code>24px</code> is the smallest size. The text cannot get smaller than this.</p>
</li>
<li><p><code>10vw</code> makes the text grow and shrink. One <code>vw</code> is 1% of the viewport width, so the value changes when the screen width changes.</p>
</li>
<li><p><code>48px</code> is the largest size. The text cannot get bigger than this.</p>
</li>
</ul>
<p>Between the smallest and largest sizes, the browser uses <code>10vw</code>. Below that range, it uses <code>24px</code>. Above it, the browser uses <code>48px</code>. One line replaces the media query block, and the text changes size in a smooth way.</p>
<img src="https://storage.webdevvisuals.com/thumbnails/css-fluid-typography-444be.png%22" alt="" style="display:block;margin:0 auto" />

<iframe style="display:block;width:100%;height:500px;margin:2rem 0;border:0;border-radius:1rem"></iframe>

<p>One detail matters here. <code>10vw</code> reaches <code>24px</code> when the viewport is <code>240px</code> wide. It reaches <code>48px</code> when the viewport is <code>480px</code> wide. On wider screens, the heading stays at its largest size. This works well when the text should grow only on small screens. If the heading should keep growing on tablets and desktops, use a smaller middle value.</p>
<h2>A safer middle value: <code>rem + vw</code></h2>
<p>Using only viewport units can make text harder to read. These units do not follow the reader's browser text size. If someone increases their default text size, a middle value that only uses <code>vw</code> can work against that choice.</p>
<p>Mix <code>rem</code> into the middle value instead:</p>
<pre><code class="language-css">font-size: clamp(1rem, 0.5rem + 2vw, 1.5rem);
</code></pre>
<p>The <code>rem</code> part follows the main text size, while <code>2vw</code> makes the text grow with the screen. This is usually a better production choice than a middle value that only uses viewport units.</p>
<p>Test it at 200% zoom too. Even a good formula can make text wrap in a bad place inside a small card, or it can push nearby buttons off the screen.</p>
<h2>How to tell when <code>clamp()</code> stops scaling</h2>
<p>To see where a value stops being fluid, set the middle value equal to the minimum and maximum.</p>
<ul>
<li><p><code>10vw = 24px</code> means the scaling starts at <code>240px</code>.</p>
</li>
<li><p><code>10vw = 48px</code> means the scaling stops at <code>480px</code>.</p>
</li>
</ul>
<p>That quick check helps you choose a better middle value. If the value reaches its maximum too early on desktop, lower the <code>vw</code> part and add more <code>rem</code>.</p>
<h2>Scale against a container with <code>cqi</code></h2>
<p><code>clamp()</code> does not have to use the screen width. A unit such as <code>cqi</code> lets a value use the width of its parent box:</p>
<pre><code class="language-css">.card {
  container-type: inline-size;
}

.card h2 {
  font-size: clamp(1rem, 0.5rem + 4cqi, 2rem);
}
</code></pre>
<p>Here, <code>1cqi</code> is 1% of the card's width. The heading now changes with the card instead of the screen. The same card can sit in a small side area or a wide top area without a new class. This is one of the cleanest upgrades once a value really belongs to a component instead of the full page.</p>
<h2>Notes</h2>
<p>If the smallest value is bigger than the largest value, the smallest value wins. The browser does not warn you, so check the numbers if a value seems stuck.</p>
<p>Most new browsers support <code>clamp()</code>. If you need to support an old browser, put a fixed value first:</p>
<pre><code class="language-css">h1 {
  font-size: 2rem;
  font-size: clamp(1.5rem, 1rem + 2.5vw, 3rem);
}
</code></pre>
<p>Browsers that do not know <code>clamp()</code> skip the second line and keep <code>2rem</code>.</p>
<p><code>clamp()</code> works with media queries. It does not replace them. Use it for values that should grow and shrink, such as text sizes, space, gaps, and widths.</p>
<h2>Related patterns</h2>
<p>For layouts rather than text, <a href="https://www.webdevvisuals.com/blog/css-responsive-grid-without-media-queries"><code>auto-fit</code> and <code>minmax()</code> can build a responsive CSS grid without media queries</a>.</p>
<p>If cards should wrap as rows instead of staying on grid tracks, <a href="https://www.webdevvisuals.com/blog/responsive-flexbox-cards-without-media-queries">responsive Flexbox cards use <code>flex-grow</code> and <code>flex-basis</code></a>.</p>
<p>If the problem is keeping media boxes in shape, <a href="https://www.webdevvisuals.com/blog/css-aspect-ratio-without-media-queries">CSS <code>aspect-ratio</code> handles responsive images and videos</a>.</p>
<p>For a single element that should shrink and stop growing, use <a href="https://www.webdevvisuals.com/blog/css-responsive-widths-without-media-queries"><code>width</code> with <code>max-width</code> for responsive CSS widths</a>.</p>
<p>You can also read the full guide to <a href="https://www.webdevvisuals.com/blog/responsive-css-without-media-queries">responsive CSS without media queries</a>.</p>
<p>You can browse more <a href="https://www.webdevvisuals.com/explore">frontend visuals and CSS examples</a>.</p>
<h2>Wrap-up</h2>
<p><code>clamp()</code> replaces many font-size breakpoint rules with one readable line. Use a <code>rem + vw</code> middle value, test at 200% zoom, and switch to <code>cqi</code> when the value should follow a container instead of the viewport.</p>
<p>You can browse more short frontend tips &amp; tricks on <a href="https://www.webdevvisuals.com">WebDevVisuals</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Windows 10 Setting Hover Effect: A Step By Step Tutorial]]></title><description><![CDATA[Learn how to create this windows 10 settings hover effect that you can use in your website with HTML, CSS and JavaScript]]></description><link>https://blog.alicalimli.com/windows-10-setting-hover-effect-a-step-by-step-tutorial</link><guid isPermaLink="true">https://blog.alicalimli.com/windows-10-setting-hover-effect-a-step-by-step-tutorial</guid><category><![CDATA[CSS]]></category><category><![CDATA[CSS3]]></category><category><![CDATA[HTML5]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Frontend Development]]></category><dc:creator><![CDATA[Ali Calimli]]></dc:creator><pubDate>Sun, 30 Apr 2023 12:55:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1682858959660/f3aa4d30-686a-4aa7-b154-92cf2015a660.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-html-structure">HTML Structure</h2>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"container"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box-content"</span>&gt;</span>Lorem Ipsum<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box-content"</span>&gt;</span>Lorem Ipsum<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box-content"</span>&gt;</span>Lorem Ipsum<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
     <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box-content"</span>&gt;</span>Lorem Ipsum<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<h1 id="heading-css-styles">CSS Styles</h1>
<pre><code class="lang-css"><span class="hljs-selector-tag">body</span> {
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#111</span>;
}

<span class="hljs-selector-class">.container</span> {
  <span class="hljs-attribute">gap</span>: <span class="hljs-number">8px</span>;  
  <span class="hljs-attribute">display</span>: grid;
  <span class="hljs-attribute">width</span>: fit-content;
  <span class="hljs-attribute">grid-template-columns</span>: <span class="hljs-built_in">repeat</span>(<span class="hljs-number">2</span>, <span class="hljs-number">1</span>fr);
}

<span class="hljs-selector-class">.box</span> {
  <span class="hljs-attribute">color</span>: white;
  <span class="hljs-attribute">position</span>: relative;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">300px</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">100px</span>;
}
</code></pre>
<h1 id="heading-creating-the-border-glow-effect">Creating the Border Glow Effect</h1>
<p>Next, we will create a gradient on our boxes using the <code>::after</code> pseudo-element by using the radial-gradient function to create a circle gradient inside of all the boxes.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span><span class="hljs-selector-pseudo">::after</span> {
  <span class="hljs-attribute">content</span>: <span class="hljs-string">""</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">100%</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100%</span>;
  <span class="hljs-attribute">transition</span>: opacity <span class="hljs-number">500ms</span>;
  <span class="hljs-attribute">background</span>: <span class="hljs-built_in">radial-gradient</span>(
    <span class="hljs-number">600px</span> circle at <span class="hljs-number">0</span> <span class="hljs-number">0</span>, 
    rgba(<span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">0.6</span>),
    transparent <span class="hljs-number">20%</span>
  );
  <span class="hljs-attribute">position</span>: absolute;
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682843343964/9c3284a2-4bf9-4b60-b710-294fd33f12fb.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-lets-make-it-follow-the-mouse-using-javascript">Let's make it follow the mouse using JavaScript:</h3>
<pre><code class="lang-javascript"><span class="hljs-built_in">document</span>.body.onmousemove = <span class="hljs-function"><span class="hljs-params">e</span> =&gt;</span> {
  <span class="hljs-keyword">for</span>(<span class="hljs-keyword">const</span> date <span class="hljs-keyword">of</span> <span class="hljs-built_in">document</span>.getElementsByClassName(<span class="hljs-string">"box"</span>)) {
    <span class="hljs-keyword">const</span> rect = date.getBoundingClientRect(),
          x = e.clientX - rect.left,
          y = e.clientY - rect.top;

    date.style.setProperty(<span class="hljs-string">"--mouse-x"</span>, <span class="hljs-string">`<span class="hljs-subst">${x}</span>px`</span>);
    date.style.setProperty(<span class="hljs-string">"--mouse-y"</span>, <span class="hljs-string">`<span class="hljs-subst">${y}</span>px`</span>);
  };
}
</code></pre>
<p>The code above loops through all the boxes whenever the mouse moves and takes the position of the mouse. It then sets two CSS custom variables (<code>--mouse-x</code> and <code>--mouse-y</code>), which we can use to position the gradient inside the boxes.</p>
<p>We can now use the (<code>--mouse-x</code> and <code>--mouse-y</code>) custom variables in our CSS to position the gradient based on the mouse position:</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span><span class="hljs-selector-pseudo">::after</span>  {
  <span class="hljs-attribute">background</span>: <span class="hljs-built_in">radial-gradient</span>(
    <span class="hljs-number">600px</span> circle at var(--mouse-x) <span class="hljs-built_in">var</span>(--mouse-y), 
    <span class="hljs-built_in">rgba</span>(<span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">0.6</span>),
    transparent <span class="hljs-number">20%</span>
  );
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682843376836/ada1c560-eb2c-42f6-9b21-26799cc52670.gif" alt class="image--center mx-auto" /></p>
<h3 id="heading-covering-the-gradient-up">Covering the Gradient up</h3>
<p>Now the gradient glow effect is working but you can see the whole gradient when moving the cursor and we only need it to be visible a few pixels on all sides to create the border like effect.</p>
<p>We can fix this by using the box-content div to cover it up:</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span><span class="hljs-selector-pseudo">::after</span> {
 <span class="hljs-attribute">z-index</span>: <span class="hljs-number">1</span>;
}

<span class="hljs-selector-class">.box-content</span> {
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#111</span>;
  <span class="hljs-attribute">position</span>: absolute;
  <span class="hljs-attribute">z-index</span>: <span class="hljs-number">2</span>;
  <span class="hljs-attribute">display</span>: flex;
  <span class="hljs-attribute">align-items</span>: center;
  <span class="hljs-attribute">justify-content</span>: center;

  <span class="hljs-attribute">inset</span>: <span class="hljs-number">1px</span>;
}
</code></pre>
<p>We set the <code>background-color</code> of the box content to match the background color of the page and set the <code>z-index</code> higher than the ::after pseudo element which puts it below the box-content div.</p>
<p>Also, we set the <code>inset</code> property to <code>1px</code> which sets the size of the box-content div to be <code>100% - 1px</code> on all sides. This makes the gradient visible only 1px on all sides.</p>
<p>Note: The <code>inset</code> property is now used to set the border size of the box.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682843463898/9528d345-5d9b-4ec5-921a-a6c8f270f4fe.gif" alt class="image--center mx-auto" /></p>
<h1 id="heading-creating-the-glow-effect-on-hover">Creating The Glow Effect on Hover</h1>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span><span class="hljs-selector-pseudo">:hover</span><span class="hljs-selector-pseudo">::before</span> {
  <span class="hljs-attribute">content</span>: <span class="hljs-string">""</span>;
  <span class="hljs-attribute">position</span>: absolute;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">100%</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100%</span>;
  <span class="hljs-attribute">transition</span>: opacity <span class="hljs-number">500ms</span>;
  <span class="hljs-attribute">background</span>: <span class="hljs-built_in">radial-gradient</span>(
    <span class="hljs-number">500px</span> circle at var(--mouse-x) <span class="hljs-built_in">var</span>(--mouse-y), 
    <span class="hljs-built_in">rgba</span>(<span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">0.08</span>),
    transparent <span class="hljs-number">30%</span>
  );
  <span class="hljs-attribute">z-index</span>:<span class="hljs-number">3</span>;
}
</code></pre>
<p>Here we just created another radial gradient using the <code>::before</code> pseudo element that also follows the mouse but with the <code>z-index</code> set to 3 so its on top of the box content div:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682843680982/206b4961-83da-4e91-b85e-193c185350a4.gif" alt class="image--center mx-auto" /></p>
<p>That's it! You have just learned how to achieve this hover effect.</p>
<p>I hope you found this helpful. If you have any feedback or questions, please feel free to leave them in the comments section.</p>
<p>External Links:<br />- <a target="_blank" href="https://codepen.io/alicalimli_dev/pen/WNapwOL">Codepen</a><br />- <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/radial-gradient"><strong>Radial Gradient</strong></a><br /><strong>-</strong> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/::before"><strong>Before</strong></a> <strong>and</strong> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/::after"><strong>After</strong></a> <strong>Pseudo Elements</strong></p>
]]></content:encoded></item><item><title><![CDATA[Cool Button Hover Effect: A Step By Step Tutorial using HTML, CSS and JavaScript]]></title><description><![CDATA[Learn how to make a hover effect that fills a button with color from bottom to top on hover, and fills out from bottom to top on hover out.]]></description><link>https://blog.alicalimli.com/cool-button-hover-effect-a-step-by-step-tutorial</link><guid isPermaLink="true">https://blog.alicalimli.com/cool-button-hover-effect-a-step-by-step-tutorial</guid><category><![CDATA[CSS]]></category><category><![CDATA[HTML5]]></category><category><![CDATA[CSS3]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Ali Calimli]]></dc:creator><pubDate>Thu, 27 Apr 2023 12:58:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1682599718632/d77cc287-2543-40a2-ba16-c5f09cf71449.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-behind-the-scenes-preview">Behind The Scenes Preview</h2>
<p>To help you understand how this hover effect really works, here's what it looks like behind the scenes:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682496810847/0013d136-0d08-46f4-840f-8ec296300385.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-starting-html-structure">Starting HTML Structure</h2>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn"</span>&gt;</span>
  Hover me
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
</code></pre>
<h2 id="heading-css-styles">CSS Styles</h2>
<pre><code class="lang-css"><span class="hljs-selector-tag">body</span>{
  <span class="hljs-attribute">background</span>: <span class="hljs-number">#111</span>;
}

<span class="hljs-selector-class">.btn</span> {
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#212529</span>;
  <span class="hljs-attribute">color</span>: white;
  <span class="hljs-attribute">cursor</span>:pointer;
  <span class="hljs-attribute">font-size</span>: <span class="hljs-number">1.5rem</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">2rem</span> <span class="hljs-number">4rem</span>;
  <span class="hljs-attribute">border</span>: none;
  <span class="hljs-attribute">border-radius</span>: <span class="hljs-number">100vmax</span>;
  <span class="hljs-attribute">position</span>: relative;
  <span class="hljs-attribute">transition</span>: scale <span class="hljs-number">0.4s</span> ease;
}
</code></pre>
<h2 id="heading-creating-the-button-fill-element">Creating the Button Fill Element</h2>
<p>Now we'll create a new element inside the button that we will use to fill the button when we hover over it:</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn-fill"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
  Hover me
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-class">.btn-fill</span> {
  <span class="hljs-attribute">background</span>: <span class="hljs-number">#228be6</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">150%</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">200%</span>;
  <span class="hljs-attribute">border-radius</span>: <span class="hljs-number">60%</span>;
  <span class="hljs-attribute">position</span>: absolute;
  <span class="hljs-attribute">top</span>: <span class="hljs-number">50%</span>;
  <span class="hljs-attribute">left</span>: <span class="hljs-number">50%</span>;
  <span class="hljs-attribute">transform</span>: <span class="hljs-built_in">translate</span>(-<span class="hljs-number">50%</span>, <span class="hljs-number">50%</span>);
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682497070026/3feaa90f-47fb-4213-b4ee-762cc47ceed4.png" alt class="image--center mx-auto" /></p>
<p>Since the default behavior of the CSS <code>:hover</code> selector causes the element to go back to its normal position when we hover out, and we want the fill element to move upwards instead of returning downwards when hovered out, we will need to use JavaScript to handle the transitions.</p>
<h2 id="heading-animating-the-button-fill">Animating the Button Fill</h2>
<p>First, let's create a reusable function for animating the button fill element.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">animateBtnFill</span>(<span class="hljs-params">btnFill, translateY, duration</span>) </span>{
  requestAnimationFrame(<span class="hljs-function">() =&gt;</span> {
    btnFill.animate(
      {
        <span class="hljs-attr">transform</span>: <span class="hljs-string">`translate(-50%, <span class="hljs-subst">${translateY}</span>%)`</span>,
      },
      { duration, <span class="hljs-attr">fill</span>: <span class="hljs-string">'forwards'</span>, <span class="hljs-attr">easing</span>: <span class="hljs-string">'ease'</span> }
    )
  })
}
</code></pre>
<p>By placing the <code>animate</code> method inside the <code>requestAnimationFrame</code>, the animation is synchronized with the browser's rendering, leading to a smoother and more visually appealing animation.</p>
<p>We used <code>animate</code> method to set the position of the <code>btn-fill</code> and set the fill option to <code>forwards</code> so the <code>btn-fill</code> won't go back to its original position when the animation is done.</p>
<p><strong>Setting up mouse enter/leave event:</strong></p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> buttons = <span class="hljs-built_in">document</span>.querySelectorAll(<span class="hljs-string">'.btn'</span>);

buttons.forEach(<span class="hljs-function">(<span class="hljs-params">btn</span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> btnFill = btn.querySelector(<span class="hljs-string">'.btn-fill'</span>)

  btn.addEventListener(<span class="hljs-string">'mouseenter'</span>, <span class="hljs-function">() =&gt;</span> {
    <span class="hljs-comment">// Mouse Enter Event</span>
  });

  btn.addEventListener(<span class="hljs-string">'mouseleave'</span>, <span class="hljs-function">() =&gt;</span> {
    <span class="hljs-comment">// Mouse Leave Event</span>
  });
});
</code></pre>
<p>In the code snippet above we used querySelectorAll to select all the buttons in the DOM and loop through all the buttons where we attach event listeners for mouse enter/leave, we did this so that we can use this hover effect in multiple buttons.</p>
<p><strong>Let's animate the</strong> <code>btn-fill</code> <strong>on</strong> <code>mouseenter</code><strong>:</strong></p>
<pre><code class="lang-javascript">btn.addEventListener(<span class="hljs-string">'mouseenter'</span>, <span class="hljs-function">() =&gt;</span> {
  animateBtnFill(btnFill, <span class="hljs-number">50</span>, <span class="hljs-number">0</span>);

  animateBtnFill(btnFill, <span class="hljs-number">-50</span>, <span class="hljs-number">850</span>);
});
</code></pre>
<p>In the code snippet above we used <code>animateBtnFill(btnFill, 50, 0)</code> to set the Y position of the <code>btn-fill</code> to 50% and 0 duration on <code>mouseenter</code> so it just flicks back to the bottom when we hover the button therefore it will always come from the bottom when we hover the button.</p>
<p>After that, the second animation happens <code>animateBtnFill(btnFill, -50, 850)</code>, it sets the <code>btn-fill</code> Y to <code>-50%</code> which puts it in the center of the button which makes it look like the button is being filled with its color.</p>
<p><strong>Now let's animate the</strong> <code>btn-fill</code> <strong>to go above the bottom on</strong> <code>mouseleave</code> <strong>:</strong></p>
<pre><code class="lang-javascript">btn.addEventListener(<span class="hljs-string">'mouseleave'</span>, <span class="hljs-function">() =&gt;</span> {
  animateBtnFill(btnFill, <span class="hljs-number">-150</span>, <span class="hljs-number">850</span>)
})
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682497705171/be33ac31-6289-4aff-b847-5995582ecd6f.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-setting-button-overflow-to-hidden">Setting Button Overflow to Hidden</h2>
<pre><code class="lang-css"><span class="hljs-selector-class">.btn</span> {
 <span class="hljs-attribute">overflow</span>: hidden;
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682497874676/f4cdc501-c1b2-428b-beab-51d59d14e228.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-fixing-z-index-issue">Fixing z-index Issue</h2>
<p>Great, now we just need to fix the issue of the <code>btn-fill</code> covering the content of our button:</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn-fill"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn-content"</span>&gt;</span>Hover me<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-class">.btn-content</span> {
  <span class="hljs-attribute">position</span>:relative;
  <span class="hljs-attribute">z-index</span>: <span class="hljs-number">2</span>;
}
</code></pre>
<p>We have created a div called <code>btn-content</code> that will contain the contents of our button. We have also set its position to relative so that the z-index applies to the <code>btn-content</code> and places it on top of the <code>btn-fill</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682498043650/6809733d-7fc9-4ac8-bcbb-41efd05be78e.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-changing-the-button-scale-on-hover">Changing the Button Scale on Hover</h2>
<p>Finally let's just change the scale of the button when we hover over it:</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.btn</span><span class="hljs-selector-pseudo">:hover</span> {
  <span class="hljs-attribute">scale</span>: <span class="hljs-number">1.05</span>;
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682498124979/cbdc85d5-6690-485b-b92e-41e947c98767.gif" alt class="image--center mx-auto" /></p>
<p><strong>External Links:</strong><br />Codepen Link: <a target="_blank" href="https://codepen.io/alicalimli_dev/pen/ZEqeXRY"><strong>link</strong></a><br />Learn more about <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame">requestAnimationFrame</a> and <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Element/animate">animate</a></p>
<p>That's it you just learned how to achieve this cool hover effect, I hope you found this one helpful and If you have any questions or comments please feel free to leave them in the comments section.</p>
]]></content:encoded></item><item><title><![CDATA[Windows 10 Calendar Hover Effect: A Step By Step Tutorial]]></title><description><![CDATA[Learn how to achieve this awesome windows 10 calendar like border hover effect that you can use in your website]]></description><link>https://blog.alicalimli.com/windows-10-calendar-hover-effect-a-step-by-step-tutorial</link><guid isPermaLink="true">https://blog.alicalimli.com/windows-10-calendar-hover-effect-a-step-by-step-tutorial</guid><category><![CDATA[HTML5]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[CSS]]></category><category><![CDATA[CSS3]]></category><category><![CDATA[Frontend Development]]></category><dc:creator><![CDATA[Ali Calimli]]></dc:creator><pubDate>Tue, 25 Apr 2023 13:07:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1682325302988/21c10456-6db5-431a-be27-924244bf2e31.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-html-structure">HTML Structure</h1>
<p>Let's start by creating the HTML structure, We will create four boxes only to keep this tutorial simple.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"container"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box-content"</span>&gt;</span>1<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box-content"</span>&gt;</span>2<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box-content"</span>&gt;</span>3<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box-content"</span>&gt;</span>4<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<h1 id="heading-css-styles">CSS Styles</h1>
<pre><code class="lang-css"><span class="hljs-selector-tag">body</span> {
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#111</span>;
}

<span class="hljs-selector-class">.container</span> {
  <span class="hljs-attribute">gap</span>: <span class="hljs-number">8px</span>;  
  <span class="hljs-attribute">display</span>: grid;
  <span class="hljs-attribute">grid-template-columns</span>: <span class="hljs-built_in">repeat</span>(<span class="hljs-number">2</span>, <span class="hljs-number">1</span>fr);
  <span class="hljs-attribute">width</span>: <span class="hljs-built_in">min</span>(<span class="hljs-number">90%</span>, <span class="hljs-number">300px</span>);
}

<span class="hljs-selector-class">.box</span> {
  <span class="hljs-attribute">position</span>: relative;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100px</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">100px</span>;
}
</code></pre>
<h1 id="heading-creating-the-gradient-effect">Creating the Gradient Effect</h1>
<p>Next, we will create a gradient effect on our boxes using the ::after pseudo-element by using the radial-gradient function to create a circle gradient inside of all the boxes.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span><span class="hljs-selector-pseudo">::after</span> {
  <span class="hljs-attribute">content</span>: <span class="hljs-string">""</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">100%</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100%</span>;
  <span class="hljs-attribute">transition</span>: opacity <span class="hljs-number">500ms</span>;
  <span class="hljs-attribute">background</span>: <span class="hljs-built_in">radial-gradient</span>(
    <span class="hljs-number">600px</span> circle at <span class="hljs-number">0</span> <span class="hljs-number">0</span>, 
    rgba(<span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">0.6</span>),
    transparent <span class="hljs-number">20%</span>
  );
  <span class="hljs-attribute">position</span>: absolute;
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682324523952/bd1acf7c-306d-4a0b-aae8-94f25de4f00f.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-make-the-gradient-follow-the-mouse">Make the Gradient follow the mouse</h1>
<p>For this one we will have to use JavaScript:</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">document</span>.body.onmousemove = <span class="hljs-function"><span class="hljs-params">e</span> =&gt;</span> {
  <span class="hljs-keyword">for</span>(<span class="hljs-keyword">const</span> date <span class="hljs-keyword">of</span> <span class="hljs-built_in">document</span>.getElementsByClassName(<span class="hljs-string">"box"</span>)) {
    <span class="hljs-keyword">const</span> rect = date.getBoundingClientRect(),
          x = e.clientX - rect.left,
          y = e.clientY - rect.top;

    date.style.setProperty(<span class="hljs-string">"--mouse-x"</span>, <span class="hljs-string">`<span class="hljs-subst">${x}</span>px`</span>);
    date.style.setProperty(<span class="hljs-string">"--mouse-y"</span>, <span class="hljs-string">`<span class="hljs-subst">${y}</span>px`</span>);
  };
}
</code></pre>
<p>The code above loops through all the boxes whenever the mouse moves and takes the position of the mouse. It then sets two CSS custom variables (<code>--mouse-x</code> and <code>--mouse-y</code>), which we can use to position the gradient inside the boxes.</p>
<p>We can now use the (<code>--mouse-x</code> and <code>--mouse-y</code>) custom variables in our CSS to position the gradient based on the mouse position:</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span><span class="hljs-selector-pseudo">::after</span> {
  <span class="hljs-attribute">background</span>: <span class="hljs-built_in">radial-gradient</span>(
    <span class="hljs-number">600px</span> circle at var(--mouse-x) <span class="hljs-built_in">var</span>(--mouse-y), 
    <span class="hljs-built_in">rgba</span>(<span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">0.6</span>),
    transparent <span class="hljs-number">20%</span>
  );
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682324634508/d98a7bf5-aac4-4e61-9887-431660bede63.gif" alt class="image--center mx-auto" /></p>
<h1 id="heading-covering-the-gradient-up">Covering the Gradient up</h1>
<p>At this point, the gradient glow effect is working but you can see the whole gradient when moving the cursor and we only need it to be visible a few pixels on all sides to create the border effect.  </p>
<p>We can fix this by using the box-content div to cover it up:</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span><span class="hljs-selector-pseudo">::after</span> {
 <span class="hljs-attribute">z-index</span>: <span class="hljs-number">1</span>;
}

<span class="hljs-selector-class">.box-content</span> {
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#111</span>;
  <span class="hljs-attribute">position</span>: absolute;
  <span class="hljs-attribute">z-index</span>: <span class="hljs-number">2</span>;
  <span class="hljs-attribute">color</span>: white;
  <span class="hljs-attribute">display</span>: flex;
  <span class="hljs-attribute">align-items</span>: center;
  <span class="hljs-attribute">justify-content</span>: center;
}
</code></pre>
<p>We set the <code>background-color</code> of the box content to match the background color of the page and set the <code>z-index</code> higher than the ::after pseudo element (gradient) which puts it below the box-content.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682407892439/11cf4ab0-cbc6-4418-b5a3-418ce64b3d48.gif" alt class="image--center mx-auto" /></p>
<p>Now we have to set the <code>inset</code> property to <code>3px</code> which makes the gradient only visible 3px on all sides of the box-content which creates a border-like effect.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box-content</span> {
  <span class="hljs-attribute">inset</span>: <span class="hljs-number">3px</span>;
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682324645777/7dd9912e-3ad6-47f4-bd90-ae93f33e6a21.gif" alt class="image--center mx-auto" /></p>
<h1 id="heading-making-the-border-lighter-on-hover">Making the border lighter on hover</h1>
<p>Finally, let's add a simple hover effect in the div with box class to make the border lighter when we hover over the boxes.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span><span class="hljs-selector-pseudo">:hover</span>{
  <span class="hljs-attribute">background-color</span>: <span class="hljs-built_in">rgba</span>(<span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">0.4</span>);
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682324676022/b3f0e1ca-5ff0-499a-b451-ad1ba08c3802.gif" alt class="image--center mx-auto" /></p>
<p>Here's the codepen <a target="_blank" href="https://codepen.io/alicalimli_dev/pen/YzOBzNv">link</a></p>
<p>That's it you just learned how to achieve this awesome hover effect, I hope you found this one helpful and If you have any questions or comments please feel free to leave them below.</p>
]]></content:encoded></item><item><title><![CDATA[Learn how to create this awesome border hover effect]]></title><description><![CDATA[In this blog you will learn how to create a cool gradient effect that circles in your element when it is hovered.]]></description><link>https://blog.alicalimli.com/learn-how-to-create-this-awesome-border-hover-effect</link><guid isPermaLink="true">https://blog.alicalimli.com/learn-how-to-create-this-awesome-border-hover-effect</guid><category><![CDATA[CSS]]></category><category><![CDATA[CSS3]]></category><category><![CDATA[webdevelopment]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[HTML5]]></category><dc:creator><![CDATA[Ali Calimli]]></dc:creator><pubDate>Sun, 23 Apr 2023 12:10:49 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1682241709896/48a4796d-22b4-497e-a4c9-afd16c0ef924.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-html-setup">HTML Setup</h2>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn"</span>&gt;</span>
    Hover me
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
</code></pre>
<h2 id="heading-css-styles">CSS Styles</h2>
<pre><code class="lang-css"><span class="hljs-selector-tag">body</span> {
  <span class="hljs-attribute">background</span>: <span class="hljs-number">#111</span>;
}

<span class="hljs-selector-class">.btn</span> {
  <span class="hljs-attribute">cursor</span>: pointer;
  <span class="hljs-attribute">background</span>: none;
  <span class="hljs-attribute">border</span>: none;
  <span class="hljs-attribute">color</span>: white;
  <span class="hljs-attribute">border-radius</span>: <span class="hljs-number">100vmax</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">1rem</span> <span class="hljs-number">2rem</span>;
  <span class="hljs-attribute">position</span>: relative;
}
</code></pre>
<h2 id="heading-the-gradient-effect">The Gradient Effect</h2>
<pre><code class="lang-css"><span class="hljs-selector-class">.btn</span><span class="hljs-selector-pseudo">::before</span> {
  <span class="hljs-attribute">content</span>: <span class="hljs-string">""</span>;
  <span class="hljs-attribute">background-image</span>: 
    <span class="hljs-built_in">conic-gradient</span>(
      #fff <span class="hljs-number">0deg</span>, transparent <span class="hljs-number">320deg</span>
    );

  <span class="hljs-comment">/* Should be bigger than button */</span>
  <span class="hljs-attribute">height</span>: <span class="hljs-number">200px</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">200px</span>;


  <span class="hljs-comment">/* Centering the gradient  */</span>
  <span class="hljs-attribute">position</span>: absolute;
  <span class="hljs-attribute">top</span>: <span class="hljs-number">50%</span>;
  <span class="hljs-attribute">left</span>: <span class="hljs-number">50%</span>;
  <span class="hljs-attribute">transform</span>: 
      <span class="hljs-built_in">translate</span>(-<span class="hljs-number">50%</span>,-<span class="hljs-number">50%</span>) 
      <span class="hljs-built_in">rotate</span>(<span class="hljs-number">0deg</span>);

  <span class="hljs-attribute">border-radius</span>: inherit;
  <span class="hljs-attribute">transition</span>: 
        transform <span class="hljs-number">1s</span> 
        <span class="hljs-built_in">cubic-bezier</span>(<span class="hljs-number">0.3</span>, <span class="hljs-number">1</span>, <span class="hljs-number">0.3</span>, <span class="hljs-number">1</span>);
}
</code></pre>
<h2 id="heading-rotate-gradient-on-hover">Rotate Gradient on Hover</h2>
<pre><code class="lang-css"><span class="hljs-selector-class">.btn</span><span class="hljs-selector-pseudo">:hover</span><span class="hljs-selector-pseudo">::before</span> {
  <span class="hljs-attribute">transform</span>: 
        <span class="hljs-built_in">translate</span>(-<span class="hljs-number">50%</span>,-<span class="hljs-number">50%</span>) 
        <span class="hljs-built_in">rotate</span>(-<span class="hljs-number">360deg</span>);
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682241185663/3f1f91ac-65bf-4d96-bb1b-f20ab588add6.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-set-overflow-hidden-in-the-parent-element">Set overflow hidden in the parent element</h2>
<pre><code class="lang-css"><span class="hljs-selector-class">.btn</span> {
  <span class="hljs-attribute">overflow</span>: hidden;
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682241211508/76563211-e4eb-4452-8334-1565ef282f6a.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-covering-up-the-gradient">Covering up the gradient</h2>
<p>- Here we added btn-content div to cover up the gradient by setting its background color same as the main body color of the page and setting the gradient z-index to -1</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn-content"</span>&gt;</span>
       Hover me
  <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-class">.btn</span> {
  <span class="hljs-comment">/* Becomes Border Size */</span>
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">3px</span>; 
}

<span class="hljs-selector-class">.btn</span><span class="hljs-selector-pseudo">::before</span> {
  <span class="hljs-comment">/* Put gradient behind btn-content */</span>
  <span class="hljs-attribute">z-index</span>: -<span class="hljs-number">1</span>; 
}

<span class="hljs-selector-class">.btn-content</span> {
  <span class="hljs-attribute">background</span>: <span class="hljs-number">#111</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">1rem</span> <span class="hljs-number">2rem</span>;
  <span class="hljs-attribute">border-radius</span>: inherit;
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682242074270/c19425ff-1a7e-45e7-85c2-4372d24d0726.gif" alt class="image--center mx-auto" /></p>
<p>Here's the Codepen <a target="_blank" href="https://codepen.io/alicalimli_dev/full/yLRggxP">Link</a></p>
<p>That's it you just learned how to create this awesome hover effect, I hope you found this one helpful and If you have any questions or comments please feel free to leave them below.</p>
]]></content:encoded></item><item><title><![CDATA[Different ways to load JavaScript in HTML]]></title><description><![CDATA[Regular Script Loading Inside of the head tag Browser fetches and executes the script first before parsing the HTML body. An error might occur here when…]]></description><link>https://blog.alicalimli.com/different-ways-to-load-javascript-in-html</link><guid isPermaLink="true">https://blog.alicalimli.com/different-ways-to-load-javascript-in-html</guid><category><![CDATA[HTML5]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Ali Calimli]]></dc:creator><pubDate>Wed, 18 May 2022 10:45:59 GMT</pubDate><content:encoded><![CDATA[<p><strong>Regular Script Loading Inside of the head tag</strong></p>
<ul>
<li><p>Browser fetches and executes the script first before parsing the HTML body.</p>
</li>
<li><p>An error might occur here when you're manipulating the DOM because script is executed first and DOM doesn't exist yet.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652869928467/l1kDPrD6y.png" alt="f8f92c36-6a15-4888-bdb3-1ce0ca58b88f.png" /></p>
<p><strong>Regular Script Loading at the end of the  tag</strong></p>
<ul>
<li>The Script will be fetched and executed when the HTML is parsed completely.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652869966472/4PYl8jqbN.png" alt="d2248a60-77b8-462f-bacc-19bae7a242dd.png" /></p>
<p><strong>Async Script Loading</strong></p>
<ul>
<li>Fetches the script asynchronously while the HTML is being parsed and immediately executes it when the script has been loaded completely.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652869983099/T2FY2alId.png" alt="74cc7299-2f21-4ba2-8032-b95ff9eafb28.png" /></p>
<p><strong>Defer Script Loading</strong></p>
<ul>
<li>The script is being fetched asynchronously and will only be executed when the HTML is parsed completely.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652869997439/Qop3FPaM2.png" alt="79904536-69e7-4c2e-833c-9d03113ec546.png" /></p>
]]></content:encoded></item></channel></rss>