<?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: margishpatel</title>
    <description>The latest articles on DEV Community by margishpatel (@margishpatel).</description>
    <link>https://dev.to/margishpatel</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%2F1044090%2F11f54088-eb7a-46c2-9466-c08bbb7259c3.png</url>
      <title>DEV Community: margishpatel</title>
      <link>https://dev.to/margishpatel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/margishpatel"/>
    <language>en</language>
    <item>
      <title>13 Principles of Information Architecture Every Web Designer Should Know✅</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Fri, 18 Jul 2025 04:45:59 +0000</pubDate>
      <link>https://dev.to/margishpatel/13-principles-of-information-architecture-every-web-designer-should-know-4jd1</link>
      <guid>https://dev.to/margishpatel/13-principles-of-information-architecture-every-web-designer-should-know-4jd1</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Organization:&lt;/strong&gt; &lt;br&gt;
Information architecture is about organizing information in a logical and meaningful way, making it easy for users to find what they're looking for.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Labeling:&lt;/strong&gt; &lt;br&gt;
Use clear and descriptive labels for content to help users understand its context and purpose.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Navigation:&lt;/strong&gt; Create a clear and consistent navigation system to guide users through the website.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Search:&lt;/strong&gt; &lt;br&gt;
Provide a search function that is easy to use and returns relevant results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Chunking:&lt;/strong&gt; &lt;br&gt;
Group related information together in smaller, manageable chunks to make it easier for users to understand and find what they need.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Hierarchy:&lt;/strong&gt; &lt;br&gt;
Use a clear hierarchy to indicate the relative importance of different pieces of content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Consistency:&lt;/strong&gt; &lt;br&gt;
Maintain consistency throughout the website to help users understand the relationships between different pieces of content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Flexibility:&lt;/strong&gt; &lt;br&gt;
Allow for different ways of accessing and interacting with the content to accommodate different user needs and preferences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Simplicity:&lt;/strong&gt; &lt;br&gt;
Keep the information architecture simple and straightforward to minimize confusion and increase usability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Feedback:&lt;/strong&gt; &lt;br&gt;
Provide feedback to users to help them understand their actions and the results of those actions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11. Testing:&lt;/strong&gt; &lt;br&gt;
Test the information architecture with real users to ensure it is effective and efficient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;12. Scalability:&lt;/strong&gt; &lt;br&gt;
Design the information architecture to be scalable, so it can accommodate future growth and changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;13. Accessibility:&lt;/strong&gt; &lt;br&gt;
Ensure the information architecture is accessible to users with disabilities and comply with the web accessibility guidelines.&lt;/p&gt;

&lt;p&gt;It's important to remember that good information architecture is not only about making the website easy to use but also about creating an effective communication channel between the user and the website.&lt;/p&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5" rel="noopener noreferrer"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09" rel="noopener noreferrer"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>10 Best Practices for Improved HTML Code Quality 💯✅</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Fri, 18 Jul 2025 04:42:32 +0000</pubDate>
      <link>https://dev.to/margishpatel/10-best-practices-for-improved-html-code-quality-1mf</link>
      <guid>https://dev.to/margishpatel/10-best-practices-for-improved-html-code-quality-1mf</guid>
      <description>&lt;p&gt;Here are 10 best practices for improving the quality of your HTML code:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Use semantic HTML:&lt;/strong&gt; Write HTML that clearly conveys the meaning and structure of the content, using appropriate tags such as &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt;, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Use lowercase tags and attributes:&lt;/strong&gt; It is considered good practice to use lowercase letters for all HTML tags and attributes, as this makes the code easier to read and maintain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Validate your code:&lt;/strong&gt; Use an HTML validator tool to check your code for errors and ensure that it complies with the HTML standard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Use indentation and comments:&lt;/strong&gt; Use proper indentation and comments to make your code more readable and understandable for other developers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Use appropriate attribute values:&lt;/strong&gt; Use appropriate values for attributes such as alt, title, and href to improve accessibility and SEO.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Use CSS for presentation:&lt;/strong&gt; Use CSS for styling and layout, rather than inline styles or HTML tags such as &lt;code&gt;&amp;lt;font&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;b&amp;gt;&lt;/code&gt;, or &lt;code&gt;&amp;lt;i&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Avoid deprecated tags and attributes:&lt;/strong&gt; Avoid using deprecated HTML tags and attributes, such as &lt;code&gt;&amp;lt;center&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;font&amp;gt;&lt;/code&gt;, as they are no longer considered best practices and may cause compatibility issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Use relative paths:&lt;/strong&gt; Use relative paths for links and references to other files and resources, as this makes the code more portable and easier to maintain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Optimize images:&lt;/strong&gt; Use optimized and appropriately sized images to improve page load times and overall performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Test your code:&lt;/strong&gt; Test your HTML code on different browsers and devices to ensure that it displays and functions correctly for all users.&lt;/p&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5" rel="noopener noreferrer"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09" rel="noopener noreferrer"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Fix Flatpickr Showing Multiple Date &amp; Time Pickers on Mobile &amp; Tablet</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Mon, 03 Mar 2025 12:46:32 +0000</pubDate>
      <link>https://dev.to/margishpatel/fix-flatpickr-showing-multiple-date-time-pickers-on-mobile-tablet-1g3m</link>
      <guid>https://dev.to/margishpatel/fix-flatpickr-showing-multiple-date-time-pickers-on-mobile-tablet-1g3m</guid>
      <description>&lt;p&gt;If Flatpickr is displaying multiple date or time pickers on mobile and tablet devices, it's likely due to the native browser pickers conflicting with Flatpickr's UI. Here’s how to fix it:&lt;/p&gt;

