国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

目錄
為什么我們在 HTML 中使用 CSS?
Marquee 標簽在 HTML 中如何工作?
在 HTML 中實現(xiàn)移動文本的示例
示例 #6
結論
首頁 web前端 html教程 在 HTML 中移動文本

在 HTML 中移動文本

Sep 04, 2024 pm 04:45 PM
html html5 HTML Tutorial HTML Properties HTML tags

在 HTML 中移動文本也稱為滾動文本。我們可以以一定的時間間隔速度向各個方向滾動文本。 標簽用于進行下一步操作。文本滾動有 4 個方向,即左方向、右方向、上方向、下方向。通過設置行為屬性在封閉區(qū)域內(nèi)移動文本。

實時示例: 假設我們的網(wǎng)站上經(jīng)常有重要的更新內(nèi)容。如果內(nèi)容始終穩(wěn)定,用戶就無法關注該內(nèi)容,因此為了吸引用戶的注意力,我們必須始終滾動更新的內(nèi)容。根據(jù)用戶的要求,我們可以指示內(nèi)容滾動到哪一側。達到這個要求使用標簽

為什么我們在 HTML 中使用 CSS?

提供所有頁面之間通用的邏輯;我們不再在每個 HTML 頁面中編寫相同的樣式邏輯,而是使用 CSS 文件來編寫通用邏輯。并在每個 HTML 頁面中使用 包含此 CSS 頁面。標簽。

Marquee 標簽在 HTML 中如何工作?

可以通過應用來移動內(nèi)容如果我們在marquee標簽內(nèi)設置direction屬性,那么根據(jù)方向,屬性值內(nèi)容將會移動。

語法 #1

<marquee>
//some text to move
</marquee>

語法#2

<marquee direction=”left or right or up or down”>
//some text to move
</marquee>

語法#3

<marquee behavior="alternate"> //it makes the text back direction by touching the border of the page.
//some text to move
</marquee>

語法#4

<marquee direction=”left” scrollamount="5">// scrollamount used to set the scrolling text speed
//some text to move
</marquee>
注意:如果我們沒有提供任何方向?qū)傩?,默認選取框方向是離開。

在 HTML 中實現(xiàn)移動文本的示例

以下是提到的示例:

示例#1

默認字幕標簽

代碼:

<!DOCTYPE html>
<html>
<head>
<title>Move Text</title>
<style>
body {
background-color: green;
text-align: center;
color: white;
font-family: Arial;
}
</style>
</head>
<body>
<h1>Moving Text with Marquee Tag</h1>
<marquee>
2020 is year bewildered each and every individual of the world due to pandemic COVID-19. This disease is caused by CARONA virus. Till date there is no medicine or vaccine for this disease. So the only option in our hands is to follow instructions strictly announced by World Health Organization. Italy is affected with this virus more worsen because of there is no initial preventive measures in the country. Fight back against the virus every individual should home quarantine. Clean the hands every time if are out from the same place. Strictly say no to hand shake instead respect them back with namaskar. Do not contact any person until state and center curfew is over. Now India also greatly affected by this COVID-19 virus because of foreigners. Who ever come to India from other country they must undergone to quarantine at least 14 days. After finishing quarantine they must go for CARONA test.
</marquee>
</body>
</html>

輸出:

在 HTML 中移動文本 在 HTML 中移動文本

說明:正如您在上面的文本中看到的,即使我們沒有提及任何方向,它也是從右向左移動的,因此它是默認的選取框標簽。

示例#2

選框標簽位于正確的方向。

代碼:

<!DOCTYPE html>
<html>
<head>
<title>Move Text</title>
<style>
body {
background-color: maroon;
text-align: center;
color: white;
font-family: Arial;
}
</style>
</head>
<body>
<h1>Moving Text with Marquee Tag</h1>
<marquee direction="right">
2020 is year bewildered each and every individual of the world due to pandemic COVID-19. This disease is caused by CARONA virus. Till date there is no medicine or vaccine for this disease. So the only option in our hands is to follow instructions strictly announced by World Health Organization. Italy is affected with this virus more worsen because of there is no initial preventive measures in the country. Fight back against the virus every individual should home quarantine. Clean the hands every time if are out from the same place. Strictly say no to hand shake instead respect them back with namaskar. Do not contact any person until state and center curfew is over. Now India also greatly affected by this COVID-19 virus because of foreigners. Who ever come to India from other country they must undergone to quarantine at least 14 days. After finishing quarantine they must go for CARONA test.
</marquee>
</body>
</html>

輸出:

在 HTML 中移動文本 在 HTML 中移動文本

說明:如上面的文字所示,通過將方向?qū)傩栽O置為右側,從左向右移動。

示例 #3

頂部方向的字幕

代碼:

