<?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: Tawhidul Islam Khan</title>
    <description>The latest articles on DEV Community by Tawhidul Islam Khan (@tawhiduldev).</description>
    <link>https://dev.to/tawhiduldev</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%2F894380%2Fc742475e-7261-4c19-8273-7e28a9cc942c.jpg</url>
      <title>DEV Community: Tawhidul Islam Khan</title>
      <link>https://dev.to/tawhiduldev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tawhiduldev"/>
    <language>en</language>
    <item>
      <title>Stop Relying on Just LocalStorage: Others are powerful too</title>
      <dc:creator>Tawhidul Islam Khan</dc:creator>
      <pubDate>Tue, 22 Apr 2025 04:41:21 +0000</pubDate>
      <link>https://dev.to/tawhiduldev/stop-relying-on-just-localstorage-others-are-powerful-too-odb</link>
      <guid>https://dev.to/tawhiduldev/stop-relying-on-just-localstorage-others-are-powerful-too-odb</guid>
      <description>&lt;p&gt;When building modern web applications, efficient client-side data management is important. LocalStorage often comes to mind, but the browser offers powerful storage options, including localStorage, sessionStorage, cookies, and the often-underestimated IndexedDB. Let's delve into this storage zone.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;localStorage:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This widely used client-side storage system allows you to store key-value pairs locally within the user's browser. However, it has a few notable limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;String-Only Storage: You can only store strings. To persist objects or arrays, you need to serialize them using JSON.stringify() when saving and parse them back with JSON.parse() when retrieving.&lt;/li&gt;
&lt;li&gt;Limited Capacity: The storage limit is typically around 5MB per origin.&lt;/li&gt;
&lt;li&gt;Synchronous Operations: localStorage operations are synchronous, meaning they can block the main browser thread, potentially impacting performance, especially when dealing with larger datasets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;sessionStorage&lt;/strong&gt;:
&lt;/h2&gt;

&lt;p&gt;Similar to localStorage, sessionStorage provides key-value storage. The main difference is its lifespan: data stored in sessionStorage persists until the browser tab or window is closed. It shares the same limitations as localStorage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;5MB Storage Limit&lt;/li&gt;
&lt;li&gt;String-Only Storage&lt;/li&gt;
&lt;li&gt;Synchronous Operations&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Cookies:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;These small text files play a vital role in web communication. They can be sent with HTTP requests, making them essential for tasks like transmitting authentication tokens to the backend, particularly in Server-Side Rendering (SSR) scenarios. However, they have a significantly smaller storage capacity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;4KB Storage Limit&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;IndexedDB:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The NoSQL Powerhouse: IndexedDB is used for more complex data management. It is like a NoSQL database. It offers significant advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flexible Data Storage: Unlike localStorage and sessionStorage, IndexedDB can store structured data, including JavaScript objects and binary data.&lt;/li&gt;
&lt;li&gt;Storage Capacity: You have access to much more storage space, often up to 100MB.&lt;/li&gt;
&lt;li&gt;Asynchronous Operations: IndexedDB operations are asynchronous, preventing blocking of the main thread and ensuring a smoother user experience, especially when dealing with large amounts of data.&lt;/li&gt;
&lt;li&gt;Advanced Features: It supports key features like database indexing, transactions for data integrity, and powerful querying capabilities.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Key Takeaway:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;While localStorage and sessionStorage serve well for simple key-value storage, IndexedDB is the solution for complex client-side data management in modern web applications, offering greater flexibility, capacity, and performance.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>javascript</category>
      <category>browser</category>
      <category>webdev</category>
    </item>
    <item>
      <title>CSS Specificity</title>
      <dc:creator>Tawhidul Islam Khan</dc:creator>
      <pubDate>Mon, 30 Oct 2023 05:47:32 +0000</pubDate>
      <link>https://dev.to/tawhiduldev/css-specificity-252m</link>
      <guid>https://dev.to/tawhiduldev/css-specificity-252m</guid>
      <description>&lt;p&gt;CSS specificity determines which CSS rule is applied when multiple rules target the same elements. For example, there is a div that has the content "Hello World", we will set a background color to that div. We can set background color in many ways.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inline style &lt;/li&gt;
&lt;li&gt;Id selector&lt;/li&gt;
&lt;li&gt;class selector, attribute sector, pseudo selector &lt;/li&gt;
&lt;li&gt;Element selector&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each way has its specificity hierarchy,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inline Style:&lt;/strong&gt; The inline style has the highest specificity and overrides all other styles. For example &lt;br&gt;
&lt;code&gt;&amp;lt;div style="background-color: red"&amp;gt;Hello World&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Id selector:&lt;/strong&gt; The id selector has less specificity than the inline style and higher specificity than the class selector and element selector&lt;br&gt;
&lt;code&gt;&amp;lt;div id="box1"&amp;gt;Hello World&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;// in CSS file or style in head&lt;/code&gt;&lt;br&gt;
&lt;code&gt;#box1{&lt;br&gt;
  background-color: red;&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Class Selector:&lt;/strong&gt; class selector, attribute selector has medium specificity: for example:&lt;br&gt;
&lt;code&gt;&amp;lt;div class="box"&amp;gt;Hello World&amp;lt;/div&amp;gt;&lt;br&gt;
// in CSS file or style in head&lt;br&gt;
.box{&lt;br&gt;
  background-color: red;&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Element Selector:&lt;/strong&gt; Element selector has low specificity, for example: &lt;br&gt;
&lt;code&gt;&amp;lt;div&amp;gt;Hello World&amp;lt;/div&amp;gt;&lt;br&gt;
// in CSS file or style in head&lt;br&gt;
div{&lt;br&gt;
  background-color: red;&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;There is an exception: If we use !important, it will override all CSS&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>developers</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to prevent dark mode effect on HTML form elements</title>
      <dc:creator>Tawhidul Islam Khan</dc:creator>
      <pubDate>Thu, 27 Jul 2023 04:01:08 +0000</pubDate>
      <link>https://dev.to/tawhiduldev/how-to-prevent-dark-mode-effect-on-html-form-elements-1ml5</link>
      <guid>https://dev.to/tawhiduldev/how-to-prevent-dark-mode-effect-on-html-form-elements-1ml5</guid>
      <description>&lt;p&gt;I was working on a project, suddenly I faced an issue. There should be normal mode to html form elements for example input, select, and textarea fields when desktop dark mode is on. Dark mode affects the form element's background color, Then I started to look for a solution and found the answer. There is css property called &lt;code&gt;color-scheme&lt;/code&gt; which indicates what color scheme can be used.&lt;/p&gt;

&lt;p&gt;add color-scheme property as below&lt;/p&gt;

&lt;p&gt;&lt;code&gt;input, select, textarea{&lt;br&gt;
    color-scheme: light;&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If I use &lt;code&gt;light&lt;/code&gt; then it will use light mode only&lt;/p&gt;

&lt;p&gt;&lt;code&gt;input, select, textarea{&lt;br&gt;
   color-scheme: light dark;&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If I use &lt;code&gt;light dark&lt;/code&gt; then it will use dark mode and light mode both.&lt;/p&gt;

&lt;p&gt;I used only &lt;code&gt;light&lt;/code&gt; so that my form elements can remain as normal design, not dark color background.&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
