<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pruthviraj-MV</title>
    <description>The latest articles on DEV Community by Pruthviraj-MV (@pruthvirajmv).</description>
    <link>https://dev.to/pruthvirajmv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F533627%2F2fc20e4d-141c-48b4-a7f0-50c0034aaf9a.png</url>
      <title>DEV Community: Pruthviraj-MV</title>
      <link>https://dev.to/pruthvirajmv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pruthvirajmv"/>
    <language>en</language>
    <item>
      <title>A White Blank Page is New CSS Box Model </title>
      <dc:creator>Pruthviraj-MV</dc:creator>
      <pubDate>Sat, 05 Dec 2020 17:47:04 +0000</pubDate>
      <link>https://dev.to/pruthvirajmv/a-white-blank-page-is-new-css-box-model-30eo</link>
      <guid>https://dev.to/pruthvirajmv/a-white-blank-page-is-new-css-box-model-30eo</guid>
      <description>&lt;h5&gt;
  
  
  Yes, you heard it right. Designing a webpage using CSS properties to place your html element at right place on the page is nothing but how we have been writing on white blank page
&lt;/h5&gt;

&lt;h1&gt;
  
  
  Are you a beginner? Trying to understand the CSS Box model?
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Then this blog is for you...
&lt;/h1&gt;

&lt;h5&gt;
  
  
  Disclaimer: I am also a beginner here and putting up the things how I learnt CSS Box model
&lt;/h5&gt;

&lt;p&gt;I will try to help you to understand the properties of the box model, with which you will be in better place to design the basic page layout. &lt;/p&gt;

&lt;h2&gt;
  
  
  A White Blank Page is our New Box Model
&lt;/h2&gt;

&lt;p&gt;Do you have count of pages have you written till today? &lt;br&gt;
I guess no... And not needed. At least we can remember the layout of a page.&lt;/p&gt;

&lt;p&gt;One of the effective way of understanding a topic is to relate it with a familiar topic/thing.&lt;br&gt;
So every time I start styling my webpage, I imagine writing on a white blank page.&lt;/p&gt;
&lt;h2&gt;
  
  
  Basically we have four properties inside a CSS Box Model
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;margin&lt;/li&gt;
&lt;li&gt;border&lt;/li&gt;
&lt;li&gt;padding&lt;/li&gt;
&lt;li&gt;content &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n7CD5Fgs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.csssolid.com/images/box-model/css-box-model.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n7CD5Fgs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.csssolid.com/images/box-model/css-box-model.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wondering? how a page is relatable to box model properties.&lt;br&gt;
Let's see one by one&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;margin&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Whenever we have an unruled page, to make it look in a good format first thing we do is to draw outer lines. The space we leave here is called &lt;strong&gt;margin&lt;/strong&gt;. So based on our requirement we place the line near to end pages, if we want to use the page to the fullest or else if it is an assignment then those lines would move far from the page ends, smart right?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9KA_7QpS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t023m0ou608omv99sg5g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9KA_7QpS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t023m0ou608omv99sg5g.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In CSS, to achieve this spacing we use property &lt;em&gt;margin&lt;/em&gt;.  Below is a basic usage of margin.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;margin: topspacing rightspacing bottomspacing leftspacing; 
Example:- margin: 2rem 2rem 1rem 1rem;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The spacing at top, right, bottom and left can be controlled individually using below properties:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;margin-top&lt;/li&gt;
&lt;li&gt;margin-right&lt;/li&gt;
&lt;li&gt;margin-bottom&lt;/li&gt;
&lt;li&gt;margin-left&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;To learn more on using margin refer &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;border&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now the drawn line is nothing but the &lt;strong&gt;border&lt;/strong&gt;. To make our blank page bit attractive or beautiful, one will think of having double line border, thick border, color border etc... Also, we draw lines for writing the text lines in formatted way and this also will come under border property in css. Without these borders, our text-lines on a blank page will create runways for airplane or a hill down steep or a humpy road. What's your text-lines would create without border?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---CjNchMJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/91i190dqa2hi4wh815pp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---CjNchMJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/91i190dqa2hi4wh815pp.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To achieve these styles on a webpage we have different properties&lt;/p&gt;

&lt;p&gt;To learn more on using border properties refer &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;content&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now the page format is ready and next is to start writing the text in  lines and this is nothing but the &lt;strong&gt;content&lt;/strong&gt;. According to the line we make the text look like heading, sub-headings, bold texts, italics text, size, font style etc. To achieve all these stylings we have many css properties.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aEvgaHfc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qyranewvx7bsbiva878h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aEvgaHfc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qyranewvx7bsbiva878h.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;padding&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Consider a text line, normally we write on the texts laying above the line and also have seen one my friend writing at middle between lines.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XDMmD5Kr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4w4nzpgs6m7h7qfuvq11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XDMmD5Kr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4w4nzpgs6m7h7qfuvq11.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this texts placing between the lines is &lt;strong&gt;padding&lt;/strong&gt; in css. It's usage is similar to the margin as shown below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;padding: topspacing rightspacing bottomspacing leftspacing; 
Example:- padding: 1rem 0.5em 1rem 0.5rem;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The spacing at top, right, bottom and left can be controlled individually using below properties:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;padding-top&lt;/li&gt;
&lt;li&gt;padding-right&lt;/li&gt;
&lt;li&gt;padding-bottom&lt;/li&gt;
&lt;li&gt;padding-left&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;To learn more on using margin refer &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt; Each html element will have its own box model.&lt;/p&gt;

&lt;p&gt;To see how an html element styled, use console of the webpage&lt;/p&gt;

&lt;p&gt;Make sense? " A White Blank Page is New CSS Box Model "&lt;/p&gt;

&lt;p&gt;Thanks for the read! &lt;/p&gt;

&lt;p&gt;Please feel free write feedback.&lt;br&gt;
Do correct me, if I stated something wrong here..&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blog content source:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=u6_a0d94A1Q&amp;amp;t=1080s"&gt;https://www.youtube.com/watch?v=u6_a0d94A1Q&amp;amp;t=1080s&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model"&gt;https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model&lt;/a&gt;&lt;/p&gt;

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