如何在HTML5中新增文章?
在這篇文章中,我們將學習如何在HTML5中新增文章。
HTML5中的一個新的分割槽元素是<article>標籤。文章使用<article>標籤在HTML中表示。更具體地說,<article>元素中包含的內容與網站其餘內容不同(即使它可能相關)。
讓我們考慮以下示例,瞭解如何在HTML5中新增文章
示例1
在以下示例中,我們在文章元素中使用內聯樣式。
<!DOCTYPE html>
<html>
<body>
<article style="width: 300px;border: 2px solid gray;padding: 10px;border-radius: 10px;margin: 5px;">
<img src="https://tutorialspoint.tw/static/images/logo-color-footer.png"alt="image"width="300"height="250"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>
當指令碼執行時,它將生成一個輸出,顯示使用scr上傳的影像以及在網頁上<article>標籤內使用的文字。
示例2
考慮以下示例,我們建立三個獨立的文章和自包含的內容。
<!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>
執行上述指令碼後,它將生成一個輸出,其中包含指令碼中在網頁上使用的article標籤文字。
廣告
資料結構
網路
關係資料庫管理系統 (RDBMS)
作業系統
Java
iOS
HTML
CSS
Android
Python
C語言程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP