<?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>Forem: Anamika</title>
    <description>The latest articles on Forem by Anamika (@anamkaa_).</description>
    <link>https://forem.com/anamkaa_</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%2F660215%2Fa1846e0e-0557-4fde-bce8-122bce9a26e9.png</url>
      <title>Forem: Anamika</title>
      <link>https://forem.com/anamkaa_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/anamkaa_"/>
    <language>en</language>
    <item>
      <title>DOM Explained</title>
      <dc:creator>Anamika</dc:creator>
      <pubDate>Fri, 27 Aug 2021 17:44:34 +0000</pubDate>
      <link>https://forem.com/anamkaa_/dom-explained-12dd</link>
      <guid>https://forem.com/anamkaa_/dom-explained-12dd</guid>
      <description>&lt;h3&gt;
  
  
  What is DOM?
&lt;/h3&gt;

&lt;p&gt;DOM stands for Document Object Model. It is an programming interface for web documents. It shows how document content is accessed and modified. It defines the logical structure of documents. It represents the document as nodes and objects, such that any programming language can interact with the page.&lt;/p&gt;

&lt;h5&gt;
  
  
  DOM Structure
&lt;/h5&gt;

&lt;p&gt;It can be depicted as a tree-like structure. The objects are organized in a hierarchical manner. It follows as :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Window object &lt;/li&gt;
&lt;li&gt;Document object &lt;/li&gt;
&lt;li&gt;Form object &lt;/li&gt;
&lt;li&gt;Form control elements
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fth.bing.com%2Fth%2Fid%2FR.e5ec90a049ac4d89cfe6f473f5e90a62%3Frik%3D2vAe4wP0zSwDrw%26riu%3Dhttp%253a%252f%252fwww.tutorialspoint.com%252fimages%252fhtml-dom.jpg%26ehk%3Dro8ZmiKVyvunucBegQ%252fCWt%252bbTEBzRMdYdCz28fipr5s%253d%26risl%3D%26pid%3DImgRaw%26r%3D0" alt="DOM structure"&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  HTML DOM
&lt;/h3&gt;

&lt;p&gt;Whenever a web document is loaded, the browser creates &lt;strong&gt;D&lt;/strong&gt;ocument &lt;strong&gt;O&lt;/strong&gt;bject &lt;strong&gt;M&lt;/strong&gt;odel of the page. It can be modified with a scripting language such as javascript.&lt;br&gt;
HTML DOM is standard object model and programming interface for HTML. It helps to define:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML elements as &lt;strong&gt;objects&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Properties&lt;/strong&gt; of those elements &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Methods&lt;/strong&gt; to access html elements &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Events&lt;/strong&gt; for those elements&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  How HTML DOM is constructed?
&lt;/h4&gt;

&lt;p&gt;It is characterized as a hierarchical tree, where each element in the document tree is called Node.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fvisionofgeek.com%2Fwp-content%2Fuploads%2FHTML-DOMDocument-Object-Model-1080x805.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fvisionofgeek.com%2Fwp-content%2Fuploads%2FHTML-DOMDocument-Object-Model-1080x805.png" alt="HTML DOM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DOM nodes represents all the elements of the document. The document node is called the root node and it contains other nodes. The head and body elements are called parent nodes. The parent nodes also contain other elements inside them , which are considered child nodes.&lt;br&gt;
The elements having same hierarchical level are considered to be sibling nodes, here the head and body can be said to be sibling nodes.&lt;br&gt;
Some nodes are self closing like img tag. These are called void nodes and they cannot be a parent node.&lt;/p&gt;




&lt;h4&gt;
  
  
  DOM Methods
&lt;/h4&gt;

&lt;p&gt;The document object represents our web page and to access any element of our HTML page, we need to access the document object.&lt;br&gt;
DOM Methods are used to access and manipulate HTML elements.&lt;/p&gt;

&lt;p&gt;Few of them are :&lt;/p&gt;

&lt;h5&gt;
  
  
  Finding HTML Elements
