<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>align Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/align/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/align/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Wed, 13 Apr 2022 16:34:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>How to use the position property in CSS to align elements?</title>
		<link>https://www.scmgalaxy.com/tutorials/how-to-use-the-position-property-in-css-to-align-elements/</link>
					<comments>https://www.scmgalaxy.com/tutorials/how-to-use-the-position-property-in-css-to-align-elements/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Fri, 30 Jul 2021 12:30:09 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[align]]></category>
		<category><![CDATA[bottom]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[left]]></category>
		<category><![CDATA[position]]></category>
		<category><![CDATA[property]]></category>
		<category><![CDATA[Right]]></category>
		<category><![CDATA[Top]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7197</guid>

					<description><![CDATA[<p>In This tutorial, I am going to explain that how to How to use the position property in CSS to [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-use-the-position-property-in-css-to-align-elements/">How to use the position property in CSS to align elements?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In This tutorial, I am going to explain that how to How to use the position property in CSS to align elements? Below Property to uses in align elements-</p>



<h2 class="wp-block-heading">Position-</h2>



<ul class="wp-block-list"><li>Left</li><li>Right</li><li>Bottom</li><li>Top</li><li>static</li><li>Fixed</li><li>Relative</li><li>Absolute</li></ul>



<p class="wp-block-paragraph"><strong>Length (cm, px, %)</strong></p>



<h2 class="wp-block-heading">Left Align Property-</h2>



<ul class="wp-block-list"><li>left: auto</li><li>left: 55px</li><li>left: 50%</li></ul>



<h2 class="wp-block-heading">Right Align Property-</h2>



<ul class="wp-block-list"><li>right: auto</li><li>right: 23px</li><li>right: 50%</li></ul>



<h2 class="wp-block-heading">Bottom Align Property-</h2>



<ul class="wp-block-list"><li>bottom: auto</li><li>bottom: 23cm</li><li>bottom: 40%</li></ul>



<h2 class="wp-block-heading">Top Align Property-</h2>



<ul class="wp-block-list"><li>top: auto</li><li>top: 20%</li><li>top: 40px</li></ul>



<h2 class="wp-block-heading"><strong>static</strong>&#8211;</h2>



<p class="wp-block-paragraph">When we set static position for an element then it is not positioned in any special way, it is always positioned according to the normal flow of the page. left, right, top and bottom property won’t work with static position.</p>



<p class="wp-block-paragraph"><strong>Ex: &#8211;</strong></p>



<p class="wp-block-paragraph"><strong>h1 {<br>position: static;<br>border: 5px solid red;<br>}</strong></p>



<p class="wp-block-paragraph"><strong>h1 {<br>position: static;<br>border: 5px solid red;<br>left: 50px;<br>}</strong></p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="634" height="215" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/image-24.png" alt="" class="wp-image-7202" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/image-24.png 634w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/image-24-300x102.png 300w" sizes="(max-width: 634px) 100vw, 634px" /></figure>



<h2 class="wp-block-heading">fixed-</h2>



<p class="wp-block-paragraph">When we set fixed position for an element it always stays in the same place even if the page is scrolled. The top, right, bottom, and left properties are used to position the element.</p>



<p class="wp-block-paragraph"><strong>img {<br>position: fixed;<br>right: 0;<br>top: 50%;<br>border: 3px solid red;<br>}</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="282" height="258" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/image-25.png" alt="" class="wp-image-7203"/></figure>



<h2 class="wp-block-heading">relative-</h2>



<p class="wp-block-paragraph">When we set relative position for an element, elements positioned to its normal flow.</p>



<p class="wp-block-paragraph"><strong>h1 {<br>position: relative;<br>left: 50px;<br>border: 3px solid red;<br>}</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="642" height="246" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/image-23.png" alt="" class="wp-image-7201" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/image-23.png 642w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/07/image-23-300x115.png 300w" sizes="(max-width: 642px) 100vw, 642px" /></figure>



<h2 class="wp-block-heading">absolute-</h2>



<p class="wp-block-paragraph">When we set absolute position for an element, element is positioned to the nearest positioned ancestor. If there is no positioned ancestor then it follow the normal position according to browser.</p>



<p class="wp-block-paragraph"><strong>div {<br>position: absolute;<br>top: 80px;<br>right: 0;<br>width: 200px;<br>height: 100px;<br>border: 3px solid red;<br>}</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://i2.wp.com/css-tricks.com/wp-content/uploads/2020/07/Screen-Shot-2020-07-24-at-11.46.45-AM.png?resize=1022%2C1024&amp;ssl=1" alt="Absolute Positioning Inside Relative Positioning | CSS-Tricks"/></figure>



<p class="wp-block-paragraph">These properties are used to position an element.</p>



<p class="wp-block-paragraph">We can not use any of these properties without setting up position property.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-use-the-position-property-in-css-to-align-elements/">How to use the position property in CSS to align elements?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/how-to-use-the-position-property-in-css-to-align-elements/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
