HTML教程
HTML5教程
HTML参考手册

如何在HTML中移动文本?

在HTML中移动文本,可以使用这些步骤轻松实现。
第1步:首先,我们输入 HTML 代码,或在我们要在其中移动文本的文本编辑器中打开现有的HTML文件。
<!Doctype Html>
<Html>
<Head>
<Title>
Move the text
</Title>
</Head>
<Body>
Hello User!... <br> <center>
You are at Lidihuo Site!!!.....
</Body>
</Html>
第2步:现在,我们将光标放置在我们要移动的文本之前。并且,然后我们定义<marquee>标记,该标记用于在网页上移动文本。因此,在我们要移动的文本之前输入open <marquee>标记,然后紧随其后关闭 <marquee>标记
<marquee>
Any Text
</marquee>
第3步:默认情况下,文本在网页上从右向左移动。如果要指定方向,则在<marquee>标记中指定 direction 属性。
<marquee direction="right">
Any Text
</marquee>
第4步:如果要从左至右然后从右至左移动文本,则在 <marquee>中指定行为属性标签。
<marquee direction="right" behavior="alternate">
Any text
</marquee>
第5步:如果我们想指定在网页上移动的文本的背景。然后,我们在style属性中使用background属性,如以下块所示:
<marquee direction="right" behavior="alternate" style="background:blue;" >
Any text
</marquee>
第6步:如果要指定边框,则在样式属性中使用border属性。
<marquee direction="right" behavior="alternate" style="border:RED 3px SOLID" >
Any text
</marquee>
第7步:保存HTML文件,然后在浏览器中运行该文件。
<!Doctype Html>
<Html>
<Head>
<Title>
移动文字
</Title>
</Head>
<Body>
Hello User!... <br> <center>
<marquee direction="right" behavior="alternate" style="background:blue;border:solid 3px solid" >
您访问的是立地货网站html的教程!!!.....
</marquee>
</Body>
</Html>
上述HTML代码的输出显示在以下屏幕截图中:
如何在HTML中移动文本
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4