Div alignment inside parent Div

Div is one of the basic element which is used maximum times in a HTML layout. Here we will describe how we can align child div inside parent div.

1. Normal condition:


 

 2Align inner div Right:

divalign-1

Just replace the css of inner div with the below code:


 

3. Two div inside a div:
divalign-2

 

4. Align two div horizontally inside a div:
divalign-3
Replace the two inner div css with the below code:

 

5. Two div inside a div ( align horizontally), one is on the left side and other is on the right side:
divalign-5

Add the below two css property to the #inner2 div.

float: right;

Full css property of two inner divs will be like below:


 

If this article helped you please share your feedback in the comments section below.

Arijit Naskar

Arijit Naskar is a Software Developer and QA, also founder of alltechstories.com a popular tech tutorial & how-to website since 2014. He loves to explore new technologies and writing blogs.

You may also like...