&lt;p&gt;1️⃣ Change Input Type to "Text"&lt;br&gt;
Use &lt;code&gt;&amp;lt;input type="text"&amp;gt;&lt;/code&gt; instead of &lt;code&gt;&amp;lt;input type="date"&amp;gt;&lt;/code&gt; to prevent the native picker.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;datepicker&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;timepicker&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;2️⃣ Initialize Flatpickr Properly (React/Next.js)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Ensure&lt;/span&gt; &lt;span class="nx"&gt;Flatpickr&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;correctly&lt;/span&gt; &lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="nx"&gt;up&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="nx"&gt;component&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;flatpickr&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;flatpickr&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DateTimePicker&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;datepickerRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useRef&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;flatpickr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;datepickerRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;dateFormat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Y-m-d&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;datepickerRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;3️⃣ Force Flatpickr on Mobile (&lt;code&gt;disableMobile: true&lt;/code&gt;)&lt;br&gt;
This prevents the browser’s native picker from appearing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;flatpickr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;datepickerRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;dateFormat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Y-m-d&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;disableMobile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Forces Flatpickr's custom UI&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;4️⃣ Check for CSS Conflicts&lt;br&gt;
Ensure no styles are interfering:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.flatpickr-calendar&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;z-index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;9999&lt;/span&gt; &lt;span class="cp"&gt;!important&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;5️⃣ Test on Multiple Browsers &amp;amp; Devices&lt;br&gt;
Try Chrome, Safari, and Firefox on iOS &amp;amp; Android to ensure compatibility.&lt;/p&gt;

&lt;p&gt;By following these steps, Flatpickr will work smoothly on all devices! 🚀&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5" rel="noopener noreferrer"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09" rel="noopener noreferrer"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Build an Image Magnifier Component in ReactJs</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Wed, 01 May 2024 11:02:37 +0000</pubDate>
      <link>https://dev.to/margishpatel/build-an-image-magnifier-component-in-reactjs-2hc5</link>
      <guid>https://dev.to/margishpatel/build-an-image-magnifier-component-in-reactjs-2hc5</guid>
      <description>&lt;p&gt;React image magnifier tutorial. &lt;/p&gt;

&lt;p&gt;Create an Image Magnifier Component in ReactJs. With step-by-step instructions and code examples, you'll learn how to enhance user experience by allowing them to zoom in on images for a closer look. Follow along to build your own customizable image magnifier component and elevate your web development skills!"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Setting Up the Component Structure&lt;/strong&gt;&lt;br&gt;
First, let's establish the basic structure of our image magnifier component. We'll define the component function and set up its initial state.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ImageMagnifier&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;magnifierHeight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;magnifierWidth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;zoomLevel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.5&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;setXY&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="nx"&gt;imgWidth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;imgHeight&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;setSize&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;showMagnifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setShowMagnifier&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Rest of the component code will be added in subsequent steps&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Managing Mouse Events&lt;/strong&gt;&lt;br&gt;
Next, let's handle mouse events to control the display of the magnifier when hovering over the image.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt;
  &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;onMouseEnter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;elem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTarget&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;elem&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getBoundingClientRect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nf"&gt;setSize&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="nf"&gt;setShowMagnifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;onMouseMove&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;elem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTarget&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;elem&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getBoundingClientRect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pageX&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pageXOffset&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pageY&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pageYOffset&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;setXY&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;onMouseLeave&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setShowMagnifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;img&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Rendering the Magnifier&lt;/strong&gt;&lt;br&gt;
Now, let's add the magnifier element and style it based on the cursor position and image dimensions.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;
  &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;showMagnifier&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;absolute&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;pointerEvents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;magnifierHeight&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;magnifierWidth&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;magnifierHeight&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;magnifierWidth&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1px solid lightgray&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;white&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;backgroundImage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`url('&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;')`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;backgroundRepeat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;no-repeat&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;backgroundSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;imgWidth&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;zoomLevel&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;imgHeight&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;zoomLevel&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;backgroundPositionX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;zoomLevel&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;magnifierWidth&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;backgroundPositionY&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;zoomLevel&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;magnifierHeight&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;We done it. Here is the full code and a demo:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ImageMagnifier.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ImageMagnifier&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;magnifierHeight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;magnifierWidth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;zoomLevel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;showMagnifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setShowMagnifier&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="nx"&gt;imgWidth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;imgHeight&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;setSize&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;setXY&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mouseEnter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;el&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTarget&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getBoundingClientRect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nf"&gt;setSize&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
        &lt;span class="nf"&gt;setShowMagnifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mouseLeave&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nf"&gt;setShowMagnifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mouseMove&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;el&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTarget&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getBoundingClientRect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pageX&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;scrollX&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pageY&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;scrollY&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="nf"&gt;setXY&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;relative inline-block&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt;
            &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;onMouseEnter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;mouseEnter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
            &lt;span class="nx"&gt;onMouseLeave&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;mouseLeave&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
            &lt;span class="nx"&gt;onMouseMove&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;mouseMove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
        &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;
            &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="na"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;showMagnifier&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;absolute&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;pointerEvents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;magnifierHeight&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;magnifierWidth&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1px solid lightgrey&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;white&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;borderRadius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;5px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;backgroundImage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`url('&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;')`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;backgroundRepeat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;no-repeat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;magnifierHeight&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;magnifierWidth&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;backgroundSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;imgWidth&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;zoomLevel&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;imgHeight&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;zoomLevel&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;backgroundPositionX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;zoomLevel&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;magnifierWidth&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;backgroundPositionY&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;zoomLevel&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;magnifierHeight&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;ImageMagnifier&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// App.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ImageMagnifier&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./ImageMagnifier&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ImageMagnifier&lt;/span&gt; 
                &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../images/demo-img.jpg&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
                &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="nx"&gt;magnifierHeight&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="nx"&gt;magnifierWidth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="nx"&gt;zoomLevel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sample Image&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6n19zqoxs7f807gkrj9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6n19zqoxs7f807gkrj9.gif" alt="Example of Building an Image Magnifier Component in ReactJs"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
