<?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 Sachin Kumar Tiwari on Medium]]></title>
        <description><![CDATA[Stories by Sachin Kumar Tiwari on Medium]]></description>
        <link>https://medium.com/@sachinkumartiwari363?source=rss-4b29b6622d28------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*tTFWkiz1zgSKc8Kw6kIeDg.jpeg</url>
            <title>Stories by Sachin Kumar Tiwari on Medium</title>
            <link>https://medium.com/@sachinkumartiwari363?source=rss-4b29b6622d28------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 22:54:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sachinkumartiwari363/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[Components Basics in Vue.JS]]></title>
            <link>https://medium.com/altcampus/components-basics-in-vue-js-3037e7a0de8?source=rss-4b29b6622d28------2</link>
            <guid isPermaLink="false">https://medium.com/p/3037e7a0de8</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[components]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sachin Kumar Tiwari]]></dc:creator>
            <pubDate>Sun, 03 Feb 2019 11:00:39 GMT</pubDate>
            <atom:updated>2019-02-03T11:00:39.980Z</atom:updated>
            <content:encoded><![CDATA[<p>Before starting first know, <br><strong>What are the Components</strong>? <br>Components are the most powerful features of Vue, It helps to extend basic HTML elements to encapsulate reusable and more readable code. To create a Vue Component do the following.</p><h4>Creating Components:-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*hhk4rwLcXnvV3ghBxrdRbQ.png" /></figure><p>The <strong><em>template key </em></strong>is where you write your markup for that component. In the same Object, you can add functionalities later. You can create an instance of your component by adding <strong><em>&lt;my-component&gt;&lt;/my-component&gt; </em></strong>in<strong><em> </em></strong>the HTML.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*ML4Xml2d72bVmGh2AwjTAg.png" /></figure><p>This will result in the following on the page:</p><pre>A Custom Component!</pre><h4>Reusing Components:-</h4><p>Components can be reused as many times as you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*Ekzv_M9w-xemInruvlflBw.png" /></figure><p>Each time you use a component, a new <strong><em>Instance </em></strong>of<strong><em> </em></strong>the<strong><em> </em></strong>component<strong><em> </em></strong>is created.</p><h4>Organizing Components:-</h4><p>In an app, there can be organized nested components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tcCCad_CaubX2zgB6e_Slg.png" /><figcaption><strong>Organized nested Components in an app</strong></figcaption></figure><p>For example, You might have components for a Header, Footer, Sidebar, etc. and each can contain other components like Navigation Links, posts, etc.<br>To use these components in templates, they must be registered so that Vue knows about them. There are two types of component registration: global and local. Currently, we are only registering components globally, using <strong><em>Vue.component.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*QhKaCfP_87TWSLKSXd1KwA.png" /></figure><p>Globally registered components can be used in the template of any root Vue instance ( <strong><em>new Vue</em></strong> ) created afterward — and even inside all subcomponents of that Vue instance’s component tree. If you want to know more, you can go through <a href="https://vuejs.org/v2/guide/components-registration.html"><strong><em>Component Registration</em></strong></a></p><h4>Passing Data to Child Components using Props:-</h4><p>Props are custom attributes. it can be registered to a component. When a value is passed to a prop attribute, it becomes a property of that component.<br>To pass a title to our ‘<strong><em>my-component</em></strong>’ component, we can include it in the list of props this component accepts, using a <strong><em>props</em></strong> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*MLPbZ9QL2HKUtLPsunh6lQ.png" /></figure><p>A component can have many props as you’d like, any value can be passed to any prop. <br>Once a prop is registered, you can pass data to it as a custom attribute. as following:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yrzabk4L-3yDLGv6AUPg4w.png" /></figure><p>This will result in the following on the page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/169/1*KzbubpLqp5na7PIOfilR5g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3037e7a0de8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altcampus/components-basics-in-vue-js-3037e7a0de8">Components Basics in Vue.JS</a> was originally published in <a href="https://medium.com/altcampus">AltCampus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Novice Guide for JavaScript Class Patterns]]></title>
            <link>https://medium.com/altcampus/a-novice-guide-for-javascript-class-patterns-438e9aa25a69?source=rss-4b29b6622d28------2</link>
            <guid isPermaLink="false">https://medium.com/p/438e9aa25a69</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[class-patterns]]></category>
            <dc:creator><![CDATA[Sachin Kumar Tiwari]]></dc:creator>
            <pubDate>Mon, 26 Nov 2018 20:11:38 GMT</pubDate>
            <atom:updated>2018-11-27T18:14:14.287Z</atom:updated>
            <content:encoded><![CDATA[<p>In JavaScript, there are a lot of ways to make classes. first what is the class?<br><strong>JavaScript</strong> is an <strong>Object-based</strong> language, and every object in <strong>JavaScript</strong> has a hidden internal property called <strong>Prototype</strong> that can be used to extend object properties and methods. when We’ll check:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*6YvQHlJbMG4vpUzcwiOjWQ@2x.png" /></figure><blockquote>function sayHello() {return ‘Hello World’};<br>sayHello.prototype</blockquote><p>we’ll see something like this:</p><blockquote>{constructor: f}</blockquote><p>It means it’s an object when we’ll open <strong>{constructor: f}</strong>we’ll see another Object <strong>__proto__</strong> and every object has that hidden property that looks something like this :</p><blockquote>__proto__: {//some methods and function}</blockquote><p>There are 4 ways to make classes.</p><p><strong>1</strong>:- <strong>Factory Class </strong><br><strong>2</strong>:- <strong>Prototype-based</strong> <strong>( Pseudoclassical Pattern)</strong><br><strong>3</strong>:- <strong>Class Constructor</strong></p><h3>1:- Factory Class</h3><p>A <strong>factory</strong> function is a function that returns a (presumably new) object. In <strong>JavaScript</strong>, any function can return an object. When it does so without the <strong>new</strong> keyword, it’s a <strong>factory</strong> function. for better understanding see the example below:</p><pre>function createAnimal(name, age) {<br>  let animal = Object.create({});<br>  animal.name = name;<br>  animal.age = age;<br>  return animal;<br>}</pre><pre>let dog = createAnimal(&#39;Dog&#39;, 15);<br>console.log(dog);</pre><p>here we are creating a function which name is <strong>createAnimal</strong> and we are passing two parameter <strong>name</strong> and <strong>age</strong> in it. now when we are calling the function a local execution context is created. inside this local execution context a local memory (it stores all the variables of function scope) will be created where it sees that there is a variable (which name is <strong>animal</strong>), because we are using Object.create() with an empty ({}) object. so now animal will be Object, now we are assigning property name and age and then we are returning Object (animal), now the value is returned and stored in a variable dog (execution context is deleted when the function returns something).</p><h3>2:- Prototype-based ( Pseudoclassical Pattern)</h3><p>In prototypal based class we use a <strong>new</strong> keyword for creating Objects. now, what new do? it creates a new plain object then it creates a link between function and that new Object now we can set the prototype for adding methods (Object property which contains function as value). and in last we have to return an object for getting the value.</p><pre>function CreateAnimal(name, age) {<br>  this.name = name;<br>  this.age = age;<br>}<br>var dog = new CreateAnimal(&#39;dog&#39;, 10);<br>console.log(dog);<br>// CreateAnimal {name: &#39;dog&#39;, age: 10}</pre><p>we created a function CreateAnimal which is taking two parameters name and age, when we call the function with <strong>new</strong> keyword it is going to create a new empty object, then we are passing the argument ‘dog’ and 10. now as we know when a function is called a local execution is going to create. inside execution context there will be a local memory, inside local memory it will store name = dog and age = 10 and it will return an object with variable ‘name’ and ‘dog’ as the key of an object and ‘dog’ and 10 as value and it will be stored in object dog. now execution context will be deleted. <br>Now how to set method in an object using prototype.</p><pre>CreateAnimal.prototype.eat = function() {<br>  return `${this.name} eats`;<br>}<br>CreateAnimal.prototype.move = function() {<br>  return `${this.name} moves`;<br>}</pre><p>we take our function name CreateAnimal and access prototype using dot (because a function is an Object in javascript and prototype is the property of function) and now we are setting property ‘eat’ which value is a function, now go inside eat method (function) and we see <strong>this.name</strong> here this is referring to the instance of Object which is created by using the new keyword, and in the next function move we are doing the same thing.</p><pre>var cat = new CreateAnimal(&#39;Poo&#39;, 5)<br>console.log(cat)</pre><p>we are creating a new object cat. when we console log our object cat it is going to return an object with name and age and its values, but wait when we see inside our object there is another object <strong>__proto__</strong> (it’s hidden property of object) and inside proto there is our method eat and move with its value (function), because prototype is creating a link between function and object.</p><p>Now we want to create a new category of only herbivores animals which will also have some special properties like they eat grass etc.</p><pre>function CreateHerbivores(name, age) {<br>  this.name = name;<br>  this.age = age;<br>}</pre><p>we want to link our function CreateHerbivores to CreateAnimal function so we can access it’s property also. we can do something like this:</p><pre>CreateHerbivores.prototype.__proto__ = CreateAnimal.prototype;</pre><p>here, what’s happening? we have a function CreateHerbivores which has property prototype (it’s an Object), now we are accessing of __proto__ (hidden property of every Object) and assigning to the prototype of function CreateAnimal. now, it’ll create a link between these two functions. now we can access the property of function CreateAnimal.</p><p>let’s create a new object:</p><pre>var cow = new CreateHerbivores(&#39;Cow&#39;, 20);<br>console.log(cow);</pre><p>we created a new object cow, now because we created a link between function CreateHerbivores and function CreateAnimal, we want to access the property of CreateAnimal we can do something like this.</p><pre>cow.eat()</pre><p>it’ll return “Cow eats”. what’s happening here it will check if there is any property called eat in Object cow it’ll find here so it will go linkage and there is eat property in CreateAnimal so it’ll return the value of the function.</p><h3>Pseudoclassical Pattern</h3><p>It works like same as Prototype-based class, in Pseudoclassical Pattern we create the instance of Object by using the <strong>new</strong> keyword. there is only one difference between Pseudoclassical Pattern and Prototype-based class of linkage. in Prototype-based class, we are changing the __proto__ object of function CreateHerbivores to the prototype of function CreateAnimal. and here in Pseudoclassical Pattern, we will use <strong>call()*</strong> for creating linkage. also, we can use this:</p><blockquote><strong>CreateHerbivores.prototype.__proto__ = Object.create(CreateAnimal.prototype);</strong></blockquote><p>we can also use this code for creating linkage between __proto__ of CreateHerbivores function and CreateAnimal function.</p><blockquote>Note:- * The <strong>call()</strong> method calls a function with a given this value and arguments provided individually. <br>reference:- <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call</a></blockquote><p>take above example we’ll make it in the Pseudoclassical way.</p><pre>function CreateAnimal(name, age) {<br>  this.name = name;<br>  this.age = age;<br>}</pre><p>we are creating function CreateAnimal which is taking two parameter name and age (here <strong>this</strong> is the instance of Object). now, we want to add the new property of function CreateAnimal <strong>eat</strong> and <strong>move.</strong></p><pre>CreateAnimal.prototype.eat = function() {<br>  return `${this.name} eats`;<br>}<br>CreateAnimal.prototype.move = function() {<br>  return `${this.name} moves`;<br>}</pre><p>it’ll set these methods eat and move inside the prototype of CreateAnimal function. now we’ll create a new function.</p><pre>function CreateHerbivores(name, age) {<br>  CreateAnimal.call(this, name, age);<br>}<br>CreateHerbivores.prototype.__proto__ = CreateAnimal.prototype;<br>CreateHerbivores.prototype.eatGrass = function() {<br>  return `${this.name} eats grass`;<br>}</pre><pre>let rabbit = new CreateHerbivores(&quot;Rabbit&quot;, 20);<br>console.log(rabbit);</pre><p>in this function we are calling the Parent function (CreateAnimal) with the call() method and inside <strong>CreateAnimal.call(this, name, age); </strong>this will refer to the instance of CreateAnimal. <strong>CreateHerbivores.prototype.__proto__ = CreateAnimal.prototype;</strong> in this line we’re creating the linkage. then we are making a method eatGrass in CreateHerbivores function. when we’ll run this code. we’ll see something like this:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*qIVl_n3wNkU0Rt0FLpRi1g.png" /></figure><p>now we can access property from its parent function CreateAnimal, because of linkage.</p><h3>3:- Class Constructor</h3><p>The “class” construct allows to define prototype-based classes with a clean, nice-looking syntax.</p><pre>class CreateAnimal {<br>  constructor(name, age) {<br>    this.name = name;<br>    this.age = age;<br>  }<br>  eat() {<br>    return `${this.name} eats`;<br>  } <br>  move() {<br>    return `${this.name} moves`;<br>  }<br>}</pre><p>in this pattern, we use “class” keyword to define a function and in “constructor” we pass parameters, here in our function CreateAnimal we are passing two parameters name and age and in next line, we are assigning the value with this(here this refers to the instance of object which is created by using new keyword). and we are making two functions eat and move. now we’ll create a new class and will link to CreateAnimal function.</p><pre>class CreateHerbivores extends CreateAnimal{<br>  constructor(name, age) {<br>     super(name, age);<br>  }<br>  eatGrass() {<br>      return `${this.name} eats grass`;<br>  } <br>}</pre><p>here extends will inherit the property of its parent, so CreateHerbivores will inherit the property of CreateAnimal. here The <strong>super</strong>() keyword is used in order to call the methods of the parent class and we are making a function eatGrass.</p><p>Now we’ll create a new instance of Object.</p><pre>let rabbit = new CreateHerbivores(&quot;Rabbit&quot;, 20);<br>console.log(rabbit)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*rRqN-I79zDw5_Az_ed1EKw.png" /></figure><p>here we can see its creating a new Object and stored in variable rabbit, and inside the __proto__ of object It’s creating a linkage to its parent function CreateAnimal and inside __proto__ of CreateAnimal function we can see our eat and move function is here. now if we want to access any property from CreateAnimal function, we can do something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*ayswKxDzN-LZ634T3yE38g.png" /></figure><p>it will go inside CreateHerbivores Object and look for move function, it’ll find it inside object then it will go inside __proto__ and look for it, if it’s not here, then it’ll go inside linkage of CreateAnimal function and it’ll return the value. what if there is no method called move, then it’ll return undefined.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=438e9aa25a69" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altcampus/a-novice-guide-for-javascript-class-patterns-438e9aa25a69">A Novice Guide for JavaScript Class Patterns</a> was originally published in <a href="https://medium.com/altcampus">AltCampus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS UNITS]]></title>
            <link>https://medium.com/altcampus/css-units-e5c6151dcb44?source=rss-4b29b6622d28------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5c6151dcb44</guid>
            <category><![CDATA[css-units]]></category>
            <dc:creator><![CDATA[Sachin Kumar Tiwari]]></dc:creator>
            <pubDate>Wed, 26 Sep 2018 11:29:15 GMT</pubDate>
            <atom:updated>2018-09-27T18:20:44.825Z</atom:updated>
            <content:encoded><![CDATA[<p>Before digging into CSS properties, first, we need to know what is units and what does it do. CSS has a lot of units for expressing a length. A length is a number followed by length units, such as 10px, 2em, etc. There should not be any white spaces between the number and the unit.<br>Many CSS properties take “length” values like width, margin, padding, font-size, etc.<br>There are two types of length units: absolute and relative.</p><h4>Absolute Lengths:-</h4><p>These are fixed units, and a length expressed in any of these will appear exactly at that size.</p><blockquote>cm<br>length in centimeters</blockquote><blockquote>mm<br>length in millimeters</blockquote><blockquote>inch<br>length in inches (1inch = 96px = 2.54cm)</blockquote><blockquote>px<br>It is relative to the viewing device. 1px is one device pixel (dot) of the display.<br>(1px = 1/96th of 1inch)</blockquote><blockquote>pt<br>length in points. (1pt = 1/72 of 1inch)</blockquote><blockquote>pc<br>length in picas. (1pc = 12pt)</blockquote><h4>Relative Lengths:-</h4><p>It specifies a length relative to another length property.</p><blockquote>em<br>Relative to the size of the element. (2em means 2 times the size of the current font).</blockquote><blockquote>ex<br>Relative to the x-height of the current font.</blockquote><blockquote>ch<br>Relative to the width of the “0” (zero).</blockquote><blockquote>rem<br>Relative to font-size of the root element.</blockquote><blockquote>vw<br>Relative to 1% of the width of the viewport*.</blockquote><blockquote>vh<br>Relative to 1% of the height of the viewport*.</blockquote><blockquote>vmin<br>Relative to 1% of the viewport’s* smaller dimension.</blockquote><blockquote>vmax<br>Relative to 1% of the viewport’s* larger dimension.</blockquote><blockquote>%<br>Relative to the parent element.</blockquote><blockquote><strong>Tip:</strong> The em and rem units are practical in creating perfectly scalable layout!<br><strong>*</strong> <strong>Viewport</strong> = the browser window size. If the viewport is 50cm wide, 1vw = 0.5cm.</blockquote><p>EX:-</p><pre>&lt;style&gt;<br>.parent {<br>    font-size: 20px;<br>    }<br>.child {<br>    font-size: 2em;<br>    }<br>.para {<br>    font-size: 12px;<br>    }<br>&lt;/style&gt;<br>&lt;div class=&quot;parent&quot;&gt;<br>    &lt;p&gt; This is a parent paragraph.&lt;/p&gt;<br>    &lt;div class=&quot;child&quot;&gt;<br>        &lt;p&gt; This is a child paragraph.&lt;/p&gt;<br>    &lt;/div&gt;<br>    &lt;p class=&quot;para&quot;&gt; The size of this paragraph is not affected by parent size.&lt;/p&gt;<br>&lt;/div&gt;</pre><p>In the above example, the parent paragraph will always be 20px, but the child paragraph will be <strong>2em </strong>(or 200 percent) of the parent paragraph. By changing the parent’s font-size will affect the child paragraph size. The third paragraph (which class is “para”) is also using a “fixed” unit, therefore changing the parent size has no effect on it.</p><h4>CSS Units for font-size: px|em|rem</h4><h4>px</h4><p>Pixels are the easiest measurement to use. But there is a problem with it. let’s say we are using pixels throughout our website and we managed media query too. What if a user changes the default font-size of the browser (or device)?our header’s font-size (say 20px) will remain 20 px. Hence user’s font preferences won’t be reflected. Which is not a good user experience.</p><h4>em</h4><p>An em is equal to the computed font-size of that element’s parent. like, if there is a div element defined with font-size: 16px then for that div and for its children 1em = 16px. If font-size is not defined explicitly, that element will inherit it from the parent element.</p><h4>rem</h4><p>rem values are relative to the root HTML element, not to the parent element. That is, If font-size of the root element is 16px then 1 rem = 16px for all elements. If font-size is not explicitly defined in root element then 1rem will be equal to the default font-size provided by the browser (usually 16px).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5c6151dcb44" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altcampus/css-units-e5c6151dcb44">CSS UNITS</a> was originally published in <a href="https://medium.com/altcampus">AltCampus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Box Model]]></title>
            <link>https://medium.com/altcampus/introduction-to-box-model-e237de4f87a3?source=rss-4b29b6622d28------2</link>
            <guid isPermaLink="false">https://medium.com/p/e237de4f87a3</guid>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Sachin Kumar Tiwari]]></dc:creator>
            <pubDate>Fri, 21 Sep 2018 06:29:34 GMT</pubDate>
            <atom:updated>2018-09-21T06:29:34.517Z</atom:updated>
            <content:encoded><![CDATA[<p>Every element in a browser is a rectangular box. It has some properties like Width, Height, Padding, Border, Margin, etc. Elements also have many types like Block-level elements, Inline-level elements, Inline-block.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*0EpZUSn97QAWi7U_i2urTQ.png" /><figcaption>BOX MODEL</figcaption></figure><h4>Width:-</h4><p>The <strong>width</strong> property sets the <strong>width</strong> of an element. <br><strong>Note</strong>: The <strong>min</strong>-<strong>width</strong> and <strong>max</strong>-<strong>width</strong> properties override the <strong>width</strong> property.<br>width: margin-left + border-left + padding-left + width + padding-right + border-right + margin-right;</p><p><strong>Height:-<br></strong>The Height property sets the height of an element.<br>height: margin-top + border-top + padding-top + height + padding-bottom + border-bottom + margin-bottom;</p><h4>Padding:-</h4><p>It gives some gaps between content and box, it applies inside of the box, so it does not affect the actual height and width of the box. there are many ways to give padding to any element. There are few of them -<br>1- padding-left: 10px;<br>2- padding-right: 10px;<br>3- padding-top: 10px;<br>4- padding-bottom: 10px;<br>or,<br>we can just give these all properties in a line, it is called short-hand property.<br>5- padding: 10px 10px 10px 10px;</p><h4>Border:-</h4><p>It gives the border to the element. it has some property like type, color, etc.<br>there are few of them-<br>*border-type: solid|double|dashed|dotted|none;<br>*border-color: black|blue|red; or any color.<br>Ex:-<br>border: 10px solid red;<br>or, we can give separate value. like-<br>border-bottom-color: blue;</p><h4>Margin:-</h4><p>It creates gaps surrounding the element. It affects<br>the actual height and width of the box. it can be used in many ways same as padding, it accepts negative value also. <br>1- margin-left: 10px;<br>2- margin-right: 10px;<br>3- margin-top: 10px;<br>4- margin-bottom: 10px;<br>or,<br>5- margin: 10px 10px 10px 10px;</p><h4>Block-level Boxes:-</h4><p>It takes height as the actual height of the content, but it covers the whole width. and another content starts from the next line. It accepts the height, width, border, margin, and padding. but padding does not affect the actual width and height of the box. because it gives the gap inside the box. but border and margin affect the actual width and height of the box.</p><h4>Inline-level Boxes:-</h4><p>It covers only what the content’s height and width. It does not accept height and width. and it also does not accept margin-top and margin-bottom. But It accepts margin-left and margin-right and padding. Another content starts next to it.</p><h4>Inline-Block Boxes:-</h4><p>It contains properties of both inline-level and box level. It accepts height and width as well as margin and padding. if we want to add another elements or contents it will go next to it.</p><h4>Box-sizing:-</h4><p>It contains four boxes. Content-box, Padding-box, Border-box, Margin-box.</p><h4>Content-box:-</h4><p>It contains elements or contents. It has some width and height.<br>like- 200*100, where 200 is the height and 100 is the width.</p><p><strong>Padding-box:-</strong></p><p>It includes some space surrounding the content box but it does not affect the height and width of the box, because it creates spaces inside the box.<br>like if our box size is 200*100 when we give padding: 10px; it creates spaces inside 200*100.</p><p><strong>Border-box:-</strong></p><p>It gives the border to our content box, and padding remains inside this box. like padding does not affect it. It has some properties like type, color, style, etc;</p><p><strong>Margin-box:-</strong></p><p>It increases some spaces surrounding to our border box, and it was affected by width and height. like if we have a box which size is 400*400, and we give margin: 20px; now it will increase width and height. now our box size will be <br>440*440.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e237de4f87a3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altcampus/introduction-to-box-model-e237de4f87a3">Introduction to Box Model</a> was originally published in <a href="https://medium.com/altcampus">AltCampus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>