<!DOCTYPE html>
<html>
<head>
<title>Move Text</title>
<style>
body {
background-color: blue;
text-align: center;
color: white;
font-family: Arial;
}
</style>
</head>
<body>
<h1>Moving Text with Marquee Tag</h1>
<marquee direction="up">
2020 is year bewildered each and every individual of the world due to pandemic COVID-19. This disease is caused by CARONA virus. Till date there is no medicine or vaccine for this disease. So the only option in our hands is to follow instructions strictly announced by World Health Organization. Italy is affected with this virus more worsen because of there is no initial preventive measures in the country. Fight back against the virus every individual should home quarantine. Clean the hands every time if are out from the same place. Strictly say no to hand shake instead respect them back with namaskar. Do not contact any person until state and center curfew is over. Now India also greatly affected by this COVID-19 virus because of foreigners. Who ever come to India from other country they must undergone to quarantine at least 14 days. After finishing quarantine they must go for CARONA test.
</marquee>
</body>
</html>

輸出:

在 HTML 中移動文本 在 HTML 中移動文本

說明:如上面的文字所示,通過將方向?qū)傩栽O置為向上,從下到上移動。

示例#4

底部方向的選框。

代碼:

<!DOCTYPE html>
<html>
<head>
<title>Move Text</title>
<style>
body {
background-color: orange;
text-align: center;
color: white;
font-family: Arial;
}
</style>
</head>
<body>
<h1>Moving Text with Marquee Tag</h1>
<marquee direction="down">
2020 is year bewildered each and every individual of the world due to pandemic COVID-19. This disease is caused by CARONA virus. Till date there is no medicine or vaccine for this disease. So the only option in our hands is to follow instructions strictly announced by World Health Organization. Italy is affected with this virus more worsen because of there is no initial preventive measures in the country. Fight back against the virus every individual should home quarantine. Clean the hands every time if are out from the same place. Strictly say no to hand shake instead respect them back with namaskar. Do not contact any person until state and center curfew is over. Now India also greatly affected by this COVID-19 virus because of foreigners. Who ever come to India from other country they must undergone to quarantine at least 14 days. After finishing quarantine they must go for CARONA test.
</marquee>
</body>
</html>

輸出:

在 HTML 中移動文本 在 HTML 中移動文本

說明:如上面的文字所示,通過將方向?qū)傩栽O置為向下,從上到下移動。

示例#5

具有行為屬性的字幕。

代碼:

<!DOCTYPE html>
<html>
<head>
<title>Move Text</title>
<style>
body {
background-color: lightblue;
text-align: center;
color: brown;
font-family: Arial;
border: solid 2px red;
}
</style>
</head>
<body>
<h1>Moving Text with Marquee Tag</h1>
<marquee behavior="alternate">
Hi, I am an alternate proeprty
</marquee>
</body>
</html>

輸出:

在 HTML 中移動文本 在 HTML 中移動文本 在 HTML 中移動文本

說明:如上面的文字所示,通過將行為屬性設置為alternate,通過觸摸邊框從左到右和從右到左移動。

示例 #6

具有滾動量屬性的字幕。

代碼:

<!DOCTYPE html>
<html>
<head>
<title>Move Text</title>
<style>
body {
background-color: fuchsia;
text-align: center;
color: white;
font-family: Arial;
border: solid 2px red;
}
</style>
</head>
<body>
<h1>Moving Text with Marquee Tag</h1>
<marquee direction="left" scrollamount="2">
Paramesh
</marquee>
<marquee scrollamount="4">
Amardeep
</marquee>
<marquee scrollamount="6">
Harinath-Rajitha
</marquee>
</body>
</html>

輸出:

在 HTML 中移動文本 在 HTML 中移動文本

說明:正如您在上面的文字中看到的,從右向左移動的時間不同,因此它們都位于不同的位置。

結論

通過 marquee 標簽實現(xiàn) HTML 中文本的移動。我們可以根據(jù)需要對文本進行左、右、上、下移動。此字幕功能主要用于電視頻道定期更新以吸引用戶注意力。

以上是在 HTML 中移動文本的詳細內(nèi)容。更多信息請關注PHP中文網(wǎng)其他相關文章!

本站聲明
本文內(nèi)容由網(wǎng)友自發(fā)貢獻,版權歸原作者所有,本站不承擔相應法律責任。如您發(fā)現(xiàn)有涉嫌抄襲侵權的內(nèi)容,請聯(lián)系admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費脫衣服圖片

Undresser.AI Undress

Undresser.AI Undress

人工智能驅(qū)動的應用程序,用于創(chuàng)建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用于從照片中去除衣服的在線人工智能工具。

Clothoff.io

Clothoff.io

AI脫衣機

Video Face Swap

Video Face Swap

使用我們完全免費的人工智能換臉工具輕松在任何視頻中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的代碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

功能強大的PHP集成開發(fā)環(huán)境

Dreamweaver CS6

Dreamweaver CS6

視覺化網(wǎng)頁開發(fā)工具

SublimeText3 Mac版

SublimeText3 Mac版

神級代碼編輯軟件(SublimeText3)

將CSS和JavaScript與HTML5結構有效整合。 將CSS和JavaScript與HTML5結構有效整合。 Jul 12, 2025 am 03:01 AM

