<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Vinod Mathew Sebastian - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Vinod Mathew Sebastian - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 16 May 2026 16:29:07 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/vinodsebastian/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ Why You Should Use rem to Set Font Size in CSS ]]>
                </title>
                <description>
                    <![CDATA[ Setting font sizes is something you'll do often as a web developer. But sometimes, especially for beginners, this can get a bit tricky. In this article, I'll explain why I think you should always use rem over em for setting the font-size of an elemen... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/why-use-rem-to-set-font-size-in-css/</link>
                <guid isPermaLink="false">66d461759f2bec37e2da0672</guid>
                
                    <category>
                        <![CDATA[ CSS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Vinod Mathew Sebastian ]]>
                </dc:creator>
                <pubDate>Tue, 17 Jan 2023 21:33:17 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/01/em_vs_rem.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Setting font sizes is something you'll do often as a web developer. But sometimes, especially for beginners, this can get a bit tricky.</p>
<p>In this article, I'll explain why I think you should always use <code>rem</code> over <code>em</code> for setting the <code>font-size</code> of an element.</p>
<h2 id="heading-what-are-relative-units-in-css">What are Relative Units in CSS?</h2>
<p>For styling a webpage, we use relative units like <code>em</code> and <code>rem</code> instead of absolute measurements like <code>px</code> (pixels).</p>
<p>This is because nowadays, screen sizes come in different sizes and shapes. If we use <code>px</code>, the element's size remains constant regardless of the size of the screen. So using relative units like <code>em</code> and <code>rem</code> are considered good practice. (The <code>:root</code> size is still set in <code>px</code>. We need a reference point. Don't we?)</p>
<p>CSS units are thus classified into two ways: absolute and relative units. Pixels (<code>px</code>), points (<code>pt</code>), and picas (<code>pc</code>) fall under absolute units. The <code>%</code>, <code>em</code>, <code>rem</code>, <code>vh</code>, and <code>vw</code> are all relative units.</p>
<h2 id="heading-what-are-em-and-rem-units">What are <code>em</code> and <code>rem</code> Units?</h2>
<p>Talking about <code>em</code> and <code>rem</code>, in print typography <code>em</code> refers to the width of the capital letter 'M' of the current typeface.</p>
<p>In web design, <code>em</code> refers to the size of the current element. If the size of the current/parent element is not set, it usually defaults to the size in the browser CSS. It is usually 16px.</p>
<p>The <code>em</code> is not just for font-size. It is a relative unit that you can use to set the values of properties like font-size, margin, padding, width, height, and line-height of an element.</p>
<p>The <code>rem</code> is the root <code>em</code>. All values are relative to the topmost parent, the <code>html</code> or <code>:root</code> element. If not explicitly set for the <code>html</code> or <code>:root</code> element, it again defaults to the browser CSS: 16px.</p>
<p>You can use <code>rem</code> wherever you can use <code>em</code>.</p>
<h2 id="heading-when-is-rem-a-better-choice-than-em">When is <code>rem</code> a Better Choice than <code>em</code>?</h2>
<p>Now let's discuss why you should always use <code>rem</code>, instead of <code>em</code>, for setting the font-size of an element in CSS.</p>
<p>CSS styles cascade. That is why it is called <em>cascading</em> style sheets. If you inadvertently apply a <code>font-size</code> of <code>0.5em</code> again, the size reduces to 1/4th of the original.</p>
<p>Note: This happens only if you use relative units. Even if you apply an absolute unit (say <code>16px</code>) any number of times, for example, on the <code>font-size</code>, it will always remain the same. It would just be duplicate style declarations. The browser effectively ignores it.</p>
<p>Let me show you an example.</p>
<p>This is a simple webpage. Only one <code>h1</code>, <code>p</code>, and an <code>a</code> tag nested inside the <code>p</code> tag are inside it.</p>
<pre><code class="lang-typescript">&lt;!DOCTYPE html&gt;
&lt;html lang=<span class="hljs-string">"en"</span>&gt;
&lt;head&gt;
    &lt;meta charset=<span class="hljs-string">"UTF-8"</span>&gt;
    &lt;meta http-equiv=<span class="hljs-string">"X-UA-Compatible"</span> content=<span class="hljs-string">"IE=edge"</span>&gt;
    &lt;meta name=<span class="hljs-string">"viewport"</span> content=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;
    &lt;title&gt;Welcome - Difference between applying em and rem&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;h1&gt;The difference between em and rem <span class="hljs-keyword">in</span> the font size <span class="hljs-keyword">of</span> an element&lt;/h1&gt;
&lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Ad beatae alias adipisci placeat fuga maiores nobis aliquam, atque porro explicabo veritatis dolorum tenetur ullam <span class="hljs-keyword">in</span>?

&lt;a href=<span class="hljs-string">"#"</span>&gt;Click me!&lt;/a&gt;

&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>For an example, the <code>h1</code>, <code>p</code>, and <code>a</code> tags are all given a <code>font-size</code> value of <code>0.5em</code> to be displayed on a smaller screen.</p>
<pre><code class="lang-typescript"><span class="hljs-meta">@media</span> all and (max-width:<span class="hljs-number">768</span>px){

h1{
font-size:<span class="hljs-number">0.50</span>em;
}
p {
font-size:<span class="hljs-number">0.50</span>em;
}
a {
font-size:<span class="hljs-number">0.50</span>em;
}
}
</code></pre>
<p>Now see what happens. This is the mobile view (zoomed to 300%).</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/01/mobile_view_one-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The 'Click me!' inside the <code>a</code> tag is 1/4th the size of the original – and it's barely readable.</p>
<p>Immediately after applying <code>0.5em</code> to the <code>p</code> tag, <code>em</code> is now only <code>8px</code>.</p>
<p><code>16px x 0.5 = 8px</code></p>
<p>Since the <code>a</code> tag is nested inside the <code>p</code> tag, both styles cascade.</p>
<p><code>8px x 0.5 = 4px</code></p>
<p>The solution is to use <code>rem</code> for the <code>a</code> tag: <code>0.5rem</code>.</p>
<p>Please note that <code>h1</code> and <code>p</code> tags use <code>em</code> here for demonstration purposes.</p>
<pre><code class="lang-typescript"><span class="hljs-meta">@media</span> all and (max-width:<span class="hljs-number">768</span>px){
h1{
font-size: <span class="hljs-number">0.50</span>em;
}
p { 
font-size:<span class="hljs-number">0.50</span>em;
}
a {
font-size:<span class="hljs-number">0.50</span>rem;
}
}
</code></pre>
<p>Since we used <code>rem</code>, the <code>a</code> tag is relative to the <em>root</em> <code>em</code> – that is, it's set to 16px by default.</p>
<p><code>16px x 0.5 = 8px</code></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/01/mobile_view_final-7.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The <em>Click me!</em> <code>a</code> tag is styled more appropriately now.</p>
<p>Always remember that it is a good idea to use <code>rem</code> for setting the font size of an element as you saw here.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In some places, it's better to use <code>em</code>. But when you're setting the font size of an element, <code>rem</code> is the better choice.</p>
<p>Happy Coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Customize Bootstrap with Sass ]]>
                </title>
                <description>
                    <![CDATA[ Bootstrap is an awesome CSS framework that can help you create stylish and sleek websites. Some developers and teams find that code written in Bootstrap is easier to maintain than regular CSS, so they prefer Bootstrap to vanilla CSS. But if everyone ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-customize-bootstrap-with-sass/</link>
                <guid isPermaLink="false">66d461734bc8f441cb6df831</guid>
                
                    <category>
                        <![CDATA[ Bootstrap ]]>
                    </category>
                
                    <category>
                        <![CDATA[ CSS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Sass ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Vinod Mathew Sebastian ]]>
                </dc:creator>
                <pubDate>Tue, 21 Jun 2022 20:59:02 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/06/How_to_customize_Boostrap_with_Sass.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Bootstrap is an awesome CSS framework that can help you create stylish and sleek websites.</p>
<p>Some developers and teams find that code written in Bootstrap is easier to maintain than regular CSS, so they prefer Bootstrap to vanilla CSS.</p>
<p>But if everyone used Bootstrap with its default styles, then every site would look the same – and quickly, the internet would become pretty bland. Fortunately, Bootstrap is also highly customizable.</p>
<h2 id="heading-how-to-customize-bootstrap">How to Customize Bootstrap</h2>
<p>If you're a beginner, you can customize Bootstrap with a custom CSS stylesheet. CSS specificity is important here. You write custom CSS, with the same or higher specificity, and link to it in the head section of your index.html <em>after</em> the line which links to the original Bootstrap CSS.</p>
<pre><code class="lang-typescript">&lt;!-- index.html --&gt;
&lt;head&gt;

    &lt;link rel=<span class="hljs-string">"stylesheet"</span> href=<span class="hljs-string">"./node_modules/bootstrap/dist/css/bootstrap.min.css"</span>&gt;
    &lt;!-- custom CSS should come after Bootstrap CSS --&gt;
    &lt;link rel=<span class="hljs-string">"stylesheet"</span> href=<span class="hljs-string">"./custom.css"</span>

&lt;/head&gt;
</code></pre>
<p>For small tweaks this is OK. But for larger projects, this can be time-consuming and there may be a lot of redundant style declarations. So there has to be another, cleaner, way.</p>
<h3 id="heading-how-to-use-sass-with-bootstrap">How to Use Sass with Bootstrap</h3>
<p>The solution is to use Sass – a CSS preprocessor. Sass is compiled down to CSS before it's used on web pages.</p>
<p>Until Bootstrap version 3.x, you had a choice between CSS preprocessors: Less or Sass. But since version 4, Bootstrap uses only Sass. The source code for the Bootstrap 4 and 5 frameworks is written entirely in Sass, which is a testimony to how mature Sass has become.</p>
<p>You may have heard the tagline, "Sass is CSS with superpowers". If you want to learn Sass, the <a target="_blank" href="https://sass-lang.com">official</a> website is an excellent resource. You can also refer to other tutorials on freeCodeCamp, like this one on <a target="_blank" href="https://www.freecodecamp.org/news/how-to-use-sass-with-css/">how to use Sass with CSS</a>, or this video course on <a target="_blank" href="https://www.freecodecamp.org/news/learn-bootstrap-5-and-sass-by-building-a-portfolio-website/">how to use Sass with Bootstrap 5</a>.</p>
<p>Sass comes with two syntaxes. The older one uses indentation and the newer SCSS syntax (SCSS for Sassy CSS) uses CSS-like curly braces.</p>
<p>SCSS is a superset of CSS. So CSS code saved with a .scss extension (or SCSS interspersed with CSS) is also valid Sass code.</p>
<p>In this tutorial, we are going to use the SCSS version. Whatever the style is, indented Sass or CSS-like SCSS, the Sass compiler will transpile it to vanilla CSS to be used on the browser.</p>
<h3 id="heading-what-we-are-going-to-do-in-this-tutorial">What we are going to do in this tutorial</h3>
<ol>
<li><p>We will change the primary and secondary theme colors Bootstrap ships with.</p>
</li>
<li><p>We will also change the default media breakpoints Bootstrap uses.</p>
</li>
</ol>
<p>Once we can do these, it will become easy to do other customizations.</p>
<h3 id="heading-the-prerequisites">The Prerequisites</h3>
<ol>
<li><p>Node.js with npm or yarn</p>
</li>
<li><p>A code editor, preferably VS Code.</p>
</li>
<li><p>A basic understanding of Sass</p>
</li>
</ol>
<p>Download Bootstrap from the official website: <a target="_blank" href="https://getbootstrap.com">https://getbootstrap.com</a></p>
<p>Since we have Node.js installed, I'm going to use the npm version.</p>
<p><code>npm i bootstrap</code></p>
<p>We also need to install the Sass compiler. We can get the official dart-sass version from <a target="_blank" href="https://sass-lang.com">their website</a>. Whether you're on Windows, Mac, or Linux you just need to download the dart-sass package, unzip it, and add it to the path (environment variables).</p>
<p>There is a npm sass package. Also, there is a <em>Live Sass Compiler</em> VS Code extension with over 2 million installs. Feel free to use whatever Sass compiler you're comfortable with.</p>
<p>Here, we are going to use the npm package: sass.</p>
<p>After downloading Bootstrap, and the Sass compiler, in the <code>node-modules</code> directory, there is a folder named <code>bootstrap</code>.</p>
<p>There are also three folders inside it: <code>dist</code>, <code>js</code>, and <code>scss</code>.</p>
<p>All the compiled CSS is in <code>dist</code>, the Bootstrap JavaScript code in <code>js</code>, and all the Sass files are in the <code>scss</code> folder.</p>
<h3 id="heading-how-to-change-the-primary-and-secondary-theme-colors">How to change the primary and secondary theme colors</h3>
<p>For customization, our idea is to override the .scss files and recompile them.</p>
<p>The official Bootstrap documentation advises against changing the core bootstrap files whenever possible. So we are going to create a custom.scss stylesheet.</p>
<p>And we are going to import all of Bootstrap in the custom.scss file.</p>
<pre><code class="lang-typescript"><span class="hljs-comment">//custom.scss</span>

<span class="hljs-meta">@import</span> <span class="hljs-string">"../node_modules/bootstrap/scss/bootstrap"</span>;
</code></pre>
<p>Variables are suffixed with a <code>!default</code> (a Sass flag) in Bootstrap. The <code>!default</code> flag tells the compiler to set the value only if the value is not defined.</p>
<p>So, we set the variables before the @import directive so that, later, the compiler sets our value instead of the default ones.</p>
<pre><code class="lang-typescript"><span class="hljs-comment">//custom.scss</span>

$primary: teal;
$secondary: green;

<span class="hljs-meta">@import</span> <span class="hljs-string">"../node_modules/bootstrap/scss/bootstrap"</span>;
</code></pre>
<p>We also need an HTML file to preview the results.</p>
<pre><code class="lang-typescript">&lt;!-- index.html --&gt;
&lt;!DOCTYPE html&gt;
&lt;html lang=<span class="hljs-string">"en"</span>&gt;
&lt;head&gt;
    &lt;meta charset=<span class="hljs-string">"UTF-8"</span>&gt;
    &lt;meta http-equiv=<span class="hljs-string">"X-UA-Compatible"</span> content=<span class="hljs-string">"IE=edge"</span>&gt;
    &lt;meta name=<span class="hljs-string">"viewport"</span> content=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;
    &lt;title&gt;Welcome! Customize Bootstrap <span class="hljs-keyword">with</span> Sass&lt;/title&gt;
    &lt;link rel=<span class="hljs-string">"stylesheet"</span> href=<span class="hljs-string">"./node_modules/bootstrap/dist/css/bootstrap.min.css"</span>
&lt;/head&gt;
&lt;body&gt;
 &lt;div <span class="hljs-keyword">class</span>=<span class="hljs-string">"container"</span> &gt;
 &lt;div <span class="hljs-keyword">class</span>=<span class="hljs-string">"row"</span>&gt;
    &lt;nav <span class="hljs-keyword">class</span>=<span class="hljs-string">"navbar navbar-expand-lg navbar-light bg-primary"</span>&gt;
        &lt;div <span class="hljs-keyword">class</span>=<span class="hljs-string">"container-fluid"</span>&gt;
          &lt;a <span class="hljs-keyword">class</span>=<span class="hljs-string">"navbar-brand"</span> href=<span class="hljs-string">"#"</span>&gt;Customize Bootstrap&lt;/a&gt;
          &lt;button <span class="hljs-keyword">class</span>=<span class="hljs-string">"navbar-toggler"</span> <span class="hljs-keyword">type</span>=<span class="hljs-string">"button"</span> data-bs-toggle=<span class="hljs-string">"collapse"</span> data-bs-target=<span class="hljs-string">"#navbarSupportedContent"</span> aria-controls=<span class="hljs-string">"navbarSupportedContent"</span> aria-expanded=<span class="hljs-string">"false"</span> aria-label=<span class="hljs-string">"Toggle navigation"</span>&gt;
            &lt;span <span class="hljs-keyword">class</span>=<span class="hljs-string">"navbar-toggler-icon"</span>&gt;&lt;/span&gt;
          &lt;/button&gt;
          &lt;div <span class="hljs-keyword">class</span>=<span class="hljs-string">"collapse navbar-collapse"</span> id=<span class="hljs-string">"navbarSupportedContent"</span>&gt;
            &lt;ul <span class="hljs-keyword">class</span>=<span class="hljs-string">"navbar-nav me-auto mb-2 mb-lg-0"</span>&gt;
              &lt;li <span class="hljs-keyword">class</span>=<span class="hljs-string">"nav-item"</span>&gt;
                &lt;a <span class="hljs-keyword">class</span>=<span class="hljs-string">"nav-link active"</span> aria-current=<span class="hljs-string">"page"</span> href=<span class="hljs-string">"#"</span>&gt;Home&lt;/a&gt;
              &lt;/li&gt;
              &lt;li <span class="hljs-keyword">class</span>=<span class="hljs-string">"nav-item"</span>&gt;
                &lt;a <span class="hljs-keyword">class</span>=<span class="hljs-string">"nav-link"</span> href=<span class="hljs-string">"#"</span>&gt;Link&lt;/a&gt;
              &lt;/li&gt;
              &lt;li <span class="hljs-keyword">class</span>=<span class="hljs-string">"nav-item dropdown"</span>&gt;
                &lt;a <span class="hljs-keyword">class</span>=<span class="hljs-string">"nav-link dropdown-toggle"</span> href=<span class="hljs-string">"#"</span> id=<span class="hljs-string">"navbarDropdown"</span> role=<span class="hljs-string">"button"</span> data-bs-toggle=<span class="hljs-string">"dropdown"</span> aria-expanded=<span class="hljs-string">"false"</span>&gt;
                  Dropdown
                &lt;/a&gt;
                &lt;ul <span class="hljs-keyword">class</span>=<span class="hljs-string">"dropdown-menu"</span> aria-labelledby=<span class="hljs-string">"navbarDropdown"</span>&gt;
                  &lt;li&gt;&lt;a <span class="hljs-keyword">class</span>=<span class="hljs-string">"dropdown-item"</span> href=<span class="hljs-string">"#"</span>&gt;Action&lt;<span class="hljs-regexp">/a&gt;&lt;/</span>li&gt;
                  &lt;li&gt;&lt;a <span class="hljs-keyword">class</span>=<span class="hljs-string">"dropdown-item"</span> href=<span class="hljs-string">"#"</span>&gt;Another action&lt;<span class="hljs-regexp">/a&gt;&lt;/</span>li&gt;
                  &lt;li&gt;&lt;hr <span class="hljs-keyword">class</span>=<span class="hljs-string">"dropdown-divider"</span>&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a <span class="hljs-keyword">class</span>=<span class="hljs-string">"dropdown-item"</span> href=<span class="hljs-string">"#"</span>&gt;Something <span class="hljs-keyword">else</span> here&lt;<span class="hljs-regexp">/a&gt;&lt;/</span>li&gt;
                &lt;/ul&gt;
              &lt;/li&gt;
              &lt;li <span class="hljs-keyword">class</span>=<span class="hljs-string">"nav-item"</span>&gt;
                &lt;a <span class="hljs-keyword">class</span>=<span class="hljs-string">"nav-link disabled"</span> href=<span class="hljs-string">"#"</span> tabindex=<span class="hljs-string">"-1"</span> aria-disabled=<span class="hljs-string">"true"</span>&gt;Disabled&lt;/a&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
            &lt;form <span class="hljs-keyword">class</span>=<span class="hljs-string">"d-flex"</span>&gt;
              &lt;input <span class="hljs-keyword">class</span>=<span class="hljs-string">"form-control me-2"</span> <span class="hljs-keyword">type</span>=<span class="hljs-string">"search"</span> placeholder=<span class="hljs-string">"Search"</span> aria-label=<span class="hljs-string">"Search"</span>&gt;
              &lt;button <span class="hljs-keyword">class</span>=<span class="hljs-string">"btn btn-outline-success"</span> <span class="hljs-keyword">type</span>=<span class="hljs-string">"submit"</span>&gt;Search&lt;/button&gt;
            &lt;/form&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/nav&gt;
&lt;div <span class="hljs-keyword">class</span>=<span class="hljs-string">"container"</span>&gt;
&lt;div <span class="hljs-keyword">class</span>=<span class="hljs-string">"row"</span>&gt;

  &lt;div <span class="hljs-keyword">class</span>=<span class="hljs-string">"col-xl pt-3"</span>&gt;
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Vero, laborum hic, quia maiores animi nobis eligendi est eos saepe architecto reiciendis! Aliquam inventore distinctio reprehenderit corporis amet assumenda officiis dolorem, animi delectus sunt dolor commodi. Adipisci nam nemo labore eligendi quas, rem ipsum iusto eveniet itaque vero necessitatibus! Quas, cupiditate tempora unde nam exercitationem libero aut labore deserunt nesciunt voluptate dignissimos quis porro reprehenderit maiores excepturi, esse, nisi dolores sit tenetur voluptatum corrupti alias provident pariatur? Quam illo unde autem, fugit numquam dolores, odio sed rem saepe exercitationem fuga, nisi soluta sunt officiis! Similique, vero repudiandae quae dignissimos fuga natus!
    &lt;/div&gt;

  &lt;div <span class="hljs-keyword">class</span>=<span class="hljs-string">"col-xl pt-3 "</span>&gt;
    Lorem ipsum dolor sit, amet consectetur adipisicing elit. Numquam, aliquid, cumque nisi tenetur similique labore repudiandae voluptas qui hic blanditiis beatae sapiente autem dolore! Quam, cupiditate nostrum laboriosam blanditiis vel ratione, repellat, incidunt modi tempore soluta ab nesciunt? Ab similique illum suscipit exercitationem et, aut quisquam neque atque recusandae rem delectus facilis. Magnam rerum fugit minus explicabo vel! Hic quibusdam laudantium dolorum, pariatur ipsam veritatis voluptate animi, nesciunt dolorem autem dicta. Debitis quae nam dicta autem ipsum mollitia! Ipsum ipsa, molestias fugiat officiis aut illum ullam architecto maxime labore vitae. Ipsum quos neque rerum, esse iste quo explicabo eos ipsa?
    &lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;

&lt;div <span class="hljs-keyword">class</span>=<span class="hljs-string">"mt-5 pt-5 mb-5 text-center"</span>&gt;
  &lt;button <span class="hljs-keyword">type</span>=<span class="hljs-string">"button"</span> <span class="hljs-keyword">class</span>=<span class="hljs-string">"btn btn-primary"</span>&gt;Primary&lt;/button&gt;
  &lt;button <span class="hljs-keyword">type</span>=<span class="hljs-string">"button"</span> <span class="hljs-keyword">class</span>=<span class="hljs-string">"btn btn-secondary"</span>&gt;Secondary&lt;/button&gt;
  &lt;button <span class="hljs-keyword">type</span>=<span class="hljs-string">"button"</span> <span class="hljs-keyword">class</span>=<span class="hljs-string">"btn btn-success"</span>&gt;Success&lt;/button&gt;
  &lt;button <span class="hljs-keyword">type</span>=<span class="hljs-string">"button"</span> <span class="hljs-keyword">class</span>=<span class="hljs-string">"btn btn-danger"</span>&gt;Danger&lt;/button&gt;
  &lt;button <span class="hljs-keyword">type</span>=<span class="hljs-string">"button"</span> <span class="hljs-keyword">class</span>=<span class="hljs-string">"btn btn-warning"</span>&gt;Warning&lt;/button&gt;
  &lt;button <span class="hljs-keyword">type</span>=<span class="hljs-string">"button"</span> <span class="hljs-keyword">class</span>=<span class="hljs-string">"btn btn-info"</span>&gt;Info&lt;/button&gt;
  &lt;button <span class="hljs-keyword">type</span>=<span class="hljs-string">"button"</span> <span class="hljs-keyword">class</span>=<span class="hljs-string">"btn btn-light"</span>&gt;Light&lt;/button&gt;
  &lt;button <span class="hljs-keyword">type</span>=<span class="hljs-string">"button"</span> <span class="hljs-keyword">class</span>=<span class="hljs-string">"btn btn-dark"</span>&gt;Dark&lt;/button&gt;
  &lt;button <span class="hljs-keyword">type</span>=<span class="hljs-string">"button"</span> <span class="hljs-keyword">class</span>=<span class="hljs-string">"btn btn-link"</span>&gt;Link&lt;/button&gt;
&lt;/div&gt;

 &lt;/div&gt;

 &lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>We have not compiled Sass yet. To see the default styles, run <em>Live Server</em>.</p>
<p>If <em>Live Server</em> is not installed, you can download the free extension from the VS Code extensions marketplace.</p>
<p>This is what we see:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/default_theme-3.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>It is time to compile our custom Sass file.</p>
<p>Compilation syntax is simple: Specify the source and destination folders separated with a colon.</p>
<p>I have my custom.scss file in a folder called <code>custom_scss</code>.</p>
<p><code>sass custom_scss/custom.scss:assets/css/custom_bootstrap.css</code></p>
<p>After recompiling, we have the customized bootstrap in the <code>assets/css/custom_bootstrap.css</code> file.</p>
<p>Instead of the default bootstrap file, we are going to use this customized bootstrap stylesheet.</p>
<pre><code class="lang-typescript">&lt;!-- index.html --&gt;
&lt;head&gt;

&lt;link rel=<span class="hljs-string">"stylesheet"</span> href=<span class="hljs-string">"./assets/css/custom_bootstrap.css"</span>&gt; <span class="hljs-string">`

&lt;/head&gt;</span>
</code></pre>
<p>Then run the <em>Live Server</em> again.</p>
<p>We get the webpage customized with our new styles.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/custom_theme..png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-how-to-change-the-grid-breakpoints">How to change the grid breakpoints</h3>
<p>We'll now customize the media breakpoints. Alongside, we have to redefine container-max-widths also.</p>
<p>The easiest way is to simply override the variables:</p>
<pre><code class="lang-typescript">$primary: teal;
$secondary:green;

$grid-breakpoints: (
  xs: <span class="hljs-number">0</span>,
  sm: <span class="hljs-number">576</span>px,
  md: <span class="hljs-number">768</span>px,
  lg: <span class="hljs-number">992</span>px,
  xl: <span class="hljs-number">1280</span>px,
  xxl: <span class="hljs-number">1600</span>px
);

$container-max-widths: (
  sm: <span class="hljs-number">540</span>px,
  md: <span class="hljs-number">720</span>px,
  lg: <span class="hljs-number">960</span>px,
  xl: <span class="hljs-number">1220</span>px,
  xxl: <span class="hljs-number">1520</span>px
);

<span class="hljs-meta">@import</span> <span class="hljs-string">'../node_modules/bootstrap/scss/bootstrap'</span>
</code></pre>
<p>Since this would violate DRY principles (Don't Repeat Yourself), using the <code>map-merge()</code> function is a better option.</p>
<p>We have to import functions first in the custom.scss file to make <code>map.merge()</code> available.</p>
<p>We have to import variables also because $grid-breakpoints (to be used inside the function) is defined there.</p>
<pre><code class="lang-typescript"><span class="hljs-comment">//custom.scss</span>

$primary: teal;
$secondary: green;

<span class="hljs-meta">@import</span> <span class="hljs-string">'../node_modules/bootstrap/scss/functions'</span>;
<span class="hljs-meta">@import</span> <span class="hljs-string">'../node_modules/bootstrap/scss/variables'</span>;
</code></pre>
<p>This is the code:</p>
<pre><code class="lang-typescript"><span class="hljs-comment">//custom.scss</span>

$primary: teal;
$secondary: green;

<span class="hljs-comment">//We have to import the functions first to use map.merge()</span>

<span class="hljs-meta">@import</span> <span class="hljs-string">'../node_modules/bootstrap/scss/functions'</span>;

<span class="hljs-comment">// We have to import the variables beforehand to </span>
<span class="hljs-comment">//use the variable $grid-breakpoints.</span>
<span class="hljs-comment">// Otherwise, compiler will show error - '$grid-breakpoints </span>
<span class="hljs-comment">//undefined.'</span>

<span class="hljs-meta">@import</span> <span class="hljs-string">'../node_modules/bootstrap/scss/variables'</span>;

$new-breakpoints: (
    xl: <span class="hljs-number">1280</span>px,
    xxl:<span class="hljs-number">1600</span>px
);

$grid-breakpoints: map-merge($grid-breakpoints, $new-breakpoints);

$new-container-max-widths: (
  xl: <span class="hljs-number">1220</span>px,
  xxl:<span class="hljs-number">1520</span>px
);

$container-max-widths: map-merge($container-max-widths, $new-container-max-widths);

<span class="hljs-meta">@import</span> <span class="hljs-string">"../node_modules/bootstrap/scss/bootstrap"</span>;
</code></pre>
<p>We compile again and use the newest file in place of the older one.</p>
<p><code>&lt;link rel="stylesheet" href="./assets/css/custom_bootstrap.css"&gt;</code></p>
<p>This is the final result:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/custom_theme_with_custom_breakpoints-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>It is not just theme colors and media breakpoints. Borders, spacing, box-shadow, fonts, icons...you can customize anything.</p>
<p>I have put up all the above code in this GitHub <a target="_blank" href="https://github.com/vinod-vms/Customize_Bootstrap_with_Sass">repo</a>.</p>
<p>For exploring further, the official Bootstrap <a target="_blank" href="https://getbootstrap.com/docs/5.0/getting-started/introduction/">documentation</a> is an excellent resource in this regard.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this tutorial, I've shown you how we can use Sass to customize Bootstrap.</p>
<p>Even if we are in a project that uses React with Bootstrap, the idea is the same. Create a custom .scss file, make customizations, import bootstrap, recompile, and then link to the customized file in place of the original bootstrap file.</p>
<p>Happy Learning!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Bash Command Line Tips to Help You Work Faster ]]>
                </title>
                <description>
                    <![CDATA[ Learning the command line is essential for any aspiring developer. And to execute commands on the command line, you need a shell. The Bash shell is popular in Unix-like operating systems like Mac and Linux. In fact in most Linux distros, Bash is the ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/bash-command-line-tips-to-help-you-work-faster/</link>
                <guid isPermaLink="false">66d4617055db48792eed3fb3</guid>
                
                    <category>
                        <![CDATA[ Bash ]]>
                    </category>
                
                    <category>
                        <![CDATA[ command line ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Productivity ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Vinod Mathew Sebastian ]]>
                </dc:creator>
                <pubDate>Mon, 02 May 2022 19:56:22 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/04/Bash-1.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Learning the command line is essential for any aspiring developer.</p>
<p>And to execute commands on the command line, you need a shell.</p>
<p>The Bash shell is popular in Unix-like operating systems like Mac and Linux. In fact in most Linux distros, Bash is the default shell.</p>
<p>You can also use Bash in Windows via WSL (Windows Subsystem for Linux).</p>
<p>After learning some basic Bash commands, it's time to get up to speed.</p>
<p>This tutorial is not for absolute beginners, but I hope both novices and advanced users might get something out of it.</p>
<p>Here are the 10 Bash commands that'll help you work faster with your terminal.</p>
<h2 id="heading-1-use-control-l-to-clear-the-screen-and-control-d-to-exit">1. Use Control + L to clear the screen and Control + D to exit</h2>
<p>To clear the terminal screen, type <code>clear</code> on the command line.</p>
<p>To exit, type <code>exit</code>.</p>
<p>Better still, pressing Ctrl + l ( ⌘ + l ) clears the screen and Ctrl + d (⌘ + d) closes the terminal.</p>
<h2 id="heading-2-use-the-nohup-command-to-spawn-processes-that-dont-end-with-the-terminal-session">2. Use the <code>nohup</code> command to spawn processes that don't end with the terminal session</h2>
<p>Once programs are loaded into memory, they are called processes.</p>
<p>Sometimes, I open Firefox from the command line:<br><code>firefox https://freecodecamp.org</code>.</p>
<p>But as soon as I close the terminal, Firefox also crashes.</p>
<p>To prevent this, use the <code>nohup</code> (no hang up) command: <code>nohup firefox https://freecodecamp.org</code>.</p>
<p>Now when I close the terminal, Firefox doesn't crash but my tab crashes.</p>
<p>The fix: make Firefox a background process by appending the <code>&amp;</code> symbol.</p>
<p><code>nohup firefox https://freecodecamp.org &amp;</code></p>
<p>Now even if I quit the terminal, my tabs are all intact.</p>
<h2 id="heading-3-use-pkill-to-kill-processes-by-typing-in-only-a-part-of-the-name">3. Use <code>pkill</code> to kill processes by typing in only a part of the name</h2>
<p>By using the <code>killall</code> command, we can kill a process by its name:</p>
<p><code>killall firefox</code></p>
<p>Better still, use <code>pkill</code> to terminate by typing only a part of the name.</p>
<p><code>pkill fire*</code></p>
<h2 id="heading-4-prepend-the-time-command-to-know-how-fast-something-executes">4. Prepend the <code>time</code> command to know how fast something executes</h2>
<p>Do you want to know how long it takes something to execute in the shell?</p>
<p>Just prepend <code>time</code> to the command: <code>time gcc -g *.c</code>.</p>
<h2 id="heading-5-on-linux-use-cat-etcrel-to-view-the-distro-name">5. On Linux, use <code>cat /etc/*rel*</code> to view the distro name</h2>
<p>Typing <code>uname -a</code> shows the system information.</p>
<p>Wanna double check what distro you're running?</p>
<p>Just type <code>cat /etc/*rel*</code> on the shell and press enter.</p>
<h2 id="heading-6-use-the-sed-command-in-text-files-to-find-and-replace">6. Use the <code>sed</code> command in text files to find and replace</h2>
<p>Do you want to replace multiple occurrences of a word in a text file?</p>
<p>Use the <code>sed</code> command.</p>
<p><code>sed s'/apples/oranges/g' myfile.txt</code></p>
<p>Here, all the occurrences of the word 'apples' are changed into 'oranges'.</p>
<p>If you only need to replace the first occurrence in every line, just take out the 'g' suffix at the end: <code>sed s'/apples/oranges/' myfile.txt</code>.</p>
<p>The 'g' is for <em>global.</em></p>
<p>The forward slash <code>/</code> is the delimiter. In fact, you can use any delimiter.</p>
<p>Let's use a single underscore <code>_</code> as the delimiter: <code>sed s'_apples_oranges_'g</code> myfile.txt`.</p>
<p>Simply using <code>sed</code> only replaces on the standard output. The original file is unchanged.</p>
<p>To change the file 'in place', use the <code>-i</code> flag: <code>sed -i s'_apples_oranges_g' myfile.txt</code>.</p>
<h2 id="heading-7-know-the-public-ip-address-of-your-computer-using-curl">7. Know the public IP address of your computer using <code>curl</code></h2>
<p>There are two types of IP addresses: private and public.</p>
<p>A system assigns internal IP addresses which can be checked using the <code>ifconfig</code> command.</p>
<p>But do you want to know the public IP of your computer – the IP address that the ISP assigns to your interface?</p>
<p>While online, just use <code>curl ifconfig.me ; echo</code> or <code>curl ifconfig.co ; echo</code> on the command line.</p>
<h2 id="heading-8-use-ctrl-r-r-for-reverse-search">8. Use Ctrl + R (⌘ + R) for reverse search</h2>
<p>Pressing the 'up' arrow key shows the last command you've typed.</p>
<p>Typing <code>history</code> shows all the commands you have typed that are stored in bash history.</p>
<p>Better still, type Ctrl + r (⌘ + r) on the shell and start typing in the command.</p>
<p>As you type, the shell autocompletes from history. Press 'enter' as soon as you find the match.</p>
<p><strong>If you remember only one thing from this tutorial, remember this key combination: Ctrl + r (⌘ + r).</strong></p>
<p>It will save you a lot of time, guaranteed!</p>
<h2 id="heading-9-use-the-shell-for-doing-math">9. Use the shell for doing math</h2>
<p>For simple calculations that don't input or output fractions, you can simply use:</p>
<pre><code class="lang-typescript">:~$ echo $((<span class="hljs-number">19</span>*<span class="hljs-number">34</span>))
:~$ <span class="hljs-number">646</span>
</code></pre>
<p>For calculations that involve fractions, just <code>echo</code> the expression and pipe it into the <code>bc</code> command.</p>
<pre><code class="lang-typescript">:~$ echo <span class="hljs-string">"scale=2; 9*3/((2*2)+1)"</span> | bc
:~$ <span class="hljs-number">5.40</span>
</code></pre>
<p>Here, 'scale' is the precision we need. I have specified it to be two decimal points.</p>
<h2 id="heading-10-use-brace-expansion-to-create-files-in-bulk">10. Use brace expansion to create files in bulk</h2>
<p>How do we create 100 files inside a folder?</p>
<p><em>file1.txt, file2.txt, file3.txt ... file100.txt</em></p>
<p>By using brace expansion: <code>touch file{1..100}.txt</code>.</p>
<p>We need to create three files for our project: app.html, app.css, and app.js</p>
<p>Instead of creating one by one, we can simply use brace expansion to create all of them in one go.</p>
<pre><code class="lang-typescript">:~$ touch app.{html,css,js}
:~$ ls
app.html app.css app.js
:~$
</code></pre>
<p>Or inside the project folder, we need to create five directories: images, css, src, templates, and scripts.</p>
<p>We can use:</p>
<pre><code class="lang-typescript">:~$ mkdir {images,css,src,templates,scripts}
:~$ ls
images css src templates scripts
:~$
</code></pre>
<p>Only one caveat here: just ensure that there are no spaces between the words inside the braces.</p>
<h2 id="heading-wrapping-up">Wrapping up</h2>
<p>I have listed 10 Bash command line tips by which you can work up to speed on the terminal.</p>
<p>Learn these Bash commands and it will hold you in good stead in your programming journey.</p>
<p>Happy Coding!</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
