<?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: paulomoro</title>
    <description>The latest articles on DEV Community by paulomoro (@paulomoro).</description>
    <link>https://dev.to/paulomoro</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%2F459783%2F8ce9490c-073f-4df3-98ca-15dba94f57c7.png</url>
      <title>DEV Community: paulomoro</title>
      <link>https://dev.to/paulomoro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/paulomoro"/>
    <language>en</language>
    <item>
      <title>CSS POSITION: Absolute and Relative</title>
      <dc:creator>paulomoro</dc:creator>
      <pubDate>Wed, 02 Sep 2020 11:56:49 +0000</pubDate>
      <link>https://dev.to/paulomoro/css-position-absolute-and-relative-4f03</link>
      <guid>https://dev.to/paulomoro/css-position-absolute-and-relative-4f03</guid>
      <description>&lt;p&gt;Some months ago when i started writing CSS i got to a point where i wanted to move elements and i was tired of using only the CSS Margin property, so i was introduced to CSS positioning by my tutor, it was rough at the onset but with much effort, reading and practice i got to love and understand it better, So i decided to write about it and share my knowledge to all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS Position&lt;/strong&gt;&lt;br&gt;
CSS position property as the name says, can help you change how  elements is positioned on the web page. &lt;br&gt;
With CSS position you can put any HTML element at whatever location you like. You can specify whether you want the element positioned relative or away from its natural position in the page or absolute based on its parent element and many more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br&gt;
The syntax for the position CSS property is:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;position: value;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Now i will love to identify the various types of CSS positioning related properties. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of CSS Position Property&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Relative&lt;/li&gt;
&lt;li&gt;Absolute&lt;/li&gt;
&lt;li&gt;Fixed&lt;/li&gt;
&lt;li&gt;Sticky&lt;/li&gt;
&lt;li&gt;Static&lt;/li&gt;
&lt;li&gt;Initial &lt;/li&gt;
&lt;li&gt;Inherit &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that we have listed the various CSS position properties, we will talk more about the two most commonly used position properties - &lt;strong&gt;relative and absolute&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Position Relative&lt;/strong&gt; &lt;br&gt;
The relative property helps you position HTML element away from or relative to its original or natural position on the web page.&lt;br&gt;
After setting the position of an element relative without adding any other positioning attributes such as (top, left, right, bottom) nothing will happen, but immediately you add the attribute &lt;code&gt;left: 50px;&lt;/code&gt; the element moves 50px away from its original position on the web page.  &lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
In this example, you will see how the relatively positioned div element moves when its attributes are changed. The element moves to the left and top from its normal position&lt;br&gt;
HTML5:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="parent"&amp;gt; 
     &amp;lt;h1&amp;gt;position relative&amp;lt;/h1&amp;gt;
 &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.parent{
    position: relative;
    left: 500px;
    top: 100px;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Position Absolute&lt;/strong&gt;&lt;br&gt;
position absolute allows you to place an element any where on the web page.&lt;br&gt;
When an element is positioned absolute the element is removed from the normal flow of the document and other elements will behave as if it’s not visible. &lt;br&gt;
You use the positioning attributes top, left, bottom, and right to set the location. &lt;/p&gt;

&lt;p&gt;Example1:&lt;br&gt;
In this example, you will see how the absolutely positioned child element moves when its attributes are changed. The element moves to the left and top from its parents position. &lt;br&gt;
HTML5:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="parent"&amp;gt; 
     &amp;lt;h1&amp;gt;position relative&amp;lt;/h1&amp;gt;
   &amp;lt;div class="child"&amp;gt;
            &amp;lt;h2&amp;gt;position absolute&amp;lt;/h2&amp;gt;
        &amp;lt;/div&amp;gt;
 &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.parent{
    position: relative;
    left: 500px;
    top: 100px;
}

.child{
    position: absolute;
    top: 10px;
    left: 10px;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Example2:&lt;br&gt;
In this example, you will see how the absolutely positioned child element moves when its attributes are changed. The element moves to the left and top from the default html element itself disrupting the flow of the webpage. &lt;br&gt;
HTML5:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="parent"&amp;gt; 
     &amp;lt;h1&amp;gt;position relative&amp;lt;/h1&amp;gt;
   &amp;lt;div class="child"&amp;gt;
            &amp;lt;h2&amp;gt;position absolute&amp;lt;/h2&amp;gt;
        &amp;lt;/div&amp;gt;
 &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.child{
    position: absolute;
    top: 10px;
    left: 10px;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;br&gt;
when using position absolute, we want to know that the values will be relative to the next parent element with relative (or absolute) positioning. If there is no such parent, it will default all the way back up to the &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; element itself meaning it will be placed relative to the page itself.&lt;br&gt;
Its overuse or improper use can limit the flexibility of your webpage. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>HTML AND CSS COMMENTS, USES AND IMPORTANCE</title>
      <dc:creator>paulomoro</dc:creator>
      <pubDate>Fri, 28 Aug 2020 21:50:21 +0000</pubDate>
      <link>https://dev.to/paulomoro/html-comments-uses-and-importance-4f96</link>
      <guid>https://dev.to/paulomoro/html-comments-uses-and-importance-4f96</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is a Comment?&lt;/strong&gt;&lt;br&gt;
A comment is an explanation or description of the source code of a program, They are piece of codes that are ignored the compiler or interpreter&lt;br&gt;
The syntax of comments in various programming languages varies considerably. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Importance and Uses of Comment&lt;/strong&gt;&lt;br&gt;
As a programmer comments helps in making codes easy to understand, easy to debug and also stimulate code readability between the programmer and others.&lt;br&gt;
Comments are also used to document programs and remind programmers of what tricky things they just did with the code and also helps the later generation for understanding and maintenance of code. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML5 COMMENTS&lt;/strong&gt;&lt;br&gt;
HTML5 comments are placed in between &amp;lt;!-- ... --&amp;gt; tags. So, any content placed with-in &amp;lt;!-- ... --&amp;gt; (comment)tags will be treated as a comment and will be completely ignored by the browser.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- This is a HTML5 comment --&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;VALID AND NON VALID COMMENTS&lt;/strong&gt;&lt;br&gt;
Comments do not nest each other, i.e a comment should not be placed inside another comment. Also when writing comments we do well to make sure that there are no spaces in the start-of comment string.&lt;/p&gt;

&lt;p&gt;e.g &lt;br&gt;
&lt;code&gt;&lt;br&gt;
&amp;lt; !-- This is an invalid HTML5 comment --&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
from that example we can say it is an invalid comment because a space occurs between the left angle bracket and the exclamation mark and as a result the web browser will not ignore it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;!-- This is an valid HTML5 comment --&amp;gt;&lt;/code&gt;&lt;br&gt;
This is a valid comment because it contains no space between the left bracket and the exclamation mark.   &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MULTI LINE COMMENTS&lt;/strong&gt;&lt;br&gt;
So far we have seen single line comments, but HTML supports multi-line comments as well. You can comment multiple lines by the special beginning tag &lt;code&gt;&amp;lt;!-- ...&lt;/code&gt; and ending tag &lt;code&gt;--&amp;gt;&lt;/code&gt; placed before the first line and end of the last line as shown in the given example below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      &amp;lt;!-- 
         This is a multiline comment and it can
         span through as many as lines you like.
      --&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS Comment&lt;/strong&gt;&lt;br&gt;
CSS uses the C-like "comment block"-style comments: /* */ . This allows for multi-line comments, and you can quickly use it to disable portions of your code. &lt;/p&gt;

&lt;p&gt;e.g&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/* css comment */&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;br&gt;
Don't use comments as an excuse for unclean code. It can be tempting, when you're in a rush, to poorly write codes, then write a comment that explains what it actually does or why you took the shortcuts that you did.&lt;br&gt;
This might be OK as a temporary fix, but don't make it standard practice. Instead, strive to make your code itself as clean and readable as possible. This keeps the need for comments minimal in the first place.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
