Home  >  Article  >  Web Front-end  >  How to add article in HTML5?

How to add article in HTML5?

WBOY
WBOYforward
2023-09-12 11:37:021138browse

How to add article in HTML5?

In this article, we will learn how to add articles in HTML5.

One of the new segmentation elements in HTML5 is the

tag. Articles are represented in HTML using
tags. More specifically, the content contained within the
element is different from the rest of the site's content (even though they may be related).

Let us consider the following example to understand how to add an article in HTML5

Example 1

In the following example, we use inline styles in the post element.

<!DOCTYPE html>
<html>
<body>
   <article style="width: 300px;border: 2px solid gray;padding: 10px;border-radius: 10px;margin: 5px;">
      <img src="https://www.tutorialspoint.com/static/images/logo-color-footer.png"alt="image"   style="max-width:90%" style="max-width:90%"class="alignnone size-medium wp-image-560930"/>
      <h1>TutorialsPoint</h1>
      <p>Tutorials Point originated from the idea that there exists a class of readers who respond better to online content</p>
   </article>
</body>
</html>

When the script is executed, it will generate an output showing the image uploaded using scr and the text used within the

tags on the web page.

Example 2

Consider the following example, we are creating three separate articles with separate content.

<!DOCTYPE html>
<html>
<body>
   <article>
      <h1>MSD</h1>
      <p>Mahendra Singh Dhoni is an Indian former professional cricketer who was captain of the Indian national cricket team in limited-overs formats</p>
   </article>
   <article>
      <h2>YUVI</h2>
      <p>Yuvraj Singh is a former Indian international cricketer who played in all formats of the game. 
      He is an all-rounder who batted left-handed in the middle order</p>
   </article>
   <article>
      <h3>SREYAS IYER</h3>
      <p>Shreyas Santosh Iyer is an Indian cricketer who plays for the national side in international cricket, Mumbai in domestic cricket</p>
   </article>
</body>
</html>

When you run the above script, it will generate an output containing the post tag text used in the script on the web page.

The above is the detailed content of How to add article in HTML5?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete