<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chirag Prajapati on Medium]]></title>
        <description><![CDATA[Stories by Chirag Prajapati on Medium]]></description>
        <link>https://medium.com/@chirag-p?source=rss-75202af3dd59------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IV9rPW3MHgflcvMvPkjyow.jpeg</url>
            <title>Stories by Chirag Prajapati on Medium</title>
            <link>https://medium.com/@chirag-p?source=rss-75202af3dd59------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 13:16:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chirag-p/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Secret Power of meta.load-css(): A Sass Upgrade Survival Story]]></title>
            <link>https://medium.com/@chirag-p/the-secret-power-of-meta-load-css-a-sass-upgrade-survival-story-e769b49868c0?source=rss-75202af3dd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/e769b49868c0</guid>
            <category><![CDATA[scss]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[sass]]></category>
            <category><![CDATA[angular-19]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Chirag Prajapati]]></dc:creator>
            <pubDate>Fri, 15 Aug 2025 19:24:21 GMT</pubDate>
            <atom:updated>2025-08-15T19:24:21.027Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eWltzU24VdCbybMF" /><figcaption>Photo by <a href="https://unsplash.com/@alterego_swiss?utm_source=medium&amp;utm_medium=referral">AbsolutVision</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>While upgrading my Angular project from version 18 to 19, I ran into a frustrating barrier. Sass started throwing warnings about the deprecation of @import, urging me to switch to the new module system with @use and @forward .</p><pre>DEPRECATION WARNING: Using /path/to/file.scss with @import is deprecated and will be removed in Dart Sass 2.0.0. Use @use instead.</pre><p>So I did as told, replacing @import with @use and following the modern Sass recommendations. But soon, a new headache emerged. Unlike the old import, @use could only be placed at the top of the file, not inside the specific selectors where I wanted it. Suddenly, styles from third-party libraries started leaking everywhere and colliding with my own designs not ideal, especially since my code is reused in other sites.</p><p>My first instinct was to try prefixing everything using <strong>PostCSS</strong> to namespace the CSS, but that didn’t work as expected. The more I tried to fix it, the more I felt like I was making it worse. For a while, I was stuck, unsure if there was even a clean solution.</p><p>Then one day, while browsing Medium, a clickbait title about advanced Sass tricks caught my attention. The blog wasn’t a direct solution, but it made me curious enough to dive into the Sass docs again. That’s when I stumbled upon the <a href="https://sass-lang.com/documentation/modules/meta/">sass:meta</a> module. something I had never paid attention to before. Buried in the documentation was this gem:</p><pre>@use &quot;sass:meta&quot;;<br><br>.my-component {<br>  @include meta.load-css(&quot;path/to/third-party-library&quot;);<br>}</pre><p>It was exactly what I needed. meta.load-css() allowed me to load third-party styles in a controlled way, keeping them scoped so they wouldn’t interfere with the rest of my project. It was like having the best of both worlds: the new @use syntax without the unwanted global style pollution.</p><p>After implementing it, my CSS was back under control, the Angular 19 upgrade was complete. and I learned an important lesson. sometimes the answer isn’t in the first blog you read or the first error message you see. Sometimes it’s hiding in a part of the documentation you didn’t even know existed. And in my case, it was hiding in sass:meta.</p><p>Thank you! Happy coding 👨‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e769b49868c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Made Simple: A Beginner’s Guide to Its Evolution]]></title>
            <link>https://medium.com/@chirag-p/ai-made-simple-a-beginners-guide-to-its-evolution-e2050c77ab5f?source=rss-75202af3dd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2050c77ab5f</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai-guide]]></category>
            <dc:creator><![CDATA[Chirag Prajapati]]></dc:creator>
            <pubDate>Thu, 25 Apr 2024 10:55:59 GMT</pubDate>
            <atom:updated>2024-04-25T10:55:59.984Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xrZ_vQ8rcoQiG-k8.jpg" /></figure><p>Artificial Intelligence (AI) is a cutting-edge field driving big changes in our world. It’s transforming industries, changing how we use technology, and even affecting our everyday lives. But what is AI, really? Essentially, it’s about making machines smart enough to learn, reason, and make decisions on their own, just like humans do. As we look back at how AI has evolved over time, we discover a captivating journey filled with important moments, breakthroughs, and the ongoing effort to create machines that think, learn, and maybe even help us out in new ways.</p><p>Here’s a breakdown of the key points:</p><h3>What is AI?</h3><p>Artificial Intelligence (AI) refers to the simulation of human intelligence processes by machines, especially computer systems. These processes include learning, reasoning and self-correction. AI encompasses a wide range of technologies and applications, from machine learning and natural language processing to robotics and computer vision.</p><p>The goal of AI is to develop systems that can perform tasks that typically require human intelligence, such as understanding natural language, recognizing patterns in data, making decisions, and solving problems. AI systems learn from data, adapt to new inputs, and improve over time, often surpassing human capabilities in specific domains.</p><p>AI has become increasingly pervasive in our daily lives, powering virtual assistants like <strong>Siri </strong>and <strong>Alexa</strong>, recommending products on e-commerce websites, detecting fraud in financial transactions, diagnosing diseases in healthcare, driving autonomous vehicles, and much more. As AI continues to advance, it holds the promise of revolutionizing industries, improving efficiency, enhancing decision-making, and solving complex problems facing society.</p><h3>Importance of AI in today’s world</h3><p>In today’s dynamic landscape, AI stands as the beacon of innovation, igniting transformative change across industries. Here’s why it’s absolutely essential:</p><p>🚀 <strong>Efficiency Overdrive</strong>: AI enables automation of repetitive tasks across various industries, leading to increased efficiency and productivity. This allows humans to focus on more creative, strategic, and high-value work.</p><p>🔍 <strong>Insightful Wisdom</strong>: AI systems can analyze vast amounts of data and provide valuable insights to aid decision-making processes. From business analytics to healthcare diagnostics, AI helps in making informed and timely decisions.</p><p>🎨<strong> Tailored Experiences:</strong> : AI algorithms can personalize user experiences by analyzing individual preferences and behaviors. This enhances customer satisfaction, increases engagement, and drives business growth in sectors like e-commerce, content recommendation, and marketing.</p><p>🔮 <strong>Predictive Analytics</strong>:AI’s predictive capabilities help businesses anticipate trends, <a href="https://www.netsuite.com/portal/resource/articles/inventory-management/demand-forecasting.shtml#:~:text=Demand%20forecasting%20is%20used%20to,for%20creating%20and%20improving%20forecasts.">forecast demand</a>, and identify potential risks.</p><p>⚕️<strong> Healthcare Renaissance:</strong> AI is revolutionizing healthcare by assisting in disease diagnosis, drug discovery, personalized treatment plans, and patient care. From medical imaging to wearable devices, AI technologies are enhancing patient outcomes and reducing healthcare costs.</p><p>🤖 <strong>Autonomous Marvels:</strong> AI powers autonomous vehicles, drones, robots, transforming transportation, logistics, and manufacturing. These autonomous systems improve safety, efficiency, and reliability while opening up new possibilities for innovation and exploration.</p><p>💬 <strong>Language of Connection:</strong> AI-driven natural language processing (NLP) technologies enable seamless communication between humans and machines like Virtual assistants, chatbots, and language translation tools.</p><p>🌱 <strong>Green Tech Crusader</strong>: AI is being used to optimize energy consumption, manage natural resources, and mitigate environmental risks.</p><h3>Types of AI</h3><figure><img alt="https://www.ebizneeds.com/blog/artificial-intelligence-types-and-technologies/" src="https://cdn-images-1.medium.com/max/1024/0*D7Tf0YS8gsB3DKXB.jpg" /></figure><h4><strong>Narrow AI</strong>:</h4><p><em>Narrow AI</em> refers to AI systems that are designed and trained for a specific task or a narrow range of tasks autonomously using human-like capabilities. They excel in performing specific tasks but lack the ability to generalize beyond their predefined functions.<br>Examples include virtual personal assistants like <strong><em>Siri </em></strong>and <strong><em>Alexa</em></strong>, as well as image recognition systems.</p><h4><strong>General AI</strong></h4><p>also known as <strong><em>strong AI</em></strong> or <strong><em>AGI </em></strong>(Artificial General Intelligence), refers to AI systems that possess the ability to understand, learn, and apply intelligence across a wide range of tasks similar to human intelligence. AGI remains hypothetical and is a subject of ongoing research.</p><h4><strong>Superintelligent AI</strong></h4><p>Superintelligent AI refers to AI systems that surpass human intelligence across all domains and activities. This level of AI is purely theoretical and raises significant ethical and existential concerns.</p><h4>Reactive Machine AI</h4><p>this refers to a type of artificial intelligence that operates based on predefined rules and does not incorporate learning or adaptation. They can respond to immediate requests and tasks, but they aren’t capable of storing memory, learning from past experiences or improving their functionality through experiences.</p><p>IBM’s <strong>Deep Blue system</strong> and google’s <strong>AlphaGo</strong></p><h4>Limited Memory AI</h4><p>Limited memory AI can store past data and use that data to make predictions. This means it actively builds its own limited, short-term knowledge base and performs tasks based on that knowledge.</p><p><strong>Self-driving cars </strong>are one of the best examples of Limited Memory systems. These cars can store recent speed of nearby cars, the distance of other cars, speed limit, and other information to navigate the road.</p><h4>Theory of Mind</h4><p>Theory of mind refers to the concept of AI that can perceive and pick up on the <a href="https://builtin.com/artificial-intelligence/emotion-ai">emotions</a> of others. The term is borrowed from psychology, describing humans’ ability to read the emotions of others and predict future actions based on that information. Theory of mind hasn’t been fully realized yet, and stands as the next substantial milestone in AI’s development.</p><h4>Self aware AI</h4><p>Referred to as the AI point of <a href="https://builtin.com/artificial-intelligence/technological-singularity">singularity</a>, self-aware AI is the stage beyond theory of mind and is one of the ultimate goals in AI development. It’s thought that once self-aware AI is reached, AI machines will be beyond our control, because they’ll not only be able to sense the feelings of others, but will have a sense of self as well.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXFZ-rQ8eeR8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXFZ-rQ8eeR8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXFZ-rQ8eeR8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/706039d0977f111fe5f08fbadc216edf/href">https://medium.com/media/706039d0977f111fe5f08fbadc216edf/href</a></iframe><h3>History of AI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*f_-wNrc_7T_a1llMCO-ryg.png" /></figure><h4>Groundwork for AI</h4><p>1900–1950 In the early 1900s, there was a lot of media created that centered around the idea of artificial humans. So much so that scientists of all sorts started asking the question: is it possible to create an artificial brain? Some creators even made some versions of what we now call “<strong>robots</strong>” (and the word was coined in a Czech play in 1921) though most of them were relatively simple.</p><ul><li><strong>1921</strong>: Karel Čapek’s play “<strong>Rossum’s Universal Robots</strong>” introduces the term “<strong><em>robot</em></strong>”, sparking discussions about artificial beings.</li><li><strong>1929</strong>: Makoto Nishimura constructs <strong><em>Gakutensoku</em></strong>, marking the inception of Japanese robotics and early exploration into humanoid machines.</li></ul><h4>Birth of AI</h4><ul><li><strong>1950:</strong> Alan Turing’s publication of “Computer Machinery and Intelligence” introduces the concept of The Imitation Game, serving as a benchmark for machine intelligence.</li><li><strong>1952:</strong> Arthur Samuel’s creation of a checkers-playing program marks a significant milestone as the first instance of machine learning.</li><li><strong>1955:</strong> John McCarthy’s Dartmouth workshop on “artificial intelligence” not only coins the term but also catalyzes the field’s emergence into popular discourse, shaping its future trajectory.</li></ul><h4>AI maturation</h4><ul><li><strong>1958:</strong> John McCarthy created <a href="https://www.britannica.com/technology/LISP-computer-language"><strong>LISP</strong></a><strong> </strong>(acronym for List Processing), the first programming language for AI research, which is still in popular use to this day.</li><li><strong>1959:</strong> Arthur Samuel created the term “<a href="http://infolab.stanford.edu/pub/voy/museum/samuel.html"><strong>machine learning</strong></a>” when doing a speech about teaching machines to play chess better than the humans who programmed them.</li><li><strong>1961:</strong> The first industrial robot <a href="https://robots.ieee.org/robots/unimate/"><strong>Unimate</strong></a><strong> </strong>started working on an assembly line at General Motors in New Jersey, tasked with transporting die casings and welding parts on cars.</li><li><strong>1965:</strong> Edward Feigenbaum and Joshua Lederberg created the first “<a href="https://www.computer.org/profiles/edward-feigenbaum"><strong>expert system</strong></a>” which was a form of AI programmed to replicate the thinking and decision-making abilities of human experts.</li><li><strong>1966:</strong> Joseph Weizenbaum created the first “<strong>chatterbot</strong>” (later shortened to chatbot), <a href="https://analyticsindiamag.com/story-eliza-first-chatbot-developed-1966/">ELIZA</a>, a mock psychotherapist, that used natural language processing (NLP) to converse with humans.</li><li><strong>1968</strong>: Soviet mathematician Alexey Ivakhnenko published “<strong>Group Method of Data Handling</strong>” in the journal “<strong>Avtomatika</strong>,” which proposed a new approach to AI that would later become what we now know as “<strong>Deep Learning</strong>.”</li><li><strong>1973:</strong> An applied mathematician named<strong> </strong><a href="https://www.britannica.com/biography/James-Lighthill"><strong>James Lighthill</strong></a> gave a report to the British Science Council, underlining that strides were not as impressive as those that had been promised by scientists, which led to much-reduced support and funding for AI research from the British government.</li><li><strong>1979:</strong> James Adams created <a href="https://web.stanford.edu/~learnest/sail/oldcart.html"><strong>The Standford Cart</strong></a> in 1961, which became one of the first examples of an <strong><em>autonomous vehicle</em></strong>. In ’79, it successfully navigated a room full of chairs without human interference.</li><li><strong>1979:</strong> The American Association of Artificial Intelligence which is now known as the <a href="http://aaai.org/"><strong>Association for the Advancement of Artificial Intelligence</strong></a> (AAAI) was founded. later in 1980, The first conference takes place at Stanford, providing a platform for researchers to share insights and advancements in AI.</li></ul><h4>AI boom</h4><ul><li><strong>1981:</strong> The Japanese government allocates a substantial budget of $850 million to the ambitious <strong>Fifth Generation Computer</strong> project. The project aims to develop computers capable of human-level translation, conversation, and reasoning.</li><li><strong>1984: </strong>The AAAI issues a warning about an impending “AI Winter,” forecasting a decline in funding and interest that could impede AI research progress.</li><li><strong>1986: Ernst </strong>and his team at Bundeswehr University of <strong>Munich </strong>created and demonstrated the <a href="https://www.politico.eu/article/delf-driving-car-born-1986-ernst-dickmanns-mercedes/">first driverless car</a> . It could drive up to 55 mph on roads that didn’t have other obstacles or human drivers.</li></ul><h4>AI winter</h4><ul><li><strong>1987:</strong> The <a href="https://www.federalreserve.gov/pubs/feds/2007/200713/200713pap.pdf">market for specialized LISP-based hardware collapsed</a> due to cheaper and more accessible competitors that could run LISP software, including those offered by IBM and Apple.</li><li><strong>1988: </strong>A computer programmer named <a href="https://www.yourtechstory.com/2019/11/13/success-story-of-cleverbot/">Rollo Carpenter invented the chatbot Jabberwacky</a>.</li></ul><h4>AI agents</h4><ul><li><strong>1997:</strong> <a href="https://www.ibm.com/ibm/history/ibm100/us/en/icons/deepblue/">Deep Blue</a> (developed by IBM) beat the world chess champion, Gary Kasparov, in a highly-publicized match, becoming the first program to beat a human chess champion.</li><li><strong>2000:</strong> Professor Cynthia Breazeal developed the first robot that could simulate human emotions with its face. It was called <a href="https://news.mit.edu/2001/kismet"><strong>Kismet</strong></a>.</li><li><strong>2003:</strong> <strong>NASA’</strong>s<strong> </strong>rovers explore Mars autonomously, demonstrating AI’s applications in space exploration.</li><li><strong>2011:</strong> An NLP computer programmed to answer questions named <a href="https://www.ibm.com/ibm/history/ibm100/us/en/icons/watson/">Watson</a> (created by IBM) won Jeopardy against two former champions in a televised game.</li></ul><h4>Artificial General Intelligence</h4><ul><li><strong>2012:</strong> Google trains a <strong>neural network</strong> to recognize cats from unlabeled images, showcasing advancements in deep learning.</li><li><strong>2016:</strong> <a href="https://www.hansonrobotics.com/sophia/"><strong>Sophia</strong></a>, a humanoid robot developed by Hanson Robotics, becomes the first robot citizen, showcasing advancements in robotics and AI.</li><li><strong>2020:</strong> <a href="https://openai.com/"><strong>OpenAI</strong></a><strong> </strong>launches <a href="https://openai.com/blog/gpt-3-apps"><strong>GPT-3</strong></a>, a highly advanced language model capable of generating human-like text, marking significant progress in natural language understanding and generation.</li></ul><h3>References</h3><ul><li><strong>Types of AI</strong>: <a href="https://m.mage.ai/mage-q-a-what-are-the-different-types-of-artificial-intelligence-ai-258b280fb6e1">https://m.mage.ai/mage-q-a-what-are-the-different-types-of-artificial-intelligence-ai-258b280fb6e1</a><br>- <a href="https://www.edureka.co/blog/types-of-artificial-intelligence/">https://www.edureka.co/blog/types-of-artificial-intelligence/</a></li><li><strong>History of AI: </strong><a href="https://www.tableau.com/data-insights/ai/history">https://www.tableau.com/data-insights/ai/history</a></li></ul><h3>Conclusion</h3><p>In conclusion, AI continues to shape the future of humanity, offering immense potential to solve complex problems, improve quality of life, and drive social-economic progress. As AI technologies evolve and mature, it is essential to foster responsible development, address ethical considerations, and ensure inclusive benefits for all stakeholders.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2050c77ab5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhancing Security with Role-Based Access Control (Nest.js)]]></title>
            <link>https://javascript.plainenglish.io/enhancing-security-with-role-based-access-control-nest-js-2f55b5e66516?source=rss-75202af3dd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f55b5e66516</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[rbac]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[nestjs-guards]]></category>
            <dc:creator><![CDATA[Chirag Prajapati]]></dc:creator>
            <pubDate>Tue, 19 Mar 2024 06:13:42 GMT</pubDate>
            <atom:updated>2024-03-21T00:35:29.504Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iaEgq6FfTk-c12ZR" /><figcaption>Photo by <a href="https://unsplash.com/@zyangdev?utm_source=medium&amp;utm_medium=referral">Zheng Yang</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Role-Based Access Control (RBAC) is a method of restricting network access based on the roles of individual users within an enterprise. It’s a robust security measure commonly implemented in backend systems to ensure that only authorized users can access specific resources or perform certain actions within an application or system. This reduces the risk of data breaches and unauthorized access 🔐to critical systems.</p><p>Authorization is orthogonal and independent of authentication. However, authorization requires an authentication mechanism.</p><p>In order to implement RBAC, it is important to define the roles and permissions that will be used within your application. Roles are typically high-level categories that represent a group of users, while permissions define the specific actions that users with a particular role can perform.</p><pre>export enum Role {<br>  User = &#39;user&#39;,<br>  Admin = &#39;admin&#39;,<br>}</pre><p>Now we need to create custom @Roles() decorator. with help of decorator we can specifying what are roles are required to acess specific resources.</p><pre><br>import { SetMetadata } from &#39;@nestjs/common&#39;;<br>import { Role } from &#39;../enums/role.enum&#39;;<br><br>export const ROLES_KEY = &#39;roles&#39;;<br>export const Roles = (...roles: Role[]) =&gt; SetMetadata(ROLES_KEY, roles);</pre><p>Following this, we can utilize this custom decorator to apply role properties to any route handler.</p><pre><br>@Get()<br>@Roles(Role.Admin)<br>getUser() {<br>  this.userService.get();<br>}</pre><p>Next, we will construct a Roles Guard 💂‍♂️ that will verify the roles assigned to the current user against the required roles for the route being accessed. To retrieve the necessary role(s) from the route’s custom metadata, we will utilize the <strong><em>Reflector </em></strong>utility class from the @nestjs/core package, which is readily available within the framework.</p><pre>import { Injectable, CanActivate, ExecutionContext } from &#39;@nestjs/common&#39;;<br>import { Reflector } from &#39;@nestjs/core&#39;;<br><br>@Injectable()<br>export class RolesGuard implements CanActivate {<br>  constructor(private reflector: Reflector) {}<br><br>  canActivate(context: ExecutionContext): boolean {<br>    const requiredRoles = this.reflector.getAllAndOverride&lt;Role[]&gt;(ROLES_KEY,[<br>      context.getHandler(),<br>      context.getClass(),<br>    ]);<br>    <br>    if (!requiredRoles) return true;<br>    <br>    const { user } = context.switchToHttp().getRequest();<br>    return requiredRoles.some((role) =&gt; user.roles?.includes(role));<br>  }<br>}</pre><p>In the above code snippet, the context is an instance of the ExecutionContext class that encapsulates details about the current request or execution flow. By leveraging context, you can make informed decisions about whether to grant access to a particular route or functionality within your application.</p><p>In this example, we assumed that the request.user object contains the user instance along with the user’s allowed roles. In a real application, you would likely handle the association between the user and their roles within a custom authentication guard.</p><pre>async canActivate(<br>    context: ExecutionContext,<br>  ): Promise&lt;boolean&gt; {<br><br>    const requiredRoles = this.reflector.getAllAndOverride&lt;Role[]&gt;(ROLES_KEY, [<br>      context.getHandler(),<br>      context.getClass(),<br>    ]);<br><br>    if (!requiredRoles) return true;<br>    const request = context.switchToHttp().getRequest();<br>    const token = this.extractTokenFromHeader(request);<br>    if (!token) {<br>      throw new HttpException(MESSAGES.UNAUTHORIZED_ACCESS,<br>            HttpStatus.UNAUTHORIZED);<br>    }<br>    try {<br>      const payload = await this.jwtService.verifyAsync(token, {<br>        secret: this.configService.get&lt;string&gt;(&#39;SECRET_KEY&#39;),<br>      });<br>      const user = await this.authService.validateUser(payload);<br>      return requiredRoles.some((role) =&gt; user.role === role);<br>    } catch {<br>      throw new HttpException(MESSAGES.UNAUTHORIZED_ACCESS, <br>            HttpStatus.UNAUTHORIZED);<br>    }<br>  }<br><br>  private extractTokenFromHeader(request: Request): string | undefined {<br>    const [type, token] = request.headers[&#39;authorization&#39;]?.split(&#39; &#39;) ?? [];<br>    return type === &#39;Bearer&#39; ? token : undefined;<br>  }</pre><p>By utilizing the JwtService within the provided code snippet, it becomes possible to securely retrieve sensitive information encoded within JSON Web Tokens (JWTs) by extracting the bearer token from the request header.</p><p>This is achieved through the extractTokenFromHeader method, which efficiently parses the authorization header to isolate the token portion. Subsequently, the guard proceeds to validate the authenticity and permissions of the token bearer against the roles mandated by the route.</p><p>Now that the RolesGuard has been successfully implemented, it’s time to apply it to controller routes using the following code snippet:</p><pre>import { Controller, Get, UseGuards } from &#39;@nestjs/common&#39;;<br>import { RolesGuard } from &#39;./roles.guard&#39;;<br><br>@Controller(&#39;example&#39;)<br>@UseGuards(RolesGuard)<br>@Roles(Role.ADMIN)<br>export class ExampleController {<br>  <br>@Get()<br>  async exampleRoute() {<br>    // Your route logic here<br>  }<br>}</pre><p>In addition to controller-level application, guards can be selectively applied at the method level using decorators like @Get() ,@Post() , @Put() , @Delete() , etc.</p><pre>import { Controller, Get, UseGuards } from &#39;@nestjs/common&#39;;<br>import { RolesGuard } from &#39;./roles.guard&#39;;<br><br>@Controller(&#39;example&#39;)<br>export class ExampleController {<br>  @Get()<br>  @UseGuards(RolesGuard)<br>  @Roles(Role.ADMIN)<br>  async exampleRoute() {<br>    // Your route logic here<br>  }<br><br>  @Post()<br>  @UseGuards(RolesGuard)<br>  @Roles(Role.ADMIN)<br>  async createExample() {<br>    // Your route logic here<br>  }<br>}</pre><p>Additionally, routes can be defined at the application level by registering them in either the AppModule or main.ts file. This centralizes route configuration, providing a comprehensive overview of all routes within the application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e767564b4254cb46a13fa07721de2489/href">https://medium.com/media/e767564b4254cb46a13fa07721de2489/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c09f3ee8b96bb992822f67deff95859/href">https://medium.com/media/6c09f3ee8b96bb992822f67deff95859/href</a></iframe><p>When registering the role guard in main.ts, we encounter an issue related to defining dependencies that requires in role guard. Therefore, it is preferable to register the guard in the App module instead.</p><h4>Reference</h4><p><a href="https://docs.nestjs.com/security/authorization">https://docs.nestjs.com/security/authorization</a></p><h3><strong>Conclusion</strong></h3><p>In conclusion, Role-Based Access Control (RBAC) is a powerful security technique that safeguards applications and systems by restricting access based on a user’s role within an organization. By creating custom decorators, guards, and leveraging the framework’s utilities, developers can establish a robust authorization layer that enforces granular role-based access control within their applications.</p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://twitter.com/inPlainEngHQ"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a><strong> | </strong><a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a></li><li>Visit our other platforms: <a href="https://stackademic.com/"><strong>Stackademic</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a><strong> | </strong><a href="https://blog.cubed.run/"><strong>Cubed</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f55b5e66516" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/enhancing-security-with-role-based-access-control-nest-js-2f55b5e66516">Enhancing Security with Role-Based Access Control (Nest.js)</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ngmodules vs Standalone Components or Angular2 vs Angular3]]></title>
            <link>https://blog.stackademic.com/ngmodules-vs-standalone-components-or-angular2-vs-angular3-ba54fab04ce3?source=rss-75202af3dd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba54fab04ce3</guid>
            <category><![CDATA[standalone-component]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angular2]]></category>
            <category><![CDATA[angular-ssr]]></category>
            <dc:creator><![CDATA[Chirag Prajapati]]></dc:creator>
            <pubDate>Thu, 26 Oct 2023 04:55:34 GMT</pubDate>
            <atom:updated>2024-09-24T14:12:32.443Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/976/0*lV6rjiHFPlhaGXZS.png" /></figure><p>Angular, a powerful and popular JavaScript framework, is renowned for its modularity and component-based architecture. At the <strong>heart </strong>of Angular’s modularity are <strong>NgModules </strong>and S<strong>tandalone </strong>components, both of which play vital roles in building scalable, maintainable web applications. In this blog📜, we’ll explore the differences between NgModules and standalone components, helping you understand when to use each and how they complement one another.</p><blockquote>💡 <strong>Also check out this guide to create a scheduling app using Angular:</strong></blockquote><p><a href="https://differ.blog/p/how-we-built-a-scheduling-app-using-angular-java-spring-boot-and-mysql-a6b14d">How We Built a Scheduling App using Angular, Java Spring Boot, and MySQL</a></p><h3>What is NgModules? 🧧</h3><p>In Angular, a@NgModule is a <strong>decorator </strong>that represents a cohesive block of code that focuses on a specific functionality or a specific feature of the application. It acts as a container for components, directives, services, and other related entities, providing a clear organization for the application’s codebase. Modules can be lazy loaded when they don’t need to be readily available on startup, which improves the speed of the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*LUQjfQnJNFVgcUIhddaTHg.png" /></figure><p>List of <strong><em>metadata </em></strong>for @NgModule</p><ul><li><strong>Declarations</strong>: In this array, you can add components, directives, and pipes.</li><li><strong>Imports: </strong>other modules whose exported classes and services are needed in this module</li><li><strong>Exports</strong>: The subset of declarations that should be reusable in the component templates of other Ngmodules.</li><li><strong>Providers: </strong>creators of services that this ngModules contributes to the global collection of services.</li><li><strong>Bootstrap: </strong>the main application view (entry point), called a root component, hosts all other application views. (<strong><em>Note):-</em></strong> only the root ngModule should set the bootstrap property.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a0e6848604066b0c5b490731c309786/href">https://medium.com/media/1a0e6848604066b0c5b490731c309786/href</a></iframe><p>Here, you can notice that ngModules manages a substantial amount of elements, which consequently results in an expansion of the application’s size and a corresponding reduction in performance.</p><p>The confusion starts with <strong>components and services not having the same scope(visibility)</strong>:</p><ul><li><strong>declarations</strong>: components are in local scope (private),</li><li><strong>providers</strong>: services<strong> </strong>are generally in global scope (public).</li></ul><p>It means the <strong>components you declared are only usable in the current module</strong>. If you need to use them outside, in other modules, you’ll have to export them. So here the CoreModules and SharedModules are useful for your app. Read more about <a href="https://medium.com/@cyrilletuzi/understanding-angular-modules-ngmodule-and-their-scopes-81e4ed6f7407">ngModules</a>.</p><p><a href="https://differ.blog/differ-ai">Introducing DifferAI</a></p><h3>What is a Standalone Component? 🌌</h3><p>Standalone components <strong>provide a simplified way to build Angular applications</strong>. Standalone components, directives, and pipes aim to streamline the authoring experience by reducing the need for NgModules. Existing applications can optionally and incrementally adopt the new standalone style without any breaking changes.</p><p>Angular 14 introduces the standalone component, a component not part of any ngModule that can be used with either other standalone or module-based components.</p><p>Besides standalone components, in Angular 14, you can also create:</p><ul><li>Standalone directives and pipes</li></ul><p>You can use a standalone component with:</p><ul><li>Module-based components</li><li>Other standalone components</li><li>Lazy loading and lazy loading routing</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4407a64eea1c37bec54f4016018479f/href">https://medium.com/media/f4407a64eea1c37bec54f4016018479f/href</a></iframe><p>Transform a module-based component into a standalone component by adhering to the following steps:</p><ol><li>Set the standalone property to true.</li><li>Remove it from the declarationarray of the module of which it was a part.</li><li>Use importsarray to add dependencies.</li></ol><p>The beauty of standalone components lies in their modular and self-contained nature. Each standalone component is developed independently, with its own set of dependencies and functionality. This isolation allows for better code organization and maintainability, as each component only has access to the dependencies it explicitly requires.</p><p>Here are some of the <strong>key differences </strong>between NgModules and standalone components <strong>🎌</strong>:</p><ul><li><strong>NgModules</strong> are used to organize strand manage dependencies📦.</li></ul><p>They can be used to group together related components, directives, and pipes and to provide a way to inject dependencies into those components. Standalone components do not require a NgModule to be used. They can be used independently of any other component or NgModule.</p><ul><li><strong>Standalone components</strong> are more flexible than NgModules 💪.</li></ul><p>They can be used in any part of an Angular application without being declared in a NgModule. This makes them more reusable and easier to share between different applications. NgModules, on the other hand, can only be used in the application that they are declared in.</p><ul><li><strong>Standalone components</strong> are more lightweight than NgModules 🎈.</li></ul><p>They do not require a NgModule to be used, which makes them smaller and faster to load. NgModules, on the other hand, can be larger and slower to load because they need to include all of the dependencies for the components that they are declaring.</p><p>Overall, standalone components are a more flexible and lightweight way to build Angular applications. They can be used in any part of an application without being declared in a NgModule, and they are smaller and faster ️to load than NgModules.</p><p>So this is the basic difference between ngModules and the standalone component. Let’s now take a closer look at the code base and see how it evolved from version 13 to version 14 and all the way up to the most recent version.</p><h3>Codebase Structure 📝</h3><ol><li>With <strong>NgModules</strong></li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d682a3f0a08afc312e1330f9b2e83a1/href">https://medium.com/media/6d682a3f0a08afc312e1330f9b2e83a1/href</a></iframe><p>2. With <strong>Standalone</strong> <strong>Components</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/776bd33e114aec9d1dde400f4796af88/href">https://medium.com/media/776bd33e114aec9d1dde400f4796af88/href</a></iframe><h3>Bootstrapping application 🚀</h3><ol><li>Using @ngModules, we can bootstrap the application by bootstrapping the AppModule in main.ts and adding AppRoutingModule in AppModule to configure the routing.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab1bdd1a575da2e35c8f3fa4e4ee946c/href">https://medium.com/media/ab1bdd1a575da2e35c8f3fa4e4ee946c/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab87a6d69283c0ee596d4d2bd2f986ad/href">https://medium.com/media/ab87a6d69283c0ee596d4d2bd2f986ad/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f681f9baf12ba4c59ad748daca9cefe/href">https://medium.com/media/6f681f9baf12ba4c59ad748daca9cefe/href</a></iframe><p>Let’s run the app to see it working! 🤓</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*5gvduTUaM0WDIV6Y" /></figure><p>yes, it takes some time to load the app because the size of the bundle💸 is increased.</p><p>2. Using a <strong>Standalone </strong>approach we can directly bootstrap the AppComponent in main.ts file. and for adding other routes we can simply provide routes with the help of ProvideRoutes().🚀</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ae0cdff2fb70b22ac3076092dff33a6/href">https://medium.com/media/0ae0cdff2fb70b22ac3076092dff33a6/href</a></iframe><p>This highlights how the independent API significantly decreases both the bundle size and the amount of code.</p><h3>Guards and Intercptors 🛡️</h3><ol><li>Using @NgModulesthe guards are class based architecture. and it requires more boilerplate code.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37c22e54dccb3bc174b344b0475bf8d4/href">https://medium.com/media/37c22e54dccb3bc174b344b0475bf8d4/href</a></iframe><p>2. Functional guards are introduced in version 14.2. They are a more modern and flexible way to implement guards in Angular.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b575798262f0af0c2852ebd1c860efdf/href">https://medium.com/media/b575798262f0af0c2852ebd1c860efdf/href</a></iframe><p>Once you have registered the guard with the router, it will be called whenever a user tries to navigate to the route.</p><p>One of the key benefits of functional guards is that they are easy to compose. This means that you can combine multiple functional guards to create more complex guards.</p><blockquote>💡How we can miss that the <strong>CanMatch </strong>guard a best alternative of <strong>CanActivate </strong>and <strong>CanLoad </strong>guard.</blockquote><h4>Interceptor</h4><ol><li>Using class based interceptors should implement the HttpInterceptor interface. it requires you to implement intercept() method.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95937dd4c1c1851d5ee69f8d312f9fc9/href">https://medium.com/media/95937dd4c1c1851d5ee69f8d312f9fc9/href</a></iframe><p>After than you need to register your custom interceptor in your app’s module. and add it to the providers array in the @NgModule decorator of your module.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b181b73a59ec07ec8a1e4c6037f526f8/href">https://medium.com/media/b181b73a59ec07ec8a1e4c6037f526f8/href</a></iframe><p>2. <strong>Functional interceptors </strong>provide a more functional and declarative approach to modifying or inspecting requests and responses compared to class-based interceptors. it use higher-order functions and can be particularly useful when you want to perform specific tasks on the request or response in a concise and flexible manner.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a16708e2e4f849ac0692984ec3b33657/href">https://medium.com/media/a16708e2e4f849ac0692984ec3b33657/href</a></iframe><p>After than you need to register your custom interceptor in your app config file.and add it to the providers array.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd8a7e171c7b5cc74984eb2a4214e5cd/href">https://medium.com/media/fd8a7e171c7b5cc74984eb2a4214e5cd/href</a></iframe><p>So far, these are the typical features that have been updated from V13 to V14, including the most recent version. Now, let’s delve into server-side rendering and explore how Angular has advanced in the realm of SSR with client hydration.</p><p>Angular has supported SSR since Angular Universal, which was introduced in Angular 4. However, SSR in Angular 16 has been significantly improved with the introduction of client hydration.</p><p>here are several benefits to using SSR in Angular, including:</p><ul><li><strong>Improved performance</strong>: SSR can improve the performance of Angular applications by sending the pre-rendered HTML to the client, which can be loaded and displayed more quickly.</li><li><strong>Improved SEO</strong>: SSR can improve the SEO of Angular applications by making it easier for search engines to index the content of the application.</li><li><strong>Improved user experience</strong>: SSR can improve the user experience of Angular applications by displaying the initial content of the application more quickly.</li></ul><p><strong>TL;DR let’s see the basic difference between v13 and v14 or latest version.</strong></p><p>In Angular version 13 AppServerModule is bootstrapped in the server configuration file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad05d885ee307e35e9ae8fed3248ad1b/href">https://medium.com/media/ad05d885ee307e35e9ae8fed3248ad1b/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d69389900109338b583a814c726c0d20/href">https://medium.com/media/d69389900109338b583a814c726c0d20/href</a></iframe><p>Until Angular version 15, Server-Side Rendering (SSR) was imported through the appModule. However, in version 16, a new approach has been introduced. You can enable server side rendering using provideServerRendering() method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e327b677ffef97562bf03c3312ba8c65/href">https://medium.com/media/e327b677ffef97562bf03c3312ba8c65/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/236a63664dd74e3bed3fe1aa0baa80e9/href">https://medium.com/media/236a63664dd74e3bed3fe1aa0baa80e9/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f58d9c175cb7f4d6a5f2c373c8eec99b/href">https://medium.com/media/f58d9c175cb7f4d6a5f2c373c8eec99b/href</a></iframe><p>In version16 angular has introduce the <strong>Client hydration</strong>, it’s a process where the Angular application is re-rendered on the client using the same DOM that was rendered on the server. This allows Angular applications to take advantage of the performance benefits of SSR while still maintaining the interactivity of a client-rendered application.</p><p>The purpose of hydration is to improve application performance by reusing existing DOM elements, avoiding extra work to recreate them, and preventing visible UI flickers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8bfaa5d362387cc829144607e4167b2/href">https://medium.com/media/f8bfaa5d362387cc829144607e4167b2/href</a></iframe><p>You can enable client hydration in your app by incorporating the provideClientHydration() method into the app configuration file.</p><p>In addition to these updates, Angular has introduced a range of new features starting from Angular 14. These include Directive composition, <a href="https://medium.com/angular-gems/angular-signals-in-a-nutshell-89dc19777173">Signals</a>, NgOptimized Image, Esbuild dev-server, Dependency injection, Router inputs, and <a href="https://medium.com/ngconf/new-in-angular-updated-control-flow-b6f0d6af7dfe">New control flow</a>.</p><p>Based on the observed features and numerous modifications in the core files, it appears that <strong>Angular 2</strong> has evolved into <strong>Angular 3</strong>.</p><h3>Conclusion</h3><p>In conclusion, with new updated <strong>Angular🅰</strong> offering a wide range of new features and enhancements that can help to build powerful, efficient, and user-friendly web applications.</p><p>Thank you! Happy coding 👨‍💻</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a> | <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba54fab04ce3" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/ngmodules-vs-standalone-components-or-angular2-vs-angular3-ba54fab04ce3">Ngmodules vs Standalone Components or Angular2 vs Angular3</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Functions and closures ⚙️]]></title>
            <link>https://medium.com/@chirag-p/functions-and-closures-%EF%B8%8F-5c2371193c38?source=rss-75202af3dd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c2371193c38</guid>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Chirag Prajapati]]></dc:creator>
            <pubDate>Sat, 02 Sep 2023 09:17:56 GMT</pubDate>
            <atom:updated>2023-09-06T03:17:20.472Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HQiSOzq9EcifYXIi" /><figcaption>Photo by <a href="https://unsplash.com/@growtika?utm_source=medium&amp;utm_medium=referral">Growtika</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>JavaScript is one of the most popular programming languages used in web development. One of the fundamental building blocks of JavaScript is functions, and nested within the world of functions lies a powerful concept called closures. In this comprehensive guide, we will explore JavaScript functions from the basics to more advanced concepts, with a special emphasis on closures and their significance.</p><h3>Functions</h3><p>A function is a block of code that can be defined and executed at a later time. Functions are like reusable containers for code, and they are essential for modularity and code organization.</p><p>Functions can also take input, perform actions, and return results.</p><h4>Function Definition 📝</h4><p>A <strong>function definition</strong> uses thefunction keyword followed by the function name, a list of parameters enclosed in parentheses, and the function body enclosed in curly braces. It is also called a <strong>function declaration.</strong></p><pre>function greet(name) {<br>  return `Hello, ${name}!`;<br>}</pre><p>The function greet takes one parameter, called name. The function consists of one statement that says to return the parameter of the function (that is, number) multiplied by itself. The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return">return</a> statement specifies the value returned by the function, which is hello name .</p><h4>Function Invocation 📖</h4><p>Once you’ve defined a function, you can invoke it by using its name followed by parentheses and passing any required arguments. For example:</p><pre>greet(&quot;user&quot;);</pre><p>You can also define anonymous functions, which are functions without a name. These are often used as callbacks:</p><pre>const add = function (a, b) {<br>  return a + b;<br>};<br><br>add(2,3);</pre><h4>Function Parameters 🧬</h4><p>Functions can take parameters, which are placeholders for values you want to pass to the function. These parameters are defined in the function’s parameter list and can be used inside the function’s body.</p><pre>function calculateSum(a, b) {<br>   return a + b;<br>}</pre><h4>Default Parameters</h4><p>If a function is called, but argument is not provided, then the corresponding value becomes undefined.</p><pre>greet();</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*UdWQHxNaPvw1mEJrorgDlw.png" /></figure><p>That’s not an error. Such a call would output &quot;Hello, undefined&quot;. As the value for text isn’t passed, it becomes undefined.</p><p>We can specify the so-called “default” (to use if omitted) value for a parameter in the function declaration, using =</p><pre>function greet(name=&quot;jack&quot;) {<br>  return `Hello, ${name}!`;<br>}</pre><h3>Scope 🔭</h3><p>JavaScript has function scope, meaning that variables defined inside a function are only accessible within that function. However, a function can access all variables and functions defined inside the scope in which it is defined.</p><pre>function sum() {<br>  let a = 5, b = 3;<br>  return a + b;<br>}</pre><pre>let species = &quot;human&quot;;  //global variable<br> <br>function transform() {<br>  let species = &quot;werewolf&quot;;  //local variable<br>  return species;<br>}<br><br>console.log(species);<br>console.log(transform());</pre><h3>Closures</h3><p>A closure is a function that remembers the variables in the scope where it was created, even if that function is executed outside that scope. Closures are incredibly powerful because they allow you to create private variables and maintain state across multiple function calls.</p><p>Since a nested function is a closure, this means that a nested function can inherit the arguments and variables of its containing function. In other words, the inner function contains the scope of the outer function.</p><pre>function multiplyByTen(x) {<br>  const y = 10;<br>  function multiple() {<br>    return x * y;<br>  }<br>  return multiple();<br>}<br><br>console.log(multiplyByTen(3));</pre><p>In this example, multiple is a closure because it retains access to y, even after the multiplyByTen function has finished executing. Closures are often used in scenarios where you need to encapsulate data or create functions with a persistent state.</p><p>closures are the primary mechanism used to enable data privacy. When you use closures for data privacy, the enclosed variables are only in scope within the containing (outer) function. You can’t get the data from an outside scope except through the object’s <strong>privileged methods</strong>.</p><h3>Conclusion</h3><p>Functions are a fundamental concept in JavaScript and are essential for structuring and organizing your code. Within the realm of functions, closures add a layer of depth and complexity that allows you to create more robust and flexible code.</p><p>Thank you, Happy Coding 👨‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c2371193c38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Surface: Unleashing the CSS Background Property]]></title>
            <link>https://medium.com/@chirag-p/beyond-the-surface-unleashing-the-css-background-property-1b18cbd03517?source=rss-75202af3dd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b18cbd03517</guid>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[css3]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Chirag Prajapati]]></dc:creator>
            <pubDate>Thu, 03 Aug 2023 18:48:49 GMT</pubDate>
            <atom:updated>2023-09-05T06:09:54.527Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*zar74dUVsliObzozgkABDw.jpeg" /></figure><p>The background property in CSS is a powerful tool that allows developers to create visually engaging and dynamic backgrounds for web pages. In this blog post, we will explore the various aspects of the background property and how it can be used to elevate the design of your web projects.</p><h4>Introduction</h4><p>The background property in CSS is a versatile and comprehensive property that enables you to control the appearance of an element&#39;s background. You can apply the background property to a wide range of HTML elements, from the entire page body to individual elements like divs, paragraphs, and more.</p><h4>Background Color 🌈</h4><p>One of the simplest ways to use the background property is by setting the background color of an element. By using the background-color property, you can choose from a wide range of color values, such as predefined color names, hexadecimal color codes, RGB, or HSL values.</p><pre>&lt;style&gt;<br>body {<br>  background-color: skyblue;<br>}<br>&lt;/style&gt;<br>&lt;h1&gt;The background-color Property&lt;/h1&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*MvMmC3-tkmcSrSiLKny7qQ.png" /></figure><h4>Background Image</h4><p>With the background-image property, you can set an image as the background of an element. This opens up numerous possibilities for adding texture, patterns, or stunning visuals to your website.</p><pre>&lt;style&gt;<br>  body {<br>    background-image: url(https://medium.com/&quot;paper.gif&quot;);<br>  }<br>&lt;/style&gt;<br>&lt;body&gt;<br>  &lt;h1&gt;Hello World!&lt;/h1&gt;<br>&lt;/body&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*KBxWrQiNQPAjMVibmki6Mg.png" /></figure><h4>Background Repeat 🔁</h4><p>If the background image is smaller than the element, it can be repeated to fill the entire background area. The background-repeatproperty allows you to control how the image repeats.</p><pre>background-repeat: repeat | repeat-x | repeat-y | space | no-repeat;</pre><p>Ref: <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat">https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat</a></p><h4>Background Position</h4><p>With the background-position property, you can precisely position the background image within the element. You can use keywords like top, center, bottom, or specify exact pixel or percentage values.</p><pre>&lt;style&gt;<br>body { <br>  background-image: url(https://medium.com/&#39;star.gif&#39;);<br>  background-repeat: no-repeat;<br>  background-position: center top;<br>}<br>&lt;/style&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*lff5DrIQVTlzBAZA5w2YBA.png" /></figure><p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/background-position">background-position - CSS: Cascading Style Sheets | MDN</a></p><h4>Background Attachment 📎</h4><p>The background-attachment property sets whether a background image&#39;s position is fixed within the viewport, or scrolls with its containing block.</p><pre>background-attachment: scroll | fixed;</pre><pre>&lt;style&gt;<br>body {<br>  background-image: url(https://medium.com/&quot;img_tree.png&quot;);<br>  background-repeat: no-repeat;<br>  background-position: right top;<br>  margin-right: 200px;<br>  background-attachment: scroll;<br>}<br>&lt;/style&gt;<br>&lt;p&gt;lorem.5000&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*adsQlrLKsqSc4qDd5plruw.png" /></figure><h4>Background size 🔲</h4><p>The <strong>background-size</strong> CSS property is used to set the size of a background image of an element. The background image can be stretched or constrained to fit into the existing space. It allows us to control the scaling of the background image.</p><p>It has two possible values that contain and <strong>cover</strong>.</p><p>Its single-value syntax defines the width of the image (in this case, the height sets to auto), whereas the double values define the value of both height and width in which the first value sets the width and the second sets the height.</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/background-size">background-size - CSS: Cascading Style Sheets | MDN</a></p><h4>Conclusion</h4><p>The background property is a versatile tool in CSS that allows developers to create captivating backgrounds for their webpages. By utilizing its various properties like background-color, background-image, background-position, and others, you can unleash your creativity and transform the look and feel of your website. So, let your creativity soar, and explore the limitless potential of the CSS background property in your web design endeavors.</p><p>Happy coding! 👨‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b18cbd03517" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coloring the Web: A Comprehensive Guide to CSS Colors]]></title>
            <link>https://medium.com/@chirag-p/coloring-the-web-a-comprehensive-guide-to-css-colors-96f176a02ee6?source=rss-75202af3dd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/96f176a02ee6</guid>
            <category><![CDATA[css3]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[css-colors]]></category>
            <dc:creator><![CDATA[Chirag Prajapati]]></dc:creator>
            <pubDate>Thu, 03 Aug 2023 17:45:25 GMT</pubDate>
            <atom:updated>2023-08-03T17:45:25.848Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zPuzbQ49JF0rBv_N" /><figcaption>Photo by <a href="https://unsplash.com/@tim_arterbury?utm_source=medium&amp;utm_medium=referral">Tim Arterbury</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Are you new to web development and wondering how to add eye-catching colors to your website? Look no further than CSS colors! In this blog post, we will explore the fascinating world of CSS colors and how you can use them to enhance the visual appeal of your web projects.</p><h4>Introduction to CSS Colors</h4><p>CSS is a powerful language used to style web pages. One of the key aspects of CSS is the ability to define colors to make your content visually appealing. CSS provides a wide range of color options that can be implemented in various ways.</p><p>CSS provides various color properties that allow developers to define colors in different ways:</p><ol><li>Keyword Colors</li><li>Hexadecimal Notation</li><li>RGB and RGBA</li><li>HSL and HSLA</li></ol><h4>Keyword Colors 🔑</h4><p>CSS has a set of predefined color names that you can use to specify colors. These are easy to use but provide limited options.</p><p>Some common color names are red, green, blue, purple, yellow, etc.</p><pre>&lt;style&gt;<br> .text-red {<br>color:red;<br>}<br>&lt;/style&gt;<br>&lt;h1 class=&quot;text-red&quot;&gt;Hello World&lt;/h1&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*dS05OcIvYTmrs89SdC_Lfg.png" /></figure><h4>Hexadecimal Notation #️⃣</h4><p>CSS allows you to specify colors by their hexadecimal value, which is a six-digit combination of numbers and letters. Hexadecimal colors provide a vast range of color options, allowing you to achieve precise color selections.</p><blockquote>(0–9, A-F) to define the intensity of red, green, and blue.</blockquote><pre>&lt;style&gt;<br> .bg-yellow {<br>background-color: #ffa500;<br>}<br>&lt;style&gt;<br>&lt;h2 class=&quot;bg-yellow&quot;&gt;#ffa500&lt;/h2&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*EnEKUrOg1qfl5ZGxp-ImsA.png" /></figure><p><strong>Tip</strong>💡: You can also use 3-digit hexadecimal, which is a shorthand property of 6 digits.</p><h4>RGB and RGBA</h4><p>The rgb() defines colors using the intensity of red, green, and blue in the range of 0 to 255.</p><p>The rgba() includes an additional alpha channel (0 to 1) for transparency.</p><pre>&lt;style&gt;<br> .bg-blue {<br>background-color:rgb(0, 0, 255);<br>}<br>.bg-blue-light {<br>background-color:rgba(0, 0, 255,0.5);<br>}<br>&lt;/style&gt;<br>&lt;h2 class=&quot;bg-blue&quot;&gt;rgb(0, 0, 255)&lt;/h2&gt;<br>&lt;h2 class=&quot;bg-blue-light&quot;&gt;rgb(0, 0, 255, 0.5)&lt;/h2&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*fKREbAkNN5ZSzRTYGn-urA.png" /></figure><h4>HSL and HSLA</h4><p>Thehsl() function defines colors using hue, saturation, and lightness, offering a more intuitive way to control colors. The hsla() function also includes an alpha channel.</p><p><strong>Hue</strong>: represents the color type wheel (ranging from 0 to 360).<br>Where 0 is red, 120 is green, and 240 is blue.</p><p><strong>Saturation</strong>: represents the intensity or purity of the color (ranging from 0% to 100%).<br>Where 0% means a shade of gray and 100% is the full color.</p><p><strong>Lightness light</strong>: represents the brightness of the color (ranging from 0% to 100%).<br>Where 0% is black, 50% is neither light or dark and 100% is white.</p><pre>&lt;style&gt;<br> .border-green {<br>  border: 5px solid hsl(147, 50%, 47%);<br>  }<br> .border-green-light {<br>  border: 5px solid hsla(147, 50%, 47%, 0.5);;<br>  }<br>&lt;/style&gt;<br>&lt;h2 class=&quot;bg-green&quot;&gt;Green &lt;/h2&gt;<br>&lt;h2 class=&quot;bg-green-light&quot;&gt;Light green &lt;/h2&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*9I_e_nNk5YsGkLY1-Sb3Kw.png" /></figure><h4>Color Palettes and Websites 🔗</h4><p>Using CSS colors effectively involves selecting the right color combination to create visually appealing websites. There are numerous online tools and resources that provide color palettes, allowing you to choose harmonious colors for your designs. Websites such as <a href="https://colorhunt.co/">colorhunt</a> and <a href="https://coolors.co/">coolors</a> offer a plethora of color palettes to inspire your creativity.</p><h4>Conclusion</h4><p>CSS colors are an essential tool for web development, allowing you to bring your website to life with vibrant colors. Whether you prefer using predefined color names, hexadecimal values, or color models like RGB and HSL, CSS provides a wide range of options to suit your needs. So, go ahead and experiment with CSS colors to create stunning web designs that captivate your audience!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96f176a02ee6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Font CSS ]]></title>
            <link>https://medium.com/@chirag-p/web-font-css-f4443b290066?source=rss-75202af3dd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4443b290066</guid>
            <category><![CDATA[css3]]></category>
            <category><![CDATA[fonts]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[web-font]]></category>
            <dc:creator><![CDATA[Chirag Prajapati]]></dc:creator>
            <pubDate>Thu, 27 Jul 2023 13:25:32 GMT</pubDate>
            <atom:updated>2023-07-28T05:21:54.837Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qcUgcbBStsISCJmB" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>A web font in CSS refers to a custom font that is not installed on the user’s computer but is instead loaded from a remote server when a web page is accessed. This allows web designers to use unique and custom fonts in their web pages, ensuring consistent typography across different devices and platforms.</p><p>To add a web font to your HTML document, follow these steps:</p><ol><li><strong>Find a Web Font: </strong>First, you need to find a web font that you want to use. There are several free and paid web font services available, such as <a href="https://fonts.google.com/">Google Fonts</a><strong>,</strong> <a href="https://fonts.adobe.com/">Adobe Fonts</a>, or <a href="https://www.fonts.com/">Fonts.com</a>.</li><li><strong>Include the CSS Link: </strong>Once you’ve chosen a web font, you need to include the appropriate CSS link in the &lt;head&gt; section of your HTML document. For example, if you&#39;re using Google Fonts, you would include the following line in your HTML file:</li></ol><pre>&lt;head&gt;<br>  &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Poppins&amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;<br>&lt;/head&gt;</pre><p>3. <strong>Apply the Font in CSS: </strong>Now that you’ve included the CSS link for the web font, you can apply it to specific elements in your CSS. Use the font-family property to set the font for the desired element(s).</p><pre>&lt;head&gt;<br>  &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Poppins&amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;<br>  &lt;style&gt;<br>    body {<br>      font-family: &#39;Poppins&#39;, sans-serif;<br>    }<br>  &lt;/style&gt;<br>&lt;/head&gt;</pre><p>In the example above, the web font <strong>Poppins</strong> will be applied to the entire body of the document. The sans-serif fallback ensures that if the web font fails to load or is not supported, the browser will default to a standard sans-serif font.</p><p>For performance optimization, you can use the preconnect and preload techniques to load Google Fonts efficiently. This method involves adding two separate lines in the &lt;head&gt; section of your HTML:</p><pre>&lt;head&gt;<br>  &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.googleapis.com&quot;&gt;<br>  &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.gstatic.com&quot; crossorigin&gt;<br>  &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Poppins&amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;<br>&lt;/head&gt;</pre><p>the preconnect keyword for the rel attribute act as a hint to the browser that the user needs resources from the target resource’s origin, and therefore the browser can preemptively initiate a connection to that origin. This can speed up the downloading of the font files.</p><p>Alternatively, you can use a CSS @import:</p><pre>@import url(https://medium.com/&#39;https://fonts.googleapis.com/css2?family=Poppins&amp;display=swap&#39;);<br><br>body {<br>  font-family: &#39;Poppins&#39;, sans-serif;<br>}</pre><blockquote>🚨<strong>According to the coding standard guidelines, this method is considered inappropriate.</strong></blockquote><p>There is a display parameter in the URL, which is used to set the font-display descriptor for the font. This lets you control what happens while the font is unavailable. The value swap gives the font face an extremely small <a href="https://www.w3.org/TR/css-fonts-4/#font-block-period">block period</a> (100ms or less is recommended in most cases) and an infinite <a href="https://www.w3.org/TR/css-fonts-4/#font-swap-period">swap period</a>.</p><p>You can also request other individual styles, such as specific weights, using a special notation. For example, to request weights 400 and 700 for the Crimson Pro font, the URL looks like this:</p><pre>https://fonts.googleapis.com/css2?family=Poppins+Pro:wght@400;700</pre><p>let’s consider the scenario where we wish to include additional fonts that are not available within the <strong>Google Fonts</strong> library !!🤔</p><p>To add a custom font to your CSS that is not available on Google Fonts or any other font hosting service, you’ll need to use the @font-face rule. This rule allows you to specify a font family and the font file&#39;s location, enabling you to use custom fonts on your website. Here&#39;s how you can do it:</p><p><strong>1. Obtain the Font Files</strong><br>First, make sure you have the necessary font files (usually in .ttf, .otf, .woff, or .woff2 formats) for the custom font you want to use. <br>Different type of <strong>fonts </strong>are: TrueType Fonts (TTF), OpenType Fonts (OTF), Web Open Font Format (WOFF) ,Web Open Font Format (WOFF 2), SVG Fonts/Shapes, Embedded OpenType Fonts (EOT).</p><p>If your font type is TrueType fonts then you need to convert the font into WOFF/WOFF2 becuase these format are recommanded.<br>From <a href="https://transfonter.org/">here</a> you can generate WOFF/WOFF2 font form TTF.</p><p><strong>2. Upload Font Files</strong><br>Upload the font files to a directory on your website server. It’s a good practice to create a separate “<strong>fonts</strong>” folder and place the font files there.</p><p><strong>3. Define the </strong><strong>@font-face Rule<br></strong>In your CSS file, define the @font-face rule, specifying the font family name, the font file&#39;s location, and any font-weight and font-style variations.</p><pre>@font-face {<br>  font-family: &#39;Gotham&#39;;<br>  src: url(https://medium.com/&#39;src/font/Gotham-Book.eot&#39;);<br>  src: url(https://medium.com/&#39;src/font/Gotham-Book.eot?#iefix&#39;) format(&#39;embedded-opentype&#39;),<br>        url(https://medium.com/&#39;src/font/Gotham-Book.woff2&#39;) format(&#39;woff2&#39;),<br>        url(https://medium.com/&#39;src/font/Gotham-Book.woff&#39;) format(&#39;woff&#39;),<br>        url(https://medium.com/&#39;src/font/Gotham-Book.ttf&#39;) format(&#39;truetype&#39;),<br>        url(https://medium.com/&#39;src/font/Gotham-Book.svg#Gotham-Book&#39;) format(&#39;svg&#39;);<br>  font-weight: normal;<br>  font-style: normal;<br>}</pre><p>Use the Gotham Font: After defining the @font-face rule, you can now use the custom font in your CSS styles by referencing the specified font-family.</p><pre>body {<br>  font-family: &#39;Gotham&#39;, sans-serif;<br>}</pre><p>Load your web page and check if the custom font is being applied correctly. Inspect the font in the browser’s developer tools to see if there are any errors related to loading the font files.</p><p>Thank you ! happy coding 👩‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4443b290066" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ultimate Guide to CSS Typography]]></title>
            <link>https://medium.com/@chirag-p/the-ultimate-guide-to-css-typography-db00a7215a02?source=rss-75202af3dd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/db00a7215a02</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[typography]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[css3]]></category>
            <dc:creator><![CDATA[Chirag Prajapati]]></dc:creator>
            <pubDate>Thu, 20 Jul 2023 13:30:23 GMT</pubDate>
            <atom:updated>2023-07-20T13:30:23.477Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SYhSBOVbtm2r_spxuQdyVA.png" /><figcaption>Photo by Brett Jordan on Unsplash</figcaption></figure><p>Typography is the art of arranging letters and text to make the website legible(readable), clear, and visually appealing to the reader. Typography involves font style, appearance, and structure, which aims to bring out certain emotions and convey specific messages.</p><p>In this module, we’ll first look at some fundamental CSS font properties like font-family, font-style, font-weight, and font-size. Then, we’ll dive into properties that affect paragraphs of text, such as text-indent , text-transform, text-align and word-spacing.</p><h4>Font Family</h4><p>When using <strong>multiple</strong> values, the font-family list of <strong>font families</strong> defines the <strong>priority</strong> in which the browser should choose the font family.</p><blockquote><strong>Note:</strong> The font-family property should hold several font names as a <strong>fallback</strong> system, to ensure maximum compatibility between browsers/operating systems.</blockquote><pre>&lt;style&gt;<br>h3 {<br>  font-family: Arial, Helvetica, sans-serif;<br>}<br>p {<br>  font-family: &quot;Lucida Console&quot;, &quot;Courier New&quot;, monospace;<br>}<br>&lt;/style&gt;<br>&lt;h3&gt;The Arial font&lt;/h3&gt;<br>&lt;p&gt;The Lucida Console font.&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*EZxBITlrzgSh_VXh73Mdfw.png" /></figure><h4>Font style</h4><p>Defines how much the text is slanted. It has three following properties:</p><ul><li>normal — The text is shown normally</li><li>italic — The text is shown in italics</li><li>oblique — The text is “<strong>leaning</strong>”(similar to italic).</li></ul><blockquote>The main difference between <em>italic</em> and <em>oblique</em> is that <em>italic</em> is typically a cursive version of the regular typeface. <em>oblique</em> displays a slanted version of regular typeface.</blockquote><pre>&lt;style&gt;<br>p.normal {<br>  font-style: normal;<br>}<br><br>p.italic {<br>  font-style: italic;<br>}<br><br>p.oblique {<br>  font-style: oblique;<br>}<br>&lt;/style&gt;<br>&lt;p class=&quot;normal&quot;&gt;This is a paragraph in normal style.&lt;/p&gt;<br>&lt;p class=&quot;italic&quot;&gt;This is a paragraph in italic style.&lt;/p&gt;<br>&lt;p class=&quot;oblique&quot;&gt;This is a paragraph in oblique style.&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*f-hMuhWuh-JTmLZJtJpckQ.png" /></figure><h4>Font weight</h4><p>It defines the weight💪 of the text.</p><p>font weight: normal | bold | 100-900;</p><pre>&lt;style&gt;<br>p.normal {<br>  font-weight: normal;<br>}<br><br>p.bold {<br>  font-weight: bold;<br>}<br><br>p.thicker {<br>  font-weight: 900;<br>}<br>&lt;/style&gt;<br>&lt;p class=&quot;normal&quot;&gt;This is a paragraph.&lt;/p&gt;<br>&lt;p class=&quot;bold&quot;&gt;This is a paragraph.&lt;/p&gt;<br>&lt;p class=&quot;thicker&quot;&gt;This is a paragraph.&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/1*HKk9P7d5y8FxV6_tQzEekA.png" /></figure><h4>Font variant</h4><p>It defines which glyph to use for each letter. whether or not a text should be displayed in a small-caps font.</p><p>font-variant: normal | small-caps;</p><pre>&lt;style&gt;<br>p.normal {<br>  font-variant: normal;<br>}<br>p.small {<br>  font-variant: small-caps;<br>}<br>&lt;/style&gt;<br>&lt;p class=&quot;normal&quot;&gt;This is paragraph text&lt;/p&gt;<br>&lt;p class=&quot;small&quot;&gt;This is paragraph text&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*pYoLKRkdwSRlE-Pw1NBibA.png" /></figure><h4>Font size 🔎</h4><p>It defines the size of the text.You can use pixel, percentage and other unit keywords like rem and em.</p><p>font-size:20px | 1.2em | 1.2rem | 90%;</p><blockquote>The main difference between rem and em is em represents the font-size inherited from the element’s parent.rem is similar, but instead represents the font-size inherited from the <em>root element.</em></blockquote><p>It also accepts some <em>absolute</em> keyword values (xx-small, x-small, small, medium, large, x-large, xx-large) and a couple of <em>relative</em> keyword values (smaller, larger).</p><pre>  <br>&lt;style&gt;<br>.a {<br>  font-size: xx-small;<br>}<br><br>.b {<br>  font-size: x-small;<br>}<br><br>.c {<br>  font-size: small;<br>}<br><br>.d {<br>  font-size: medium;<br>}<br>.e {<br>  font-size: large;<br>}<br>.f {<br>  font-size: x-large;<br>}<br>.g {<br>  font-size: xx-large;<br>}<br>&lt;/style&gt;<br>  &lt;h1 class=&quot;a&quot;&gt;font-size: xx-small&lt;/h1&gt;<br>  &lt;h1 class=&quot;b&quot;&gt;font-size: x-small&lt;/h1&gt;<br>  &lt;h1 class=&quot;c&quot;&gt;font-size: small&lt;/h1&gt;<br>  &lt;h1 class=&quot;d&quot;&gt;font-size: medium&lt;/h1&gt;<br>  &lt;h1 class=&quot;e&quot;&gt;font-size: large&lt;/h1&gt;<br>  &lt;h1 class=&quot;f&quot;&gt;font-size: x-large&lt;/h1&gt;<br>  &lt;h1 class=&quot;g&quot;&gt;font-size: xx-large&lt;/h1&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*UxJGH3U0m95xyb8xFejp7A.png" /></figure><h4>Line height</h4><p>It specifies the height of a line.</p><p>line-height: normal | 2.5 | 3em | 150% | 32px;</p><p><a href="https://stackblitz.com/edit/web-platform-8tiw5q?file=index.html">https://stackblitz.com/edit/web-platform-8tiw5q?file=styles.css</a></p><p><strong>Font shorthand property 🔑</strong></p><p>font: font-style,font-variant,font-weight,font-size/line-height and font-family;</p><h4>Text color</h4><p>it defines the color 🌈 of the <strong>text</strong>.</p><p>color: red | #05ffb0 | rgb(50,115,220) | hsl(14,100%,53%);</p><pre>&lt;style&gt;<br>.a {<br>  color: red;<br>}<br>.b {<br>color: #05ffb0;<br>}<br>.c {<br>color: rgb(50,115,220);<br>}<br>.d {<br>color: hsl(14,100%,53%);<br>}<br>&lt;/style&gt;<br>&lt;p class=&quot;a&quot;&gt;This is paragraph&lt;/p&gt;<br>&lt;p class=&quot;b&quot;&gt;This is paragraph&lt;/p&gt;<br>&lt;p class=&quot;c&quot;&gt;This is paragraph&lt;/p&gt;<br>&lt;p class=&quot;d&quot;&gt;This is paragraph&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/233/1*eynWoiMdpVx1JZCO3CJj2Q.png" /></figure><h4>Text align</h4><p>Defines how the text content of the element is <strong>horizontally </strong>aligned.</p><p>text-align: left | center | right;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ortsRGtNqZfWyYbNFDO07Q.png" /></figure><h4>Text decoration</h4><p>Defines how the text content of the element is decorated.</p><ul><li>none: no line is drawn, and any existing decoration is removed.</li><li>underline: draws a 1px line across the text at its baseline.</li><li>line-through: draws a 1px line across the text at its <strong>middle</strong> point.</li><li>overline: draws a 1px line across the text, directly above its <strong>top</strong> point.</li><li>inherit: inherits the decoration of the parent.</li></ul><p>You can also use more than one property of text-decoration like below:</p><pre>&lt;style&gt;<br>h1 {<br>  text-decoration: overline;<br>}<br><br>h2 {<br>  text-decoration: line-through;<br>}<br><br>h3 {<br>  text-decoration: underline;<br>}<br><br>h4 {<br>text-decoration: none;<br>}<br><br>h5 {<br>  text-decoration: underline overline;<br>}<br>&lt;/style&gt;<br>&lt;h1&gt;This is heading 1&lt;/h1&gt;<br>&lt;h2&gt;This is heading 2&lt;/h2&gt;<br>&lt;h3&gt;This is heading 3&lt;/h3&gt;<br>&lt;h4&gt;This is heading 4&lt;/h4&gt;<br>&lt;h5&gt;This is heading 5&lt;/h5&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/309/1*JGN14v2fDuvKmM1cK4VCVQ.png" /></figure><p><strong>shorthand property 🔑</strong></p><pre>text-decoration: text-decoration-line text-decoration-color <br>                 text-decoration-style|initial|inherit<br>                 text-decoration-thickness;</pre><p>value of text-decoration-style are <strong>solid, dotted, wavy, double,</strong> and <strong>dashed.</strong></p><h4>Text indent</h4><p>The text-indent property specifies the indentation of the first line in a text-block. It specifies the amount of horizontal space that puts before the lines of text.</p><pre>&lt;style&gt;<br>p {<br>  text-indent: 80px;<br>}<br>&lt;/style&gt;<br>&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod<br> tempor incididunt.Lorem ipsum dolor sit amet, consectetur adipisicing elit,<br> sed do eiusmod tempor incididunt&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*P2VMbVA_-TJmGWyYNJZZCQ.png" /></figure><h4>Letter spacing</h4><p>The letter-spacing property controls the amount of space between each letter in a given element or block of text. Values supported by letter-spacing include font-relative values (em, rem), absolute values (px) and the normal property, which resets to the font’s default.</p><pre>h1 {<br>  letter-spacing: 3px;<br>}<br>h2 {<br>  letter-spacing: -1px;<br>}<br>&lt;h1&gt;This is heading 1&lt;/h1&gt;<br>&lt;h2&gt;This is heading 2&lt;/h2&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*i6Yf-D87OOnsMgDj9q6ixg.png" /></figure><h4>Word spacing</h4><p>The word-spacing property is used to specify the space between the words in a text.</p><pre>p.one {<br>  word-spacing: 10px;<br>}<br><br>p.two {<br>  word-spacing: -2px;<br>}<br>&lt;p&gt;This is a paragraph with normal word spacing.&lt;/p&gt;<br>&lt;p class=&quot;one&quot;&gt;This is a paragraph with larger word spacing.&lt;/p&gt;<br>&lt;p class=&quot;two&quot;&gt;This is a paragraph with smaller word spacing.&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*2569w4eSywkdJJIZhNzzeQ.png" /></figure><h4>White Space</h4><p>white-spacehelps control how whitespace and line breaks within an element’s text are treated.</p><ul><li><strong>normal</strong>: The default value. Multiple whitespaces are collapsed into one. The text wraps to the next line when needed.</li><li><strong>nowrap</strong>: Multiple whitespaces are collapsed into one, but the text doesn’t wrap to the next line.</li><li><strong>pre</strong>: Same results as using the&lt;pre&gt;where all the whitespaces will be kept as is and the text only wraps when line breaks are in the content.</li><li><strong>pre-line</strong>: Multiple whitespaces are collapsed into one, the text breaks to the next line when needed or with line breaks in the content.</li><li><strong>pre-wrap</strong>: Similar to pre, but the text also wraps when needed.</li></ul><p>Ref: <a href="https://www.digitalocean.com/community/tutorials/css-white-space-property">https://www.digitalocean.com/community/tutorials/css-white-space-property</a></p><h4><strong>Text transform</strong></h4><p>this property allows us to change the case of the text. It is used to control the text capitalization.</p><ul><li>capitalize: It transforms the first character of each word to uppercase.</li><li>uppercase : It transforms all characters of the word into uppercase.</li><li>lowercase : It transforms all characters of the word into lowercase.</li></ul><pre>&lt;style&gt;<br>div.a {<br>  text-transform: uppercase;<br>}<br><br>div.b {<br>  text-transform: lowercase;<br>}<br><br>div.c {<br>  text-transform: capitalize;<br>}<br>&lt;/style&gt;<br>&lt;h2&gt;uppercase&lt;/h2&gt;<br>&lt;div class=&quot;a&quot;&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/div&gt;<br>&lt;h2&gt;lowercase&lt;/h2&gt;<br>&lt;div class=&quot;b&quot;&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/div&gt;<br>&lt;h2&gt;capitalize&lt;/h2&gt;<br>&lt;div class=&quot;c&quot;&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*ElTeKBwxPcjdKQp_9ZPndw.png" /></figure><h4>Text shadow</h4><p>The text-shadow CSS property adds shadows to text. It accepts a comma-separated list of shadows to be applied to the text and any of its decorations.</p><p>Each shadow is described by some combination of X and Y offsets from the element, blur radius, and color.</p><pre>text-shadow: h-shadow v-shadow blur-radius color;</pre><pre>h1 {<br>  text-shadow: 2px 2px 8px #FF0000;<br>}<br>&lt;h1&gt;Text-shadow with blur effect&lt;/h1&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*LGE6HXyYPv__kycCI_iVag.png" /></figure><h4>Text Direction</h4><p>The direction CSS property sets the direction of text, table columns, and horizontal overflow. Use rtl for languages written from right to left (like Hebrew or Arabic), and ltr for those written from left to right (like English and most other languages).</p><pre>.rtl {<br>  direction: rtl;<br>}<br>&lt;p&gt;This text goes from left to right&lt;/p&gt;<br>&lt;p class=&quot;rtl&quot;&gt;This text goes from right to left.&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*_ZdiGYmw1dOEpWf-tp6KzA.png" /></figure><h4>unicode-bidi</h4><p>The unicode-bidi CSS property, together with the direction property, determines how bidirectional text in a document is handled. For example, if a block of content contains both left-to-right and right-to-left text, the user-agent uses a complex Unicode algorithm to decide how to display the text.</p><pre>unicode-bidi: normal | embed | isolate | bidi-override | isolate-override |<br>              plaintext</pre><pre>&lt;style&gt;<br>.ex1 {<br>  direction: rtl;<br>  unicode-bidi: bidi-override;<br>}<br>&lt;/style&gt;<br>&lt;p&gt;Some text. Default writing direction.&lt;/p&gt;<br>&lt;p class=&quot;ex1&quot;&gt;Some text. Right-to-left direction.&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*lYpzbdyfTjLp45tvc7NMfw.png" /></figure><blockquote>Warning: This property is intended for Document Type Definiton(DTD) designers. web designers and similar authors should not override it.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db00a7215a02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Box Model]]></title>
            <link>https://medium.com/@chirag-p/css-box-model-e47680e6899f?source=rss-75202af3dd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/e47680e6899f</guid>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Chirag Prajapati]]></dc:creator>
            <pubDate>Sat, 08 Jul 2023 13:01:55 GMT</pubDate>
            <atom:updated>2023-07-08T13:01:55.618Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eIHdkO6jQ_3JKzIH" /><figcaption>Photo by <a href="https://unsplash.com/@praveentcom?utm_source=medium&amp;utm_medium=referral">Praveen Thirumurugan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The CSS box model is a container that contains multiple properties including <strong>border</strong>, <strong>margin</strong>, <strong>padding</strong>, and the <strong>content </strong>itself. It is used to create the design and layout of web pages. According to the CSS box model, the web browser supplies each element as a square prism.</p><p>The following diagram illustrates how the CSS properties of width, height, padding, border, and margin dictate how much space an attribute will occupy on a web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*dMtsTfVfKftQnbzEzXJRkg.png" /></figure><p>These are the following properties in the CSS box model:</p><h4>Content</h4><p>The content area consists of content like image, text, or other forms of media content. The height and width properties help to modify the box dimensions.</p><h4>Padding</h4><p>The padding area is the space around the content area and within the border box. It can be applied to all sides of the box or to the specific, selected side(s) — top, right, bottom, and left.</p><h4>Border</h4><p>The border area surrounds the padding and the content and can be applied to all the sides of the box or to selected side(s) — top, right, bottom, and left.</p><h4>Margin</h4><p>The margin area consists of the space between the border and the margin. The margin does not possess its own background color and is completely transparent. It shows the background color of the element, like the body element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ITWlyvKLy9ekrnmw2ce2MA.png" /></figure><p>example:</p><pre>&lt;style&gt;<br>.container {<br>  width:320px;<br>  height:70px;<br>  margin: 0;<br>  padding:10px;<br>  border:5px solid black;<br>  background:wheat;<br>}<br>&lt;/style&gt;<br>&lt;div class=&quot;container&quot;&gt;<br>    Hello world....<br>&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*j4voe1qwQWWfpLCPvNXslA.png" /></figure><h3>So what is the total width and height of the div?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*Vzn0AzsfxSWR7P9Y-O2wdw.png" /></figure><p>so here is a calculation of the box model element’s properties:</p><pre>Total width = width + left padding + right padding + left border <br>                      + right border + left margin + right margin</pre><pre>Total height = height + top padding + bottom padding + top border <br>                      + bottom border + top margin + bottom margin</pre><blockquote><a href="https://web.dev/learn/css/box-model/">https://web.dev/learn/css/box-model/</a></blockquote><h3>Box-sizing property</h3><p>The CSS box-sizing property is used to specify how to calculate the total height and width of an element. It controls the size of an element with a specified height and width. It allows you to include the padding and border within the total height and width of the element.</p><p>Before starting with CSS box-sizing, let’s first understand what issue occurs if we don’t use this property and why it’s needed nowadays.</p><h4>Without box-sizing:</h4><pre>&lt;style&gt; <br>.div1 {<br>  width: 350px;<br>  height: 200px;<br>  border: 1px solid blue;<br>}<br><br>.div2 {<br>  width: 350px;<br>  height: 200px;  <br>  padding: 20px;<br>  border: 1px solid red;<br>}<br>&lt;/style&gt;<br>&lt;div class=&quot;div1&quot;&gt;This div is smaller (width is 350px and height is 200px).&lt;/div&gt;<br>&lt;br&gt;<br>&lt;div class=&quot;div2&quot;&gt;This div is bigger (width is also 350px and height is 200px).&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*Kh3mZT7vXV55UcP0a45aHA.png" /></figure><p>So here you can see the <strong>width </strong>and <strong>height </strong>calculation of element:</p><pre>actual width of an element&#39;s box : width + padding + border<br>  <br>actual height of an element&#39;s box : height + padding + border </pre><p>It means if we create a box of some specific height and width and then add padding and border to it, it will look wider than the actual width.</p><p>This issue can be resolved with the help of <strong>box-sizing</strong> property.</p><p>If you set box-sizing: border-box; on an element, padding and border are included in the width and height:</p><pre>&lt;style&gt; <br>.div1 {<br>  width: 350px;<br>  height: 200px;<br>  border: 1px solid blue;<br>  box-sizing: border-box;<br>}<br><br>.div2 {<br>  width: 350px;<br>  height: 200px;  <br>  padding: 20px;<br>  border: 1px solid red;<br>  box-sizing: border-box;<br>}<br>&lt;/style&gt;<br>&lt;div class=&quot;div1&quot;&gt;This div is smaller (width is 350px and height is 200px).&lt;/div&gt;<br>&lt;br&gt;<br>&lt;div class=&quot;div2&quot;&gt;This div is bigger (width is also 350px and height is 200px).&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*SgSR7Ve1XyQXauTgLpzFhA.png" /></figure><p>As we can see in the above output, we got both div with the same width.</p><p>Since the result of using the box-sizing: border-box is so much better, many developers want all elements on their pages to work this way.</p><p>Applying this to all elements is safe and wise:</p><pre>* {<br>  box-sizing: border-box;<br>}</pre><p>The box-sizing property can be used to adjust this behavior:</p><ul><li>content-box gives you the default CSS box-sizing behavior. If you set an element&#39;s width to 100 pixels, then the element&#39;s content box will be 100 pixels wide and the width of any border or padding will be added to the final rendered width making the element wider than 100px.</li><li>border-box tells the browser to account for any border and padding in the values you specify for an element&#39;s width and height. If you set an element&#39;s width to 100 pixels, that 100 pixels will include any border or padding you added, and the content box will shrink to absorb that extra width. This typically makes it much easier to size elements.</li><li>inherit: inherits the box sizing of the parent element.</li></ul><h3>Margin Collapse</h3><p>Collapsing margins happen when two vertical margins come in contact with one another. If one margin is greater than the other, then that margin overrides the other, leaving one margin.</p><p>In ohter words, adjacent margins can sometimes overlap. This is known as <strong>margin collapse</strong>, and it has a reputation for being quite dastardly.</p><p>Here’s a typical example, involving two sibling paragraphs:</p><pre>&lt;style&gt;<br>  p {<br>    margin-top: 24px;<br>    margin-bottom: 24px;<br>  }<br>&lt;/style&gt;<br>&lt;p&gt;Paragraph One&lt;/p&gt;<br>&lt;p&gt;Paragraph Two&lt;/p&gt;</pre><p>Instead of sitting 48px apart, their 24px margins merge together, occupying the same space!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*S12ZPRdty3OdgEaI7tkT5g.png" /></figure><p>Only vertical margins collapse. The left and right margins of the two horizontal elements will not collapse.</p><pre>&lt;style&gt;<br> p {<br>  display: inline-block;<br>  margin-left: 24px;<br>  margin-right: 24px;<br>}<br>&lt;/style&gt;<br>&lt;p&gt;Paragraph One&lt;/p&gt;<br>&lt;p&gt;Paragraph Two&lt;/p&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*9fKkkbcxj9SUFqt24ZsSiw.png" /></figure><p>Refference: <a href="https://www.joshwcomeau.com/css/rules-of-margin-collapse/">https://www.joshwcomeau.com/css/rules-of-margin-collapse/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e47680e6899f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>