0
how to center the headings?
7 ответов
+ 5
Never use HTML for layout and style. Use CSS instead. To center lines of text, like headings and paragraphs, use this:
H1 { text-align: center }
P { text-align: center }
To use it inline:
<H1 style="text-align: center">A Heading</H1>
+ 1
@Patrick
margin: auto; will only center a block if it's less than 100%. But even then, the text is still left aligned.
text-align:center; centers the text not the block, wich in this case is a heading or a paragraph that's 100% wide by default.
0
use in CSS sheet
h1{text-align:center;}
0
using css you can set margin to 0 auto to center the block
0
By using CSS
ex:
h1{text-align:center}
- 1
By using "align" attribute
For example
<h1 align="center"> your text </h1>
- 1
<center>