Rumah >hujung hadapan web >html tutorial >Memindahkan Teks dalam HTML
Memindahkan teks dalam HTML juga dikatakan sebagai teks menatal. Kita boleh menatal teks ke semua arah dengan kelajuan tertentu selang masa.
Contoh Masa Nyata: Mari kita pertimbangkan kami mempunyai kandungan penting yang dikemas kini di tapak web kami dengan kerap. Jika kandungan itu sentiasa stabil, pengguna tidak dapat melihat kandungan tersebut, jadi untuk mendapatkan perhatian pengguna, kami perlu menatal kandungan yang dikemas kini sentiasa. Bergantung pada keperluan pengguna, kami boleh memberi arahan kepada tatal kandungan sebelah mana. Capai keperluan ini
Sediakan Logik biasa antara semua halaman; daripada menulis logik gaya yang sama dalam setiap halaman HTML, kami menggunakan fail CSS untuk menulis logik biasa. Dan sertakan halaman CSS ini dalam setiap halaman HTML dengan
Kandungan boleh dialihkan dengan menggunakan
Sintaks #1
<marquee> //some text to move </marquee>
Sintaks #2
<marquee direction=”left or right or up or down”> //some text to move </marquee>
Sintaks #3
<marquee behavior="alternate"> //it makes the text back direction by touching the border of the page. //some text to move </marquee>
Sintaks #4
<marquee direction=”left” scrollamount="5">// scrollamount used to set the scrolling text speed //some text to move </marquee>Nota: Arah tenda lalai betul untuk ditinggalkan jika kami tidak menyediakan sebarang harta arah.
Di bawah adalah contoh yang dinyatakan:
Teg marquee lalai
Kod:
<!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>
Output:
Penjelasan: Seperti yang anda lihat dalam teks di atas dialihkan dari kanan ke kiri walaupun kami tidak menyebut sebarang arah, jadi ia adalah teg marquee lalai.
Marquee tag ke arah yang betul.
Kod:
<!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>
Output:
Penjelasan: Seperti yang anda lihat dalam teks di atas, digerakkan dari kiri ke kanan dengan menetapkan sifat arah ke kanan.
Marquee ke arah atas
Kod:
<!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>
Output:
Penjelasan: Seperti yang anda lihat dalam teks di atas, dialihkan dari bawah ke atas dengan menetapkan sifat arah ke atas.
Marquee ke arah bawah.
Kod:
<!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>
Output:
Penjelasan: Seperti yang anda lihat dalam teks di atas, bergerak dari atas ke bawah dengan menetapkan sifat arah ke bawah.
Marquee dengan sifat tingkah laku.
Kod:
<!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>
Output:
Penjelasan: Seperti yang anda lihat dalam teks di atas, dialihkan dari kiri ke kanan dan kanan-kiri dengan menyentuh sempadan dengan menetapkan sifat tingkah laku kepada silih berganti.
Marquee dengan harta jumlah tatal.
Kod:
<!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>
Output:
Penjelasan: Seperti yang anda lihat dalam teks di atas dialihkan dari kanan ke kiri dengan pemasaan yang berbeza, jadi mereka semua berada pada kedudukan yang berbeza.
Teks bergerak dalam HTML dicapai dengan teg marquee. Kita boleh mengalihkan teks ke kiri, kanan, atas dan bawah berdasarkan keperluan. Ciri marquee ini kebanyakannya digunakan oleh saluran TV untuk kemas kini biasa untuk menarik perhatian pengguna.
Atas ialah kandungan terperinci Memindahkan Teks dalam HTML. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!