And there you have it! We've successfully created a simple yet functional image magnifier component in React. Users can now hover over images to inspect them closely, thanks to our intuitive magnifier feature.&lt;/p&gt;

&lt;p&gt;Feel free to customize and enhance this component further to suit your specific needs. Happy coding!&lt;/p&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5" rel="noopener noreferrer"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09" rel="noopener noreferrer"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>development</category>
      <category>react</category>
      <category>magnifier</category>
    </item>
    <item>
      <title>💡 Understanding SEO for Web Developers</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Wed, 29 Nov 2023 10:27:22 +0000</pubDate>
      <link>https://dev.to/margishpatel/understanding-seo-for-web-developers-2efm</link>
      <guid>https://dev.to/margishpatel/understanding-seo-for-web-developers-2efm</guid>
      <description>&lt;p&gt;SEO (Search Engine Optimization) is crucial for websites to rank higher in search engine results pages (SERPs). As a web developer, optimizing a website for search engines involves various technical aspects. Here are some techniques, including meta tags, structured data, and other SEO strategies:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Optimizing Meta Tags:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Title Tag&lt;/strong&gt;: Ensure each page has a unique, descriptive title tag (within 50-60 characters) containing relevant keywords to the content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Meta Description&lt;/strong&gt;: Write compelling meta descriptions (around 150-160 characters) summarizing the page content. Use keywords naturally and entice users to click.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Meta Robots Tag&lt;/strong&gt;: Use meta tags like robots to instruct search engine crawlers on how to index or follow links on a page.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Structured Data Markup:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Implement structured data using schemas like Schema.org to provide search engines with additional context about the content. This can enhance rich snippets in search results.
-Use markup for various content types such as articles, events, reviews, products, and FAQs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Optimizing Website Speed and Performance:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ensure fast-loading pages by optimizing images, leveraging browser caching, minifying CSS/JavaScript files, and reducing server response time.&lt;/li&gt;
&lt;li&gt;Implementing Accelerated Mobile Pages (AMP) for mobile users can significantly improve site speed and visibility.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Mobile Responsiveness:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Design websites to be mobile-friendly and responsive across various devices. Use responsive design principles to adapt content layouts to different screen sizes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. URL Structure:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create clean, descriptive, and user-friendly URLs that include relevant keywords. Avoid using long strings of numbers or special characters.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Optimizing Images:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use descriptive file names and include alt text for images, incorporating relevant keywords where appropriate. This helps search engines understand the content of images.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  7. Site Navigation and Internal Linking:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ensure a logical and organized site structure that allows search engines to crawl and index pages easily. Use internal linking to connect related content and distribute link authority.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  8. HTTPS and Security:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Secure your website with HTTPS as it not only encrypts data but is also a ranking factor for search engines. It builds trust and credibility among users.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  9. Monitoring and Analytics:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use tools like Google Analytics and Google Search Console to monitor website performance, track keywords, identify issues, and improve SEO strategies based on data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  10. Content Quality and Relevance:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;While not a direct development task, collaborating with content creators to ensure high-quality, relevant, and engaging content is crucial for SEO success.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Staying updated with SEO best practices and algorithm changes is essential for developers to adapt and optimize websites effectively for search engines. Regularly auditing and refining these techniques can lead to better search visibility and user experience.&lt;/p&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>seo</category>
      <category>beginners</category>
      <category>html</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Top 10 Unique HTML Attributes You Should Know About. 🚀💡💯</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Tue, 21 Nov 2023 05:25:50 +0000</pubDate>
      <link>https://dev.to/margishpatel/top-10-unique-html-attributes-you-should-know-about-53gb</link>
      <guid>https://dev.to/margishpatel/top-10-unique-html-attributes-you-should-know-about-53gb</guid>
      <description>&lt;p&gt;HTML, the markup language for creating web pages, has a variety of attributes that provide functionalities and define different aspects of elements on a web page. Some unique or less commonly known attributes include:&lt;/p&gt;

&lt;p&gt;1) &lt;strong&gt;contenteditable:&lt;/strong&gt; This attribute makes the content of an element editable by the user. It can be applied to various HTML elements like &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;, or &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; to allow direct user input.&lt;/p&gt;

&lt;p&gt;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 contenteditable="true"&amp;gt;
    This content can be edited by the user.
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;2) &lt;strong&gt;draggable:&lt;/strong&gt; When set to true, this attribute allows an element to be draggable. It's often used in conjunction with JavaScript to create drag-and-drop functionalities.&lt;/p&gt;

&lt;p&gt;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;img src="image.jpg" draggable="true" alt="Drag me"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;3) &lt;strong&gt;hidden:&lt;/strong&gt; This attribute hides the element from being displayed. It's different from CSS display: none; as it completely removes the element from the document's layout flow.&lt;/p&gt;

&lt;p&gt;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;p hidden&amp;gt;This paragraph is hidden&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;4) &lt;strong&gt;download:&lt;/strong&gt; Used with &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; elements, it prompts the user to download the linked resource rather than navigating to it. When clicked, it initiates the download of the specified resource.&lt;/p&gt;

&lt;p&gt;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;a href="myfile.pdf" download&amp;gt;Download PDF&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;5) &lt;strong&gt;spellcheck:&lt;/strong&gt; This attribute, when included in an editable element, enables or disables spell checking for the content within that element.&lt;/p&gt;

