How to place headings at the center | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

How to place headings at the center

which tag is used

18th Feb 2017, 10:00 AM
sai Kumar
sai Kumar - avatar
5 Respuestas
+ 3
<h1 align="center">heading</h1> this is correct one
18th Feb 2017, 10:49 AM
sai Kumar
sai Kumar - avatar
+ 2
Element <center> is deprecated, you must do not use it. You must avoid 'align' attribut also, which is deprecated and only use ccs... Correct css property syntax is: text-align:center; You can use any html element you want to build your heading, but it's greatly recommended to use those that are semantical meaningful. <h1> and other family <hx> tags ( where x from 1 to 6 ) are intended to only have text childs elements ( even they can, their meaning is more "title" than "header" ), and newly html5 <header> is more generic header meaning... [ edit ] text-align:center; align the content of the element... <hx> and <header> are block-level elements, and the default behavior is to get the max width: so, it's the default correct way to do this. If you define a fixed width to the element, you can align a block-level element ( the box, not it's content) in its parent by applying 'auto' margins: /* align to center... could be write: margin:v auto; or margin:vt auto vb; for setting respectivly v, vetical margins, vt, top margin, vb bottom margin... */ margin:auto; /* align to right */ margin-left:auto; /* align to left... but this is the default behavior of a block-level element :P */ margin-right:auto;
19th Feb 2017, 10:41 AM
visph
visph - avatar
+ 1
/t/t/t - should work
18th Feb 2017, 10:48 AM
Sahaj Rastogi
Sahaj Rastogi - avatar
+ 1
<center> it needs end too with /
18th Feb 2017, 11:00 AM
Rachit
+ 1
There are many ways. you can make it <h1 align="center"></h1> or in css h1 { align: center; }
18th Feb 2017, 12:17 PM
Orfeo Terkuci
Orfeo Terkuci - avatar