📅  最后修改于: 2020-11-05 08:48:18             🧑  作者: Mango
如何在CSS中对齐文本?
CSS中的text-align属性用于文本的对齐。此CSS属性用于设置表格单元格框或块元素的水平对齐方式。它类似于垂直对齐属性,但在水平方向上。
文本对齐属性包括诸如对正,居中,右,左,初始和继承的值。它指定元素中文本的水平对齐方式。
句法
text-align: justify | center | left | right | initial |inherit;
该值对正拉伸元素的内容以显示每行的相等宽度,通常用于杂志和报纸。左值将文本左对齐,而右值用于将文本右对齐。值,center用于使内联文本居中。
让我们通过一个例子来理解它。
例
在此示例中,我们使用了text-align属性的所有值。
text-align property
text-align property
text-align: justify;
Hi, Welcome to the javaTpoint.com. This site is developed so that students may learn computer science related technologies easily. The javaTpoint.com is always providing an easy and in-depth tutorial on various technologies. No one is perfect in this world, and nothing is eternally best. But we can try to be better.
text-align: left;
Hi, Welcome to the javaTpoint.com. This site is developed so that students may learn computer science related technologies easily. The javaTpoint.com is always providing an easy and in-depth tutorial on various technologies. No one is perfect in this world, and nothing is eternally best. But we can try to be better.
text-align: right;
Hi, Welcome to the javaTpoint.com. This site is developed so that students may learn computer science related technologies easily. The javaTpoint.com is always providing an easy and in-depth tutorial on various technologies. No one is perfect in this world, and nothing is eternally best. But we can try to be better.
text-align: center;
Hi, Welcome to the javaTpoint.com. This site is developed so that students may learn computer science related technologies easily. The javaTpoint.com is always providing an easy and in-depth tutorial on various technologies. No one is perfect in this world, and nothing is eternally best. But we can try to be better.
输出量