+ 1

What is a div tag?

22nd Dec 2022, 6:49 AM
Jawad Ahmed
Jawad Ahmed - avatar
2 Antworten
+ 1
lets suppose you wanted to align a paragraph to the center of the page by using HTML you would use <p align="center">This is a paragraph</p> but what if you had several paragraphs that you want to align them to center? would you really do this? <p align="center">This is a paragraph</p> <p align="center">This is a paragraph</p> <p align="center">This is a paragraph</p> that would not look nice right? well here comes the role of div, by using div you are inserting those paragraphs, or whatever elements, to a group and apply the customization to the div itself <div class="article" align="center"/> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> </div> then it got more improved in HTML5, we use the semantic tag <header> instead of <div class="header"> and <section> instead of <div class="section"> .. etc I </div>
22nd Dec 2022, 10:15 PM
Ahmad Sulaiman