&lt;p&gt;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;textarea spellcheck="true"&amp;gt;&amp;lt;/textarea&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;6) &lt;strong&gt;sandbox:&lt;/strong&gt; Primarily used with &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; elements, it restricts what the embedded content can do (such as preventing scripts, form submission, or same-origin restrictions) for added security.&lt;/p&gt;

&lt;p&gt;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;iframe src="https://example.in" sandbox="allow-scripts"&amp;gt;&amp;lt;/iframe&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;7) &lt;strong&gt;loading:&lt;/strong&gt; This attribute controls how the browser loads an external resource specified in elements like &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;, etc. It helps improve page performance by specifying lazy loading or eager loading of resources.&lt;/p&gt;

&lt;p&gt;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;img src="image.jpg" loading="lazy" alt="Lazy-loaded image"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;8) &lt;strong&gt;defer:&lt;/strong&gt; Used with the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; element, the &lt;strong&gt;defer&lt;/strong&gt; attribute ensures that the script will be executed after the document has been parsed.&lt;/p&gt;

&lt;p&gt;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;script defer src="myscript.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;9) &lt;strong&gt;async:&lt;/strong&gt; Similar to defer, the &lt;strong&gt;async&lt;/strong&gt; attribute is used with the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; element, but it indicates that the script should be executed asynchronously.&lt;/p&gt;

&lt;p&gt;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;script async src="myscript.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;10) &lt;strong&gt;Translate:&lt;/strong&gt; This attribute is used to specify whether the content of an element should be translated when the page is localized.&lt;/p&gt;

&lt;p&gt;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;p translate="no"&amp;gt;This content should not be translated.&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While these attributes provide additional functionalities, it's essential to use them appropriately and consider browser compatibility and accessibility concerns when implementing them in web projects.&lt;/p&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Clean UI Guide: 15 White Space Design Tips 🚀💡</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Wed, 09 Aug 2023 05:17:03 +0000</pubDate>
      <link>https://dev.to/margishpatel/clean-ui-guide-15-white-space-design-tips-3fkg</link>
      <guid>https://dev.to/margishpatel/clean-ui-guide-15-white-space-design-tips-3fkg</guid>
      <description>&lt;p&gt;White space, also known as negative space, is the blank area around the design elements of a user interface (UI). It plays an important role in creating a visually appealing and easy-to-use UI. Here are 15 white space design tips to help you create a clean UI:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;create a clear hierarchy of information&lt;/strong&gt;. More white space can be used to separate important elements from less important ones.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;make important elements stand out&lt;/strong&gt;. It can help to draw the eye to a call to action or other important feature.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use ample white space between lines of text to &lt;strong&gt;improve readability&lt;/strong&gt;. This makes it easier for users to read and understand the content on your website or app.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use generous padding around buttons and other &lt;strong&gt;interactive elements&lt;/strong&gt;. This makes them easier to click on, which is important for improving usability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use consistent spacing throughout your UI&lt;/strong&gt;. This helps to create a sense of order and balance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;create a sense of breathing room&lt;/strong&gt;. This makes your UI feel less cluttered and overwhelming.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;create a focal point&lt;/strong&gt;. This can be achieved by increasing the amount of white space around a particular element.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;group related elements together&lt;/strong&gt;. This can help to create a visual hierarchy and make it easier for users to understand the content on your site or app.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;create a sense of elegance and sophistication&lt;/strong&gt;. By using white space effectively, you can create a design that looks clean, modern, and stylish.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;create contrast&lt;/strong&gt;. This can help to make important elements stand out from the background.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;create a sense of movement&lt;/strong&gt;. This can be achieved by using white space to guide the eye from one element to the next.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;create a sense of order&lt;/strong&gt;. By using white space effectively, you can create a design that looks organized and well thought out.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;create a sense of simplicity&lt;/strong&gt;. A design with ample white space can look clean and simple, which can be very effective in certain contexts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;create a sense of professionalism&lt;/strong&gt;. A design that makes good use of white space can look polished and professional, which can be very important for certain types of websites and apps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use white space to &lt;strong&gt;create a sense of balance&lt;/strong&gt;. By using white space effectively, you can create a design that looks balanced and harmonious, which can be very appealing to users.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>10 Rules I Follow When Writing HTML To Make It Concise and Readable🚀💡</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Sat, 13 May 2023 05:22:34 +0000</pubDate>
      <link>https://dev.to/margishpatel/10-rules-i-follow-when-writing-html-to-make-it-concise-and-readable-309k</link>
      <guid>https://dev.to/margishpatel/10-rules-i-follow-when-writing-html-to-make-it-concise-and-readable-309k</guid>
      <description>&lt;p&gt;Here are 10 rules that can be followed when writing HTML to make it more concise and readable:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Use semantic elements:&lt;/strong&gt; &lt;br&gt;
Use semantic elements such as &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; and more to clearly communicate the purpose of the content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Use descriptive class and id names:&lt;/strong&gt; &lt;br&gt;
Use descriptive class and id names that clearly communicate the purpose of the element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Use the alt attribute for images:&lt;/strong&gt; &lt;br&gt;
Use the alt attribute for images, to provide a text description of the image in case the image can't be loaded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Use the title attribute for links:&lt;/strong&gt; &lt;br&gt;
Use the title attribute for links, to provide additional information about the link.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Keep nesting to a minimum:&lt;/strong&gt; &lt;br&gt;
Keep nesting to a minimum to avoid complex structure, which makes it harder to understand the relationships between elements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Use comments:&lt;/strong&gt; &lt;br&gt;
Use comments to explain the purpose of different sections of your HTML, and to help other developers understand your code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Use a template engine:&lt;/strong&gt; &lt;br&gt;
Use a template engine such as Handlebars or Mustache, which allows you to separate the presentation logic from the data and make your HTML more readable and maintainable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Use the correct header levels:&lt;/strong&gt; &lt;br&gt;
Use the correct header levels &lt;code&gt;H1, H2, H3, etc.&lt;/code&gt; to create a logical structure of the content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Use lists correctly:&lt;/strong&gt; &lt;br&gt;
Use lists correctly, either as an ordered list &lt;code&gt;&amp;lt;ol&amp;gt;&lt;/code&gt; or unordered list &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; to structure the content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Keep it simple:&lt;/strong&gt; &lt;br&gt;
Keep your HTML simple and avoid over-engineering solutions. The simpler your HTML is, the easier it will be to maintain and understand.&lt;/p&gt;

&lt;p&gt;By following these rules, your HTML will be more concise, readable and semantic, which makes it easier to maintain and collaborate on projects.&lt;/p&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
    <item>
      <title>Free Design Resources 🤩🚀</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Fri, 05 May 2023 10:51:22 +0000</pubDate>
      <link>https://dev.to/margishpatel/free-design-resources-4oj5</link>
      <guid>https://dev.to/margishpatel/free-design-resources-4oj5</guid>
      <description>&lt;p&gt;Free Design Resources refer to a collection of digital design assets, including &lt;strong&gt;Typography&lt;/strong&gt;, &lt;strong&gt;Images&lt;/strong&gt;, &lt;strong&gt;Mockups&lt;/strong&gt;, &lt;strong&gt;Icon&lt;/strong&gt;, &lt;strong&gt;Illustrations&lt;/strong&gt;, and &lt;strong&gt;Colors&lt;/strong&gt;, that are available for free, and can be used by designers, developers, and creative professionals for personal and commercial projects. Refer billow links and do create creativity in your design.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Typography&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;a href="https://fonts.google.com/"&gt;font.google.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Google Fonts is a free and open-source resource that offers a vast collection of fonts optimized for web use, which can be easily integrated into websites and other design projects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;a href="https://www.dafont.com/"&gt;dafont.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Dafont.com offers free fonts for personal use, but it's important to check the license of each font before using it for commercial projects, as some fonts may have restrictions on commercial use.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;a href="https://www.fontshare.com/"&gt;fontshare.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fontshare.com offers a collection of free and open-source fonts for personal and commercial use without restrictions, created by independent designers from around the world.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;a href="https://www.fontsquirrel.com/"&gt;fontsquirrel.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fontsquirrel.com offers a large collection of high-quality, free fonts licensed for commercial use.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;5. &lt;a href="https://www.cufonfonts.com/"&gt;cufonfonts.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Cufonfonts.com offers a large collection of free and paid fonts for personal and commercial use, but it's important to check the license of each font before using it for commercial projects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;6.&lt;a href="https://www.fontspace.com/"&gt;fontspace.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fontspace.com is a website that offers a large collection of free fonts for personal and commercial use, with an easy-to-use interface for searching and downloading fonts in various formats.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;Images&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;a href="https://unsplash.com/"&gt;unsplash.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Unsplash.com provides a large library of high-quality, royalty-free stock photos for personal and commercial use, with no attribution required and an active community of contributors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;a href="https://www.pexels.com/"&gt;pexels.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Pexels.com provides a large library of high-quality, royalty-free stock photos and videos for personal and commercial use, with no attribution required and an active community of contributors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;a href="https://pixabay.com/"&gt;pixabay.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Pixabay.com provides a vast collection of high-quality, royalty-free stock photos, illustrations, vectors, and videos, which can be used for personal and commercial projects without attribution, with a user-friendly search interface and an active community of contributors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;a href="https://www.freepik.com/"&gt;freepik.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Freepik.com is a website that offers a large collection of free and premium design resources, including vectors, illustrations, icons, PSD files, and photos, with free resources available for personal and commercial use with attribution and premium resources available through a paid subscription.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;5.&lt;a href="https://kaboompics.com/"&gt;kaboompics.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Kaboompics.com is a website that provides a large collection of high-quality, royalty-free stock photos, including lifestyle, food, travel, and fashion photography, which can be used for personal and commercial projects without attribution, with a simple and user-friendly interface for searching and downloading photos.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;6.&lt;a href="https://www.freeimages.com/"&gt;freeimages.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Stock.xchng (SXC) was a website that provided free-to-use stock photography and illustrations, founded in 2001 by Peter Hamza, which was later acquired by Getty Images and rebranded as "FreeImages.com" before being shut down in 2019.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;Mockups&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;a href="https://www.mockupworld.co/"&gt;mockupworld.co&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Mockupworld.co provides a variety of free mockup templates for personal and commercial use, spanning stationery, packaging, and device mockups.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;a href="https://unblast.com/"&gt;unblast.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Unblast.com provides a comprehensive range of free and premium design resources, including mockups, templates, icons, and graphics, for personal and commercial use.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;a href="https://www.pixeden.com/"&gt;pixeden.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Pixeden.com is a website that provides a variety of design resources, including mockups, graphics, templates, and icons, which can be used for personal and commercial projects through a free or paid membership.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;a href="https://previewed.app/"&gt;previewed.app&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Previewed.app is a website that offers free design resources, including mockups, templates, graphics, and fonts, which can be used for personal and commercial projects, with new resources added daily.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;5.&lt;a href="https://mockups-design.com/"&gt;mockups-design.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Mockups-design.com is a website that offers a variety of free and premium mockup templates for personal and commercial use, with a focus on high-quality and photorealistic mockups for a wide range of design projects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;6.&lt;a href="https://www.ls.graphics/"&gt;ls.graphics&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;LS.graphics is a website that offers a range of free and premium design resources, including mockups, templates, illustrations, and textures, which can be used for personal and commercial projects, with new resources added regularly.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;Icon&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;a href="http://iconsax.io/"&gt;iconsax.io&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Iconsax.io is a website that provides a collection of high-quality, customizable icons that can be used for personal and commercial projects, with both free and paid plans available.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;a href="https://icons8.com/"&gt;icons8.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Icons8.com is a website that offers a large library of free icons, illustrations, and photos, as well as premium design assets, which can be used for personal and commercial projects with proper attribution or through a paid subscription.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;a href="https://feathericons.com/"&gt;feathericons.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Feathericons.com is a website that offers a collection of open-source icons that can be used for personal and commercial projects, with an easy-to-use interface for browsing and downloading icons in various formats.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;a href="https://iconscout.com/free-icons"&gt;iconscout.com/free-icons&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Iconscout.com/free-icons is a website that offers a vast collection of free icons, illustrations, and stock photos, which can be used for personal and commercial projects with proper attribution, as well as premium design assets available through a paid subscription.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;5.&lt;a href="https://thenounproject.com/"&gt;thenounproject.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thenounproject.com is a website that provides a large collection of high-quality, customizable icons, with both free and paid plans available for personal and commercial use, as well as an easy-to-use interface for searching and downloading icons in various formats.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;Illustrations&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;a href="https://opendoodles.com/"&gt;opendoodles.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Opendoodles.com is a website that provides a collection of open-source illustrations that can be used for personal or commercial projects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;a href="https://undraw.co/"&gt;undraw.co&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Undraw.co is a website that provides a collection of open-source illustrations that can be used for personal or commercial projects, with the ability to change the color of the illustrations to match the user's needs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;a href="https://www.drawkit.com/"&gt;drawkit.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Drawkit.com is a website that provides a collection of customizable vector illustrations, icons, and elements that can be used for personal or commercial projects, with a focus on simple and clean designs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;a href="https://icons8.com/illustrations"&gt;icons8.com/illustrations&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Icons8.com/illustrations is a website that offers a wide range of vector illustrations and 3D designs in various styles and formats that can be used for personal or commercial projects, with the ability to customize colors, sizes, and formats.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;5.&lt;a href="https://humaaans.com/"&gt;humaaans.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Humaaans.com is a website that provides a collection of customizable vector illustrations of people, with the ability to mix and match different body parts, clothing, and accessories to create unique characters that can be used for personal or commercial projects.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;Colors&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;a href="https://coolors.co/"&gt;coolors.co&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Coolors.co is a color scheme generator and palette tool that allows designers to create and customize color palettes, providing additional features such as color blindness simulation, accessibility checks, and export of color codes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;a href="https://www.khroma.co/"&gt;khroma.co&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Khroma.co is a website that provides an AI-powered color palette generator that suggests unique and personalized color schemes based on user preferences and selections.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;a href="https://colorhunt.co/"&gt;colorhunt.co&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Colorhunt.co is a website that provides a curated collection of color palettes created by designers and artists, allowing users to explore and use different color schemes for their projects. The website also allows users to create and save their own color palettes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;a href="https://colors.dopely.top/"&gt;colors.dopely.top&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;colors.dopely.top is a website that offers a curated collection of color palettes with the ability to browse and copy hex codes for use in design projects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;5.&lt;a href="https://colors.muz.li/"&gt;colors.muz.li&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Colors.muz.li is a website that provides a curated collection of color palettes created by designers and artists, with the ability to explore and use different color schemes for inspiration in design projects. The website also includes other design resources and tools.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;6.&lt;a href="https://flatuicolors.com/"&gt;flatuicolors.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Flatuicolors.com is a website that provides a collection of flat UI color palettes that can be used in web design and mobile app development, with the ability to copy the hex codes for each color in the palette.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>design</category>
      <category>ux</category>
      <category>uidesign</category>
      <category>beginners</category>
    </item>
    <item>
      <title>13 Rules I Follow When Writing CSS To Make It Concise and Readable🚀💡</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Sun, 23 Apr 2023 08:28:55 +0000</pubDate>
      <link>https://dev.to/margishpatel/13-rules-i-follow-when-writing-css-to-make-it-concise-and-readable-2jkn</link>
      <guid>https://dev.to/margishpatel/13-rules-i-follow-when-writing-css-to-make-it-concise-and-readable-2jkn</guid>
      <description>&lt;p&gt;Here are 13 rules that can be followed when writing CSS to make it more concise and readable:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Use a preprocessor:&lt;/strong&gt; Use a CSS preprocessor such as SASS or LESS, which allows you to use variables, functions, and nested rules, making your CSS more modular and easier to maintain.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$primary-color: #011A52;
$secondary-color: #990000;

body {
  background-color: $primary-color;
  color: $secondary-color;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;2. Use a style guide:&lt;/strong&gt; Use a style guide such as SMACSS or BEM, which provides a consistent structure for your CSS.&lt;br&gt;
HTML&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="card"&amp;gt;
  &amp;lt;div class="card__header"&amp;gt;
    &amp;lt;h2 class="card__title"&amp;gt;Card Title&amp;lt;/h2&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="card__body"&amp;gt;
    &amp;lt;p class="card__text"&amp;gt;Card Text&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="card__footer"&amp;gt;
    &amp;lt;a href="#" class="card__link card__link--primary"&amp;gt;Primary Link&amp;lt;/a&amp;gt;
    &amp;lt;a href="#" class="card__link card__link--secondary"&amp;gt;Secondary Link&amp;lt;/a&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Blocks:&lt;/strong&gt; &lt;code&gt;.block&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Elements:&lt;/strong&gt; &lt;code&gt;.block__element&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modifiers:&lt;/strong&gt; &lt;code&gt;.block__element--modifier&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.card {
  background-color: #ffffff;
  border: 1px solid #cccccc;
  padding: 10px;
}

.card__header {
  margin-bottom: 10px;
}

.card__title {
  font-size: 1.5em;
  margin: 0;
}

.card__body {
  padding: 10px;
}

.card__text {
  font-size: 1.2em;
  margin: 0;
}

.card__footer {
  margin-top: 10px;
}

.card__link {
  color: #333333;
  text-decoration: none;
  margin-right: 10px;
}

.card__link--primary {
  color: #ffffff;
  background-color: #336699;
  padding: 5px 10px;
  border-radius: 5px;
}

.card__link--secondary {
  border: 1px solid #336699;
  padding: 5px 10px;
  border-radius: 5px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;4. Use CSS classes:&lt;/strong&gt; Avoid using element selectors and instead, use classes to target specific elements. This makes it easier to reuse styles across different elements.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;5. Keep it organized:&lt;/strong&gt; Use a consistent naming convention and organize your CSS into sections such as base styles, layout, and modules.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;6. Avoid !important:&lt;/strong&gt; Avoid using the !important keyword, as it can make it harder to override styles later.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;7. Be mindful of specificity:&lt;/strong&gt; Be mindful of the specificity of selectors, as this can affect which styles are applied to elements.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;8. Use shorthand:&lt;/strong&gt; Use shorthand properties such as padding, margin, and font to make your CSS more concise.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;font: 700 16px/1.5 'Roboto', sans-serif;
margin: 40px 0 20px;
padding: 10px 20px;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;9. Use CSS variables:&lt;/strong&gt; Use CSS variables to store values that are used throughout the stylesheet, such as colors and fonts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Variables */
:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --font-family: 'Roboto', sans-serif;
}

/* Typography */
body {
  font: 16px/1.5 var(--font-family);
  color: var(--secondary-color);
}

h1{
  font: bold 32px/1.2 var(--font-family);
  margin: 40px 0 20px;
}

/* Button Variations */
button{
  background-color: var(--primary-color);
  color: var(--secondary-color);
  font: bold 16px/1.5 var(--font-family);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;10. Minimize nesting:&lt;/strong&gt; Minimize the use of nesting in your CSS, as this can make it harder to understand the relationships between elements.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;11. Use comments:&lt;/strong&gt; Use comments to explain the purpose of different sections of your CSS and to help other developers understand your code.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;12. Use a linter:&lt;/strong&gt; Using a linter such as Stylelint can help enforce good coding practices, identify errors in your CSS, and assist in fixing them.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;13. Use a framework:&lt;/strong&gt; Use a CSS framework such as Bootstrap or Foundation, which provides a set of pre-built styles and components that can be used to quickly create a professional-looking website.&lt;/p&gt;




&lt;p&gt;Keep your CSS simple and avoid over-engineering solutions. The simpler your CSS is, the easier it will be to maintain and understand.&lt;/p&gt;

&lt;p&gt;By following these rules, your CSS will be more concise and readable, which makes it easier to maintain and collaborate on projects.&lt;/p&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>css</category>
      <category>frontend</category>
      <category>performance</category>
    </item>
    <item>
      <title>What is Flexbox in CSS?💡</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Tue, 11 Apr 2023 09:12:43 +0000</pubDate>
      <link>https://dev.to/margishpatel/beginners-guide-to-flexbox-2hco</link>
      <guid>https://dev.to/margishpatel/beginners-guide-to-flexbox-2hco</guid>
      <description>&lt;p&gt;Flexbox is a layout system in CSS that allows for flexible and responsive design without relying on float, positioning, or other layout techniques. It simplifies the creation of complex layouts and is especially useful for building user interfaces and responsive designs. Here is a beginner's guide to flexbox:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Understanding the Flex Container and Flex Items&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To use Flexbox, you must first create a flex container by setting the &lt;code&gt;'display'&lt;/code&gt; property of an element to 'flex. Once an element is a flex container, its child elements become flex items. Flex items can be aligned, ordered, and sized within the flex container using Flexbox properties.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;2) Flexbox Properties&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here are some of the most commonly used Flexbox properties:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;'justify-content'&lt;/code&gt;: aligns flex items horizontally within the container.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'align-items'&lt;/code&gt;: aligns flex items vertically within the container.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'flex-direction'&lt;/code&gt;: sets the direction of the main axis of the flex container.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'flex-wrap'&lt;/code&gt;: controls whether flex items should wrap to multiple lines if there is not enough space in the container.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'flex-grow'&lt;/code&gt;: determines how much a flex item should grow relative to other flex items in the container.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'flex-shrink'&lt;/code&gt;: determines how much a flex item should shrink relative to other flex items in the container.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'flex-basis'&lt;/code&gt;: specifies the initial size of a flex item before any remaining space is distributed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'align-self'&lt;/code&gt;: allows individual flex items to override the &lt;code&gt;'align-items'&lt;/code&gt; property.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;3) Creating a Basic Flex Layout&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To create a basic flex layout, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a container element and set the &lt;code&gt;'display'&lt;/code&gt; property to &lt;code&gt;'flex'&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Set the &lt;code&gt;'flex-direction'&lt;/code&gt; property to determine the main axis of the container. The default value is row, which means the main axis runs horizontally. You can also set it to &lt;code&gt;'column'&lt;/code&gt; for a vertical main axis.&lt;/li&gt;
&lt;li&gt;Add child elements to the container, which become the flex items.&lt;/li&gt;
&lt;li&gt;Use Flexbox properties such as &lt;code&gt;'justify-content'&lt;/code&gt;, &lt;code&gt;'align-items'&lt;/code&gt;, and &lt;code&gt;'flex-wrap'&lt;/code&gt; to position and style the flex items within the container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's an example of a basic flex layout:&lt;br&gt;
HTML:&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="flex-container"&amp;gt;
  &amp;lt;div class="flex-item"&amp;gt;Item 1&amp;lt;/div&amp;gt;
  &amp;lt;div class="flex-item"&amp;gt;Item 2&amp;lt;/div&amp;gt;
  &amp;lt;div class="flex-item"&amp;gt;Item 3&amp;lt;/div&amp;gt;
  &amp;lt;div class="flex-item"&amp;gt;Item 4&amp;lt;/div&amp;gt;
  &amp;lt;div class="flex-item"&amp;gt;Item 5&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.flex-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-item {
  background-color: #9e9898;
  color: #ffffff;
  padding: 10px;
  margin: 10px;
  text-align: center;
  font-size: 24px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0fvbbbpwyfl4zga67eir.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0fvbbbpwyfl4zga67eir.PNG" alt="Image description" width="744" height="326"&gt;&lt;/a&gt;&lt;br&gt;
In this example, the container is set to &lt;code&gt;'display: flex'&lt;/code&gt; and the &lt;code&gt;'justify-content'&lt;/code&gt; and &lt;code&gt;'align-items'&lt;/code&gt; properties are used to center the items horizontally and vertically. The &lt;code&gt;'flex-item'&lt;/code&gt; class is applied to each item, and its styles determine the background color, font color, padding, margin, text alignment, and font size.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;4) Conclusion&lt;/strong&gt;&lt;br&gt;
Flexbox is a powerful tool for creating flexible and responsive layouts. By understanding the basics of the flex container and flex items, and using Flexbox properties effectively, you can easily create complex and dynamic layouts that work on any device.&lt;/p&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;/p&gt;

&lt;p&gt;Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>css</category>
      <category>html</category>
      <category>web</category>
    </item>
    <item>
      <title>How to make your HTML responsive using display grid. 💯✅</title>
      <dc:creator>margishpatel</dc:creator>
      <pubDate>Fri, 07 Apr 2023 04:43:04 +0000</pubDate>
      <link>https://dev.to/margishpatel/how-to-make-your-html-responsive-using-display-grid-1fj</link>
      <guid>https://dev.to/margishpatel/how-to-make-your-html-responsive-using-display-grid-1fj</guid>
      <description>&lt;p&gt;To make your HTML responsive using display grid, you can follow these steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Define the grid container:&lt;/strong&gt; First, define the container element that will hold your grid using the &lt;code&gt;display: grid&lt;/code&gt; property. This will enable the grid layout.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set the grid template columns and rows:&lt;/strong&gt; Next, set the grid template columns and rows using the &lt;code&gt;grid-template-columns&lt;/code&gt; and &lt;code&gt;grid-template-rows&lt;/code&gt; properties. These properties allow you to specify how many columns and rows the grid should have, as well as their size and spacing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Place grid items:&lt;/strong&gt; After defining the grid template columns and rows, you can place your grid items using the &lt;code&gt;grid-column&lt;/code&gt; and &lt;code&gt;grid-row&lt;/code&gt; properties. These properties allow you to specify which cells your items should span across.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use media queries:&lt;/strong&gt; Finally, to make your grid responsive, you can use media queries to adjust the grid layout based on the screen size. You can use the &lt;a class="mentioned-user" href="https://dev.to/media"&gt;@media&lt;/a&gt; rule to set different grid properties at different breakpoints, such as changing the number of columns or their size.&lt;/p&gt;

&lt;p&gt;Here's an example code snippet that demonstrates how to create a simple responsive grid layout:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto;
  grid-gap: 20px;
}

.item {
  background-color: #ddd;
  padding: 20px;
  text-align: center;
}

@media screen and (max-width: 768px) {
  .container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 480px) {
  .container {
    grid-template-columns: 1fr;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93w63h6xjnzmmk6d9rjk.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93w63h6xjnzmmk6d9rjk.gif" alt="Image description" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, the .container element is set to &lt;code&gt;display: grid&lt;/code&gt; and has three columns with a gap of 20px between them. The .item elements are placed within the grid using the &lt;code&gt;grid-colum&lt;/code&gt;n and &lt;code&gt;grid-row&lt;/code&gt; properties.&lt;/p&gt;

&lt;p&gt;Then, two media queries are used to adjust the grid layout at different screen sizes. When the screen size is less than or equal to &lt;code&gt;768px&lt;/code&gt;, the grid is set to have two columns instead of three. And when the screen size is less than or equal to &lt;code&gt;480px&lt;/code&gt;, the grid is set to have only one column. This allows the grid to adapt and remain responsive on different devices and screen sizes.&lt;/p&gt;

&lt;p&gt;Hope you like it.&lt;/p&gt;

&lt;p&gt;That’s it — thanks.&lt;/p&gt;

&lt;p&gt;To read my other articles &lt;a href="https://dev.to/margishpatel"&gt;click here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/margishpatel/beginners-guide-to-flexbox-2hco"&gt;What is Flexbox : A Beginner's Guide to Flexbox CSS Layouts&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;👋Hey there, Let’s connect on:&lt;br&gt;
Linkdin: &lt;a href="https://www.linkedin.com/in/margish-patel-63843b1b5"&gt;Margish Patel&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&amp;amp;s=09"&gt;@margish96patel&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="//babariyamargish97@gmail.com"&gt;babariyamargish97@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>css</category>
      <category>html</category>
      <category>web</category>
    </item>
  </channel>
</rss>