HTML5、CSS和JavaScript應通過語義化標簽、合理加載順序與解耦設計高效結合。1.使用HTML5語義化標簽如、提升結構清晰度與可維護性,利于SEO和無障礙訪問;2.CSS應置于中,使用外部文件并按模塊拆分,避免內(nèi)聯(lián)樣式與延遲加載問題;3.JavaScript推薦放在前引入,使用defer或async異步加載以避免阻塞渲染;4.減少三者間強依賴,通過data-*屬性驅(qū)動行為、類名控制狀態(tài),統(tǒng)一命名規(guī)范提升協(xié)作效率。這些方法能有效優(yōu)化頁面性能與團隊協(xié)作。

使用HTML按鈕元素實現(xiàn)可點擊按鈕 使用HTML按鈕元素實現(xiàn)可點擊按鈕 Jul 07, 2025 am 02:31 AM

要使用HTML的button元素實現(xiàn)可點擊按鈕,首先需掌握其基本用法與常見注意事項。1.使用標簽創(chuàng)建按鈕,并通過type屬性定義行為(如button、submit、reset),默認為submit;2.通過JavaScript添加交互功能,可內(nèi)聯(lián)寫法或通過ID綁定事件監(jiān)聽器以提升維護性;3.利用CSS自定義樣式,包括背景色、邊框、圓角及hover/active狀態(tài)效果,增強用戶體驗;4.注意常見問題:確保未啟用disabled屬性、正確綁定JS事件、避免布局遮擋,并借助開發(fā)者工具排查異常。掌握這

在HTML頭部元素中配置文檔元數(shù)據(jù) 在HTML頭部元素中配置文檔元數(shù)據(jù) Jul 09, 2025 am 02:30 AM

HTMLhead中的元數(shù)據(jù)對SEO、社交分享和瀏覽器行為至關重要。1.設置頁面標題與描述,使用和并保持簡潔唯一;2.添加OpenGraph與Twitter卡片信息以優(yōu)化社交分享效果,注意圖片尺寸并使用調(diào)試工具測試;3.定義字符集與視口設置確保多語言支持與移動端適配;4.可選標簽如作者版權、robots控制及canonical防止重復內(nèi)容也應合理配置。

解釋html5`  vs` '元素。 解釋html5` vs` '元素。 Jul 12, 2025 am 03:09 AM

是塊級元素,適合布局;是內(nèi)聯(lián)元素,適合包裹文字內(nèi)容。1.獨占一行,可設置寬高和邊距,常用于結構布局;2.不換行,大小由內(nèi)容決定,適用于局部文本樣式或動態(tài)操作;3.選擇時應根據(jù)內(nèi)容是否需獨立空間判斷;4.不可嵌套在內(nèi),不適合做布局;5.優(yōu)先使用語義化標簽以提升結構清晰度與可訪問性。

使用新的HTML5方法(FormData)提交表單數(shù)據(jù) 使用新的HTML5方法(FormData)提交表單數(shù)據(jù) Jul 08, 2025 am 02:28 AM

使用HTML5的FormDataAPI提交表單數(shù)據(jù)更方便,1.它可自動收集帶name屬性的表單字段或手動添加數(shù)據(jù);2.支持通過fetch或XMLHttpRequest以multipart/form-data格式提交,適合文件上傳;3.處理文件時只需將文件附加到FormData并發(fā)送請求即可;4.注意同名字段會被覆蓋、需處理JSON轉換及無嵌套結構等問題。

了解HTML5媒體源擴展(MSE) 了解HTML5媒體源擴展(MSE) Jul 08, 2025 am 02:31 AM

MSE(MediaSourceExtensions)是W3C標準的一部分,允許JavaScript動態(tài)構建媒體流,從而實現(xiàn)高級視頻播放功能。它通過MediaSource管理媒體源、SourceBuffer存放數(shù)據(jù)、TimeRanges表示緩沖時間范圍,使瀏覽器能動態(tài)加載并解碼視頻片段。使用MSE的流程包括:①創(chuàng)建MediaSource實例;②將其綁定到元素;③添加SourceBuffer接收特定格式數(shù)據(jù);④通過fetch()獲取分段數(shù)據(jù)并追加至緩沖區(qū)。常見注意事項有:①格式兼容性問題;②時間戳對

用HTML5` 標簽顯示進度條。 用HTML5` 標簽顯示進度條。 Jul 08, 2025 am 02:24 AM

HTML5的標簽可直接實現(xiàn)網(wǎng)頁進度條。1.基本用法是設置value和max屬性,如顯示30%進度;2.若進度未知可省略value,僅設max,如表示不確定狀態(tài);3.可通過CSS自定義樣式,需處理瀏覽器兼容性;4.常用于上傳文件、表單進度、游戲加載等場景;5.注意避免任務過快完成時使用,并考慮舊版IE的兼容問題。

HTML5表單中有哪些新輸入類型? HTML5表單中有哪些新輸入類型? Jul 12, 2025 am 03:07 AM

HTML5introducednewinputtypesthatenhanceformfunctionalityanduserexperiencebyimprovingvalidation,UI,andmobilekeyboardlayouts.1.emailvalidatesemailaddressesandsupportsmultipleentries.2.urlchecksforvalidwebaddressesandtriggersURL-optimizedkeyboards.3.num

See all articles