博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
html文本水平居中对齐_如何使用HTML将网页上的文本居中或对齐
阅读量:2506 次
发布时间:2019-05-11

本文共 2628 字,大约阅读时间需要 8 分钟。

html文本水平居中对齐

This tutorial series will guide you through creating and further customizing using HTML, the standard markup language used to display documents in a web browser. No prior coding experience is necessary but we recommend you start at the if you wish to recreate the demonstration website.

本教程系列将指导您使用HTML(用于在Web浏览器中显示文档的标准标记语言)创建和进一步自定义 。 不需要任何编码经验,但是如果您希望重新创建演示网站,建议您从的 。

At the end of this series, you should have a website ready to deploy to the cloud and a basic familiarity with HTML. Knowing how to write HTML will provide a strong foundation for learning additional front-end web development skills, such as CSS and JavaScript.

在本系列的最后,您应该拥有一个可以部署到云的网站,并且对HTML有了基本的了解。 知道如何编写HTML将为学习其他前端Web开发技能(例如CSS和JavaScript)奠定坚实的基础。

Aligning content to the center, left, or right can be useful for arranging content on your page. In this tutorial, we’ll learn how to align text using HTML.

将内容对齐到中心,左侧或右侧对于在页面上安排内容很有用。 在本教程中,我们将学习如何使用HTML对齐文本。

To align text on a webage, we can use the style attribute and the property text-align.

要在webage上对齐文本,我们可以使用style属性和text-align.属性text-align.

For example, the following code snippet would center the text “Sample text”:

例如,以下代码段会将文本“示例文本”居中:

Sample text

To align your HTML content to the left or right, you would replace center with left or right.

要将HTML内容向左或向右对齐,可以将leftright替换为center

In this tutorial, we’ll go through the process of using the text-align property to center the images and text in the top section of our webpage as illustrated in our .

在本教程中,我们将演示如何使用text-align属性将图像和文本居中显示在网页顶部,如 。

To center this content, we’ll add the text-align property to the <div> element that contains the background image, profile image, title, subtitle, and link in the top section of the homepage.

为了使此内容居中,我们将text-align属性添加到<div>元素,该元素包含背景图像,个人资料图像,标题,字幕和首页顶部的链接。

Locate this <div> element in your index.html file and add the highlighted text like so:

index.html文件中找到此<div>元素,然后添加突出显示的文本,如下所示:

...

Sammy the Shark

Senior Selachimorpha at DigitalOcean

About this site

...

Only copy and add the highlighted text-align attribute as other parts of this HTML code will not be specific to your project. Save your file and reload it in the browser. You should receive something like this:

仅复制并添加突出显示的text-align属性,因为此HTML代码的其他部分将不特定于您的项目。 保存文件,然后将其重新加载到浏览器中。 您应该会收到以下信息:

You should now understand how to center and align text and have a section that looks like the top section of the . In the next tutorial, we will recreate the middle section of the demonstration site.

现在,您应该了解如何使文本居中和对齐,并有一个类似于顶部的部分。 在下一个教程中,我们将重新创建演示站点的中间部分。

翻译自:

html文本水平居中对齐

转载地址:http://cvegb.baihongyu.com/

你可能感兴趣的文章
Sliverlight之 故事板
查看>>
Java 必知必会的 20 种常用类库和 API
查看>>
HDU 1087 Super Jumping! Jumping! Jumping!
查看>>
0007_初始模块和字节码
查看>>
[效率提升]如何管理好你的电脑文件
查看>>
C++实验二
查看>>
SharePoint2010 富文本框添加图片功能的扩展
查看>>
零零碎碎的知识
查看>>
UNIX基础--用户和基本账户管理
查看>>
设计模式
查看>>
5.0以上机器XPOSED框架安装流程
查看>>
静态方法与非静态方法
查看>>
注释,字符串
查看>>
性能瓶颈
查看>>
cmd 导入数据库
查看>>
Makefile书写注意事项--个人择记(一)
查看>>
文件转码重写到其他文件
查看>>
场景3 Data Management
查看>>
树结构练习——排序二叉树的中序遍历
查看>>
AC自动机模板
查看>>