<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Valesh</title>
    <description>The latest articles on DEV Community by Valesh (@valeshdev).</description>
    <link>https://dev.to/valeshdev</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%2F714208%2F0c341ae4-154c-4a89-977f-65e089e63e1f.png</url>
      <title>DEV Community: Valesh</title>
      <link>https://dev.to/valeshdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/valeshdev"/>
    <language>en</language>
    <item>
      <title>Building DreamHomes: Choosing the Right Rendering Strategy for a Modern Real Estate Platform</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Thu, 29 May 2025 12:44:59 +0000</pubDate>
      <link>https://dev.to/valeshdev/building-dreamhomes-choosing-the-right-rendering-strategy-for-a-modern-real-estate-platform-44a</link>
      <guid>https://dev.to/valeshdev/building-dreamhomes-choosing-the-right-rendering-strategy-for-a-modern-real-estate-platform-44a</guid>
      <description>&lt;p&gt;In today's fast-paced web, user experience is king. We want websites that load instantly, feel snappy, and are easy to find through search engines. But achieving this across a complex application with diverse needs isn't a "one-size-fits-all" problem. This is where &lt;strong&gt;rendering strategies&lt;/strong&gt; come into play.&lt;/p&gt;

&lt;p&gt;Let's dive into a real-world scenario: building "DreamHomes," a modern real estate listing platform. We'll explore how we can strategically choose rendering approaches for different parts of the application to maximize performance, SEO, and user satisfaction.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Challenge: A Real Estate Platform's Diverse Needs
&lt;/h3&gt;

&lt;p&gt;"DreamHomes" needs to cater to various users and use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First-time visitors searching for properties.&lt;/li&gt;
&lt;li&gt;Users Browse detailed listings.&lt;/li&gt;
&lt;li&gt;Users actively searching and filtering.&lt;/li&gt;
&lt;li&gt;Logged-in agents managing their listings.&lt;/li&gt;
&lt;li&gt;Logged-in buyers tracking their favorites.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these scenarios has unique requirements for initial load time, SEO, data freshness, and interactivity. Here's how we'd tackle them:&lt;/p&gt;




&lt;h3&gt;
  
  
  1. The Homepage: Your Grand Welcome Mat
&lt;/h3&gt;

&lt;p&gt;The homepage is crucial. It's the first impression, needs to be highly discoverable, and feature trending properties that update frequently.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Highly discoverable by search engines (SEO critical).&lt;/li&gt;
&lt;li&gt;Extremely fast initial load.&lt;/li&gt;
&lt;li&gt;Content (trending properties, featured agents) updates hourly.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Our Strategy: Incremental Static Regeneration (ISR)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Why?&lt;/strong&gt; Pure Static Site Generation (SSG) would be lightning-fast but wouldn't handle hourly updates gracefully without constant redeploys. Pure Server-Side Rendering (SSR) would handle freshness but might be slower on the initial byte than a pre-built page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ISR&lt;/strong&gt; allows us to generate the homepage HTML at build time (like SSG) for blazing-fast initial delivery from a CDN. But we can configure it to "revalidate" or regenerate the page in the background after a specified interval (e.g., every 60 minutes). This gives us the best of both worlds: static speed for first-time visitors and near real-time freshness for regularly updated content, all while satisfying search engine crawlers with pre-built HTML.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. Property Listing Detail Page: The Core Business
&lt;/h3&gt;

&lt;p&gt;Each property's detail page is fundamental. It contains rich information and is a prime target for search engines.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Crucial for SEO.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Property data (price, status, description) can change at any time.&lt;/li&gt;
&lt;li&gt;Includes an "Enquire Now" form (highly interactive, not SEO critical).&lt;/li&gt;
&lt;li&gt;Includes "Similar Properties" section (dynamic recommendations).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Our Strategy: Server-Side Rendering (SSR) for the Main Content + Client-Side Rendering (CSR) for Dynamic/Interactive Elements&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Why for Main Content (SSR)?&lt;/strong&gt; Since property data can change at any moment (an agent updates a price, or a property goes off-market), we cannot rely on build-time generation. SSR ensures that every time a user or a search engine crawler requests a property page, they get the absolute latest data rendered directly into the HTML. This is paramount for accuracy and SEO.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why for "Enquire Now" Form &amp;amp; "Similar Properties" (CSR)?&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;The "Enquire Now" form is an interactive client-side experience. It doesn't need to be indexed by search engines, and rendering it on the client reduces the server's workload.&lt;/li&gt;
&lt;li&gt;"Similar Properties" are dynamic recommendations that might involve personalized logic or separate API calls. Fetching and rendering these on the client-side after the main page has loaded keeps the initial SSR payload lean and allows for flexible updates. This is a common pattern for "below the fold" content or components that aren't critical for the initial content display or SEO.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  3. Search Results Page: The Interactive Powerhouse
&lt;/h3&gt;

&lt;p&gt;This page is all about dynamic filtering and instantly updated results.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Results are highly dynamic, changing with every search query and filter.&lt;/li&gt;
&lt;li&gt;Includes filters that instantly narrow down results without a full page refresh.&lt;/li&gt;
&lt;li&gt;Not necessarily critical for SEO beyond the initial search page URL itself.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Our Strategy: Client-Side Rendering (CSR)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Why?&lt;/strong&gt; Given the highly dynamic and interactive nature of search and filtering, CSR is the natural choice. Every filter change would trigger a new data fetch and an update of the displayed results directly in the browser. This provides a fluid, app-like experience without constant full page reloads. Since the specific search results are unique to each query and don't require individual indexing, the SEO benefits of SSR/SSG are less relevant here.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  4. User Dashboard: Personalized Hubs
&lt;/h3&gt;

&lt;p&gt;The dashboard is for logged-in users (agents and buyers) to manage their personalized content.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requires user authentication.&lt;/li&gt;
&lt;li&gt;Content is entirely personalized and dynamic.&lt;/li&gt;
&lt;li&gt;SEO is irrelevant.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Our Strategy: Client-Side Rendering (CSR) with Strategic Lazy Loading&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Why (Primary CSR)?&lt;/strong&gt; Since the content is personalized and behind a login, SEO is not a concern. CSR allows for a highly interactive and responsive user experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why (Strategic Lazy Loading)?&lt;/strong&gt; Dashboards can become "heavy" with many features (e.g., complex charts, large tables, numerous settings panels). Implementing &lt;strong&gt;code splitting and lazy loading&lt;/strong&gt; (using &lt;code&gt;React.lazy&lt;/code&gt; and &lt;code&gt;Suspense&lt;/code&gt;) is crucial here. Instead of downloading all the JavaScript for every dashboard feature upfront, we only download the code for a specific feature (like a "Listings Management" table or a "Detailed Analytics Chart") when the user actually navigates to that section. This significantly reduces the initial load time of the dashboard and improves perceived performance.&lt;/li&gt;
&lt;li&gt;(As an advanced consideration, if the dashboard were exceptionally heavy and even initial JS load was an issue, one &lt;em&gt;could&lt;/em&gt; consider partial SSR combined with client-side hydration for very critical "above the fold" sections, but this adds complexity and is usually overkill for authenticated dashboards where lazy loading suffices.)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  The Power of Hybrid Rendering
&lt;/h3&gt;

&lt;p&gt;As you can see, there isn't one "best" rendering strategy for an entire application. Modern web development thrives on &lt;strong&gt;hybrid rendering&lt;/strong&gt;, where you strategically combine these approaches based on the specific needs of each page or even each component.&lt;/p&gt;

&lt;p&gt;By carefully considering SEO, data freshness, interactivity, and performance goals, we can build robust, fast, and user-friendly applications like "DreamHomes" that truly stand out.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to host your static web applications on github pages</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Mon, 23 May 2022 15:40:55 +0000</pubDate>
      <link>https://dev.to/valeshdev/how-to-host-your-web-applications-on-github-pages-4aio</link>
      <guid>https://dev.to/valeshdev/how-to-host-your-web-applications-on-github-pages-4aio</guid>
      <description>&lt;p&gt;Github provides a free hosting service to help your websites go live online. It is called Github Pages. Github Pages builds a static website from the HTML, CSS and Javascript files in your repository. Let's see how.&lt;/p&gt;

&lt;p&gt;(For the purpose of this tutorial, we'll assume you already know how to create a repo and add files to it.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt;&lt;br&gt;
Go to your repo, click on 'Settings' &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fu5b1y86l9mgpyj50uoqo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fu5b1y86l9mgpyj50uoqo.png" alt="Settings Option" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;br&gt;
Click on 'Pages' in the left sidebar&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fe98bbwkk8fnweycmadlg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fe98bbwkk8fnweycmadlg.png" alt="Pages Option" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;br&gt;
Under the 'Source', click on 'None'.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fkexesu7atse4iszrxqn2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fkexesu7atse4iszrxqn2.png" alt="None Option" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt;&lt;br&gt;
From the dropdown menu, choose your main branch and click Save.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F4my9aopr6717ww9q8m42.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F4my9aopr6717ww9q8m42.png" alt="Main Branch" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt;&lt;br&gt;
That's it! Now your site is ready to be published. Wait a couple of minutes for your site to be live on the given link!&lt;br&gt;
&lt;a href="https://media2.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%2Fyllaij4vh3seaz1nc0u4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fyllaij4vh3seaz1nc0u4.png" alt="Published" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to host a web application or your personal portfolio on yourusername.github.io, create a repo with the name 'yourusername.github.io' and follow the above steps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt;&lt;br&gt;
If you want to host your custom domain on github, first enter your domain name in the 'Custom Domain' field and hit 'Save'. Then point the A record of your domain to the following ip addresses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let me know in the comments if you found it helpful!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>github</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>em vs rem - Most confusing CSS units explained</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Sun, 01 May 2022 10:31:20 +0000</pubDate>
      <link>https://dev.to/valeshdev/em-vs-rem-how-to-use-them-1ogl</link>
      <guid>https://dev.to/valeshdev/em-vs-rem-how-to-use-them-1ogl</guid>
      <description>&lt;p&gt;&lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt; are two of the most commonly used CSS relative units. They are also one of the most common sources of confusion among beginners. In this article, we'll see what exactly they are and how to use them.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Relative Units&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Relative units derive their sizes from other properties. Unlike absolute units(like pixels, inches etc.) whose sizes are independent of other units, the sizes of relative units change according to that of other properties.&lt;/p&gt;

&lt;p&gt;In particular, &lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt; are relative to the font sizes of parent and root elements respectively. Let's understand with this an example.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;em vs rem&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;First, we'll define two containers, one each for &lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt; respectively.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="em-parent"&amp;gt;
  &amp;lt;p&amp;gt;em-size&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div class="rem-parent"&amp;gt;
  &amp;lt;p&amp;gt;rem-size&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let us set the font-sizes for the root element and the children of &lt;em&gt;em-parent&lt;/em&gt; and &lt;em&gt;rem-parent&lt;/em&gt; containers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:root {
  font-size: 32px;
}

.em-parent p {
  font-size: 1em;
}

.rem-parent p {
  font-size: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As we can see from the result below, both the child elements derive their sizes from root element (&lt;em&gt;1em = 1rem = 32px&lt;/em&gt;).&lt;/p&gt;

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

&lt;p&gt;Now let's see what happens to the font-sizes of the child elements when we set the font-sizes of their parent containers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:root {
  font-size: 32px;
}

.em-parent {
  font-size: 64px;
}

.em-parent p {
  font-size: 1em;
}

.rem-parent {
  font-size: 64px;
}

.rem-parent p {
  font-size: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/valeshgopal/embed/JjpjJBp?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;
As we can see from the result, the &lt;em&gt;em&lt;/em&gt; unit is deriving its size from its parent container, whereas the &lt;em&gt;rem&lt;/em&gt; unit remains fixed to the font-size of the root element, unaffected by the font-size of its parent container. So in this case, &lt;em&gt;1em&lt;/em&gt; becomes &lt;em&gt;64px&lt;/em&gt; and &lt;em&gt;1rem&lt;/em&gt; remains &lt;em&gt;32px&lt;/em&gt;;&lt;/p&gt;

&lt;p&gt;So remember, &lt;em&gt;em&lt;/em&gt; derives its size from its parent, and in the absence of the parent's font-size, it derives its size from the root element. Whereas &lt;em&gt;rem&lt;/em&gt; always remains fixed to the font-size of the root element. &lt;/p&gt;

&lt;p&gt;Now that we understand the basic difference between &lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt;, let's get into their application.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;How to use &lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt; are most commonly used to set font-size, padding and margin of the elements. But another difference between &lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt; is that, &lt;em&gt;em&lt;/em&gt; has a compounding effect on padding and margin, whereas &lt;em&gt;rem&lt;/em&gt; always remains constant. That may sound confusing. So, let's understand it with an example.&lt;/p&gt;

&lt;p&gt;We'll use two buttons to demonstrate this example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="button-1"&amp;gt;
  &amp;lt;button&amp;gt;button 1&amp;lt;/button&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div class="button-2"&amp;gt;
  &amp;lt;button&amp;gt;button 2&amp;lt;/button&amp;gt;
&amp;lt;/div&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;Now let's set the properties of both the buttons in &lt;em&gt;em&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:root {
  font-size: 16px;
}

.button-1 {
  font-size: 16px;
}

.button-1 button {
  font-size: 1em;
  padding: 1em;
  margin: 1em;
}

.button-2 {
  font-size: 16px;
}

.button-2 button {
  font-size: 1em;
  padding: 1em;
  margin: 1em;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Let's increase the font-size of button 1 to &lt;em&gt;2em&lt;/em&gt;(2 * 16 = &lt;em&gt;32px&lt;/em&gt;) and see what happens.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.button-1 button {
  font-size: 2em;
  padding: 1em;
  margin: 1em;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Apart from increase in its font-size, something interesting has just happened in &lt;em&gt;button 1&lt;/em&gt;. Can you notice it? No? It might be a bit difficult to notice with naked eye. So, let me show what happened. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F0u7v6rvw3aio8hvkhqy8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F0u7v6rvw3aio8hvkhqy8.jpg" alt="button 1 illustration" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that the padding and margin of &lt;em&gt;button 1&lt;/em&gt; have also increased to &lt;em&gt;32px(2em)&lt;/em&gt; even though they are set to &lt;em&gt;1em&lt;/em&gt;. This is because of the compounding effect of &lt;em&gt;em&lt;/em&gt;. While the &lt;em&gt;em&lt;/em&gt; of child derives its size from its parent, the &lt;em&gt;em&lt;/em&gt; of padding and margin of the child are derived from its own font-size. &lt;/p&gt;

&lt;p&gt;So in this example, &lt;br&gt;
&lt;em&gt;1em&lt;/em&gt; of child element = font-size of parent container = &lt;em&gt;16px&lt;/em&gt;; &lt;br&gt;
&lt;em&gt;1em&lt;/em&gt; of padding/margin = font-size of the element = &lt;em&gt;2em&lt;/em&gt; = &lt;em&gt;32px&lt;/em&gt;;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ft8636700hcu2ar05v4dm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ft8636700hcu2ar05v4dm.jpg" alt="em vs rem difference" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's also increase the font-size of &lt;em&gt;button 2&lt;/em&gt; to &lt;em&gt;2em&lt;/em&gt; and set the padding and margin to &lt;em&gt;1rem&lt;/em&gt; each. This will help us visually understand the difference between &lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt; better.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/valeshgopal/embed/ZErEXLP?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
 &lt;br&gt;
The padding and margin in &lt;em&gt;button 2&lt;/em&gt; have remained &lt;em&gt;16px&lt;/em&gt; each. Ideally, we would always want the padding of an element to remain proportionate to its font-size. Notice in the above example, the &lt;em&gt;button 2&lt;/em&gt; looks congested when we increase its font size, but keep its padding fixed to &lt;em&gt;1rem&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;So, it is a good practice to always set the padding of elements in &lt;em&gt;em&lt;/em&gt; like we did in &lt;em&gt;button 1&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;And as we increase or decrease the font-sizes of the elements, we would want the spacing between them to remain constant. That is why it is a good practice to set the margin in &lt;em&gt;rem&lt;/em&gt;. Let's make the change in our code and see the difference.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.button-1 button {
  font-size: 2em;
  padding: 1em;
  margin: 1rem;
}

.button-2 button {
  font-size: 2em;
  padding: 1em;
  margin: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fw16abvq650k5enf4k88d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fw16abvq650k5enf4k88d.jpg" alt="em vs rem margin" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that if we set the margin in &lt;em&gt;em&lt;/em&gt;, the elements drift apart when we increase their font-sizes, owing to the compounding effect of &lt;em&gt;em&lt;/em&gt;. But if we set the margin in &lt;em&gt;rem&lt;/em&gt;, the spacing between the elements remains constant. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Conclusion&lt;/u&gt;&lt;/strong&gt;:&lt;br&gt;
Many developers often use &lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt; interchangeably to set padding and margin. But this can lead to unintended consequences, namely resulting in uneven spacing issues within the elements and in the layout of the website. That is why it's important to understand in what ways &lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt; differ.&lt;/p&gt;

&lt;p&gt;Let me know in the comments if this article has helped you understand the difference between em and rem better.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>css</category>
      <category>frontend</category>
    </item>
    <item>
      <title>CSS Box-Model Simplified</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Thu, 21 Apr 2022 07:45:24 +0000</pubDate>
      <link>https://dev.to/valeshdev/css-box-model-simplified-4en4</link>
      <guid>https://dev.to/valeshdev/css-box-model-simplified-4en4</guid>
      <description>&lt;p&gt;Each element on a web page is wrapped around by a box. The arrangement of these boxes makes up the layout of the website. Building layouts is a crucial part of front-end development which is what makes understanding the box-model indispensable.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features of the box:&lt;/strong&gt;&lt;br&gt;
Each box has &lt;em&gt;padding&lt;/em&gt;, &lt;em&gt;margin&lt;/em&gt; and &lt;em&gt;border&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Padding&lt;/strong&gt;: The space between the content and the border.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Margin&lt;/strong&gt;: The space around the border. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Border&lt;/strong&gt;: Indicates the dimensions of the box.&lt;/p&gt;


&lt;img src="https://media2.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%2Foldawl3m5e6y9hj6xw7f.png" width="765" height="585"&gt;https://commons.wikimedia.org/wiki/File:Box-model.svg
&lt;br&gt;&lt;br&gt;


&lt;p&gt;&lt;strong&gt;Dimensions of the box&lt;/strong&gt;:&lt;br&gt;
The dimensions of the box are computed as follows:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;width of box = width of element + padding-left + padding-right + border-left+ border-right&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;height of box = height of element + padding-top + padding-bottom + border-top + border-bottom&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Take a look at the following CSS for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div {
  width: 100px;
  height: 100px;
  padding: 10px;
  border: 5px solid red;
  margin: 10px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;width of the box = width of element (100px) + padding-left(10px) + padding-right(10px) + border-left(5px)+ border-right(5px) = 130px&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;height of the box = height of element(100px) + padding-top(10px) + padding-bottom(10px) + border-top(5px) + border-bottom(5px) = 130px&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Therefore, the dimensions of the box are &lt;em&gt;130px x 130px&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbs4hg3ge08ngqd3aerla.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbs4hg3ge08ngqd3aerla.png" alt="Image description" width="440" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that while we intended the element to be &lt;em&gt;100px x 100px&lt;/em&gt;, the padding and border added &lt;em&gt;30px&lt;/em&gt; to both width and height. This can make our elements overflow and compete with each other for space, messing up the layout.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Box Sizing&lt;/strong&gt;:&lt;br&gt;
The solution for this is a CSS property called &lt;em&gt;box-sizing&lt;/em&gt;. The default value of &lt;em&gt;box-sizing&lt;/em&gt; is set to &lt;em&gt;content-box&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Content-box&lt;/em&gt;: Includes width and height of only the element. The padding and the border are not included.&lt;/p&gt;

&lt;p&gt;Therefore, padding and border add extra pixels to the element, thus increasing the overall dimensions of the box.&lt;/p&gt;

&lt;p&gt;The alternate option is &lt;em&gt;border-box&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Border-box&lt;/em&gt;: Includes padding and border. As padding and border are altered, the dimensions of the element are adjusted accordingly, to keep the dimensions of the box fixed.&lt;/p&gt;


&lt;img src="https://media2.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%2Fhovwwb92ki9wgik9xcfd.png" width="299" height="415"&gt;


&lt;p&gt;Let's apply &lt;em&gt;border-box&lt;/em&gt; to our previous example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div {
  width: 100px;
  height: 100px;
  padding: 10px;
  border: 5px solid red;
  margin: 10px;
  box-sizing: border-box;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2F12j18xpgnun2cozd9sqt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F12j18xpgnun2cozd9sqt.png" alt="Image description" width="427" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that the dimensions of the box remain &lt;em&gt;100px x 100px&lt;/em&gt; even after adding padding and border. This is achieved by automatically adjusting the dimensions of the element to &lt;em&gt;70px x 70px&lt;/em&gt;, in order to accommodate padding and border.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tip&lt;/strong&gt;:&lt;br&gt;
Set the &lt;em&gt;box-sizing&lt;/em&gt; to &lt;em&gt;border-box&lt;/em&gt; using the universal selector(*), to reset the default &lt;em&gt;box-sizing&lt;/em&gt; property of all elements, at the beginning of your stylesheet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this article helped your understanding of the box-model, let me know in the comments!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>css</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Random Quote Generator</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Wed, 01 Dec 2021 15:08:38 +0000</pubDate>
      <link>https://dev.to/valeshdev/random-quote-generator-1eoe</link>
      <guid>https://dev.to/valeshdev/random-quote-generator-1eoe</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/valeshgopal/embed/zYEOzWz?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
    <item>
      <title>New Year Countdown Timer</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Thu, 25 Nov 2021 05:03:48 +0000</pubDate>
      <link>https://dev.to/valeshdev/new-year-countdown-timer-2fcg</link>
      <guid>https://dev.to/valeshdev/new-year-countdown-timer-2fcg</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/valeshgopal/embed/PoKvjPo?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
    <item>
      <title>Text To Speech Converter</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Mon, 22 Nov 2021 16:23:15 +0000</pubDate>
      <link>https://dev.to/valeshdev/text-to-speech-converter-4i2j</link>
      <guid>https://dev.to/valeshdev/text-to-speech-converter-4i2j</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/valeshgopal/embed/LYjaZGP?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
    <item>
      <title>Hover Board</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Sun, 21 Nov 2021 05:18:48 +0000</pubDate>
      <link>https://dev.to/valeshdev/hover-board-im5</link>
      <guid>https://dev.to/valeshdev/hover-board-im5</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/valeshgopal/embed/Yzxdgqp?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
    <item>
      <title>Incrementing Counter</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Mon, 15 Nov 2021 13:50:11 +0000</pubDate>
      <link>https://dev.to/valeshdev/incrementing-counter-3a5j</link>
      <guid>https://dev.to/valeshdev/incrementing-counter-3a5j</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/valeshgopal/embed/wvqYqOd?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
    <item>
      <title>Progress Steps</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Sun, 14 Nov 2021 05:43:24 +0000</pubDate>
      <link>https://dev.to/valeshdev/progress-steps-1kac</link>
      <guid>https://dev.to/valeshdev/progress-steps-1kac</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/valeshgopal/embed/jOLewLO?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
    <item>
      <title>Expanding Cards</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Sun, 14 Nov 2021 04:39:12 +0000</pubDate>
      <link>https://dev.to/valeshdev/expanding-cards-h25</link>
      <guid>https://dev.to/valeshdev/expanding-cards-h25</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/valeshgopal/embed/MWvqdRW?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
    <item>
      <title>Social Media Icons Hover Animation</title>
      <dc:creator>Valesh</dc:creator>
      <pubDate>Mon, 11 Oct 2021 09:43:20 +0000</pubDate>
      <link>https://dev.to/valeshdev/social-media-icons-hover-animation-4e70</link>
      <guid>https://dev.to/valeshdev/social-media-icons-hover-animation-4e70</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/valeshgopal/embed/dyzyLgZ?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
  </channel>
</rss>