&lt;/h5&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;METHOD&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;document.getElementById(id)&lt;/td&gt;
&lt;td&gt;Find elements by id&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;document.getElementByTagName(name)&lt;/td&gt;
&lt;td&gt;Find elements by tag name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;document.getElementByClassName(name)&lt;/td&gt;
&lt;td&gt;Find elements by class name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;document.querySelector()&lt;/td&gt;
&lt;td&gt;Find elements by css selector and returns first element that matches the selector&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;document.querySelectorAll()&lt;/td&gt;
&lt;td&gt;Find elements by css selector and returns a node list collection of all matching elements.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FVvYp5XsB%2Fimage5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FVvYp5XsB%2Fimage5.png" alt="method example"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  DOM Properties
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Changing HTML Elements
&lt;/h5&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;PROPERTY&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;element.innerText = new text&lt;/td&gt;
&lt;td&gt;Change inner text of an HTML element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;element.innerHTML = new HTML content&lt;/td&gt;
&lt;td&gt;Change inner HTML of an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;element.style.property = new style&lt;/td&gt;
&lt;td&gt;Change style of an HTML element&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FsXYqYnbF%2Fimage6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FsXYqYnbF%2Fimage6.png" alt="property example"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>CSS Box Model</title>
      <dc:creator>Anamika</dc:creator>
      <pubDate>Thu, 26 Aug 2021 12:45:55 +0000</pubDate>
      <link>https://forem.com/anamkaa_/css-box-model-5075</link>
      <guid>https://forem.com/anamkaa_/css-box-model-5075</guid>
      <description>&lt;p&gt;All the components depicted in a web page consists of boxes. So, basically all the html elements can be considered as boxes.&lt;br&gt;
In CSS, box model is used for the design and layout of the html elements ,also how each of them are arranged together to form an overall layout.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is CSS Box Model?
&lt;/h3&gt;

&lt;p&gt;The CSS Box Model is a box that wraps around every html element. It has four layers: margin, border, padding, content.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsabe.io%2Fclasses%2Fcss%2Fcss-box-model-padding-border-margin%2Fcss-box-model.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsabe.io%2Fclasses%2Fcss%2Fcss-box-model-padding-border-margin%2Fcss-box-model.png" alt="css box model"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What does it comprise of?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Content: It is the innermost area which consists of content like text, image or other media, which can be sized using height and width properties.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Padding: This area wraps around the content as an additional layer. Its dimensions can be given using padding properties.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Border: This is the area around the padding. It wraps the content as well as padding. It can be sized using border properties.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Margin: It is the outermost layer, which wraps around every other layer. It is a white space between the box and other elements. It can be adjusted using margin properties.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FyNFMqLLL%2Fimage3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FyNFMqLLL%2Fimage3.png" alt="example"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;When we set height and width properties of any element using CSS, it is merely applied to the content area. &lt;br&gt;
So, to know the actual dimensions of the element we &lt;br&gt;
need to consider padding and border also.&lt;/p&gt;

&lt;p&gt;Total width of an element is calculated as :&lt;/p&gt;

&lt;h6&gt;
  
  
  Total Width = ( width + left padding + right padding + left border + right border)
&lt;/h6&gt;

&lt;p&gt;Total height of an element is calculated as:&lt;/p&gt;

&lt;h6&gt;
  
  
  Total Height = (height + top padding + bottom padding + top border + bottom border)
&lt;/h6&gt;




&lt;h3&gt;
  
  
  The Box-sizing Property
&lt;/h3&gt;

&lt;p&gt;This property defines how the margin, padding and borders are added around the box.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2Fs2N8BkqT%2Fimage4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2Fs2N8BkqT%2Fimage4.png" alt="box model property"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Content-Box: It is considered as the default value. It adds the padding, margin and the border outside the box. This means when we specify a width and height to any element, the padding and border are applied over it , so it seems larger.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2F260S4jNR%2Fimage1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2F260S4jNR%2Fimage1.png" alt="example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Border-Box: It adds the margin, padding, and border inside the box. As a result the padding and border are included inside the height and width of an element, ensuring all the elements are sized in an easy manner.&lt;/li&gt;
&lt;/ul&gt;

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