css 控制 div文本對齊 text-align

來源:互聯網
上載者:User

text-align定義
文字對齊div 中的一個要素。

繼承:是


JavaScript的文法
的CSS屬性也可以動態改變一個JavaScript 。

指令碼文法: object.style.textAlign = “權”

p

text-align: center
}

Value Description
left

居左,預設

right 靠右對齊
center 置中對齊
justify  

<html>
<head>
<style type="text/css">
h1 {text-align: center}
h2 {text-align: left}
h3 {text-align: right}
</style>
</head>

<body>
<h1>This is header 1</h1>
<h2>This is header 2</h2>
<h3>This is header 3</h3>
</body>

</html>
效果如下.

 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.