“Pr text text align”的版本间差异

本页内容
(创建页面,内容为“{{DISPLAYTITLE:text-align}}5 = CSS text-align 属性 = h1, h2, 和 h3元素设置文本的对齐方式: <sample title="" desc="" lang="html" hererun="1"> h1 {text-align:center} h2 {text-align:left} h3 {text-align:right} </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <style> h1 {text-align:center} h2 {text-align:left} h3 {text-align:right} </style> </head> <body>…”)
 
Neo讨论 | 贡献
无编辑摘要
第55行: 第55行:
{| class="table table-striped table-hover"
{| class="table table-striped table-hover"
! 属性
! 属性
!
! Chrome
!
! Internet Explorer / Edge
!
! Firefox
!
! Safari
!
! Opera
|-
|-
| text-align
| text-align

2022年8月19日 (五) 04:29的版本

CSS text-align 属性

h1, h2, 和 h3元素设置文本的对齐方式:


示例

h1 {text-align:center}
h2 {text-align:left}
h3 {text-align:right}

在此页底部有更多的例子。

属性定义及使用说明

text-align属性指定元素文本的水平对齐方式。

默认值: 如果 direction 属性是 ltr,则默认值为 left;如果 direction 属性是 rtl,则默认值为 right。
继承: yes
版本: CSS1
JavaScript 语法: object.style.textAlign="right"

浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号。

紧跟在 -webkit-, -ms- 或 -moz- 前的数字为支持该前缀属性的第一个浏览器版本号。

属性 Chrome Internet Explorer / Edge Firefox Safari Opera
text-align 1.0 3.0 1.0 1.0 3.5

属性值

描述
left 把文本排列到左边。默认值:由浏览器决定。
right 把文本排列到右边。
center 把文本排列到中间。
justify 实现两端对齐文本效果。
inherit 规定应该从父元素继承 text-align 属性的值。

更多实例

更多高级文本对齐的例子 这个例子演示了一个更高级的文本对齐的例子。

相关文章

CSS 教程: CSS 文本

此页面最后编辑于2022年8月19日 (星期五) 04:29。