How would I center the title of my web page. Here is my code so far written out on paper:
I want to center the heading of my title "Libertarian Nation"
The code written out without image:
<!DOCTYPE html>
<html>
<head>
<title>"Libertarian Nation"</title>
</head>
<body>
A place of decentralisation
</body>
</html>
So how could I center the title of my page?
3
Answers
you can simply try something like this:
HTML:
CSS:
This can either go in a separate file or above between
<Style>
tags.Although it’s now depreciated (no longer being updated and may break) you can use;
An alternative is creating a CSS class for it. For example:
This will create a class in CSS called center for convenience. So you can now make your title like this:
This should now create a centered title saying Title!
Please note that
<Title>
does not make a title on the page itself but is the name visabel on the tab. Please a CSS class or something like<H1>
to make your titles or headings for your website.considering ‘decentralisation’ is the text you wish to bring to centre.
Keep in mind everything in html is kind of like encapsulated e.g.
<body>your text </body>
is encapsulated with in body tag. So this relationship is called parent child relationship …an item can have as many grands parent going all the way up to body tag and have as many grand children going all the way down to end of body tag.so we will create a child tag.
Once we have that then we can apply styling on to it using CSS.
we haven’t we applied Css on parent or why create encapsulating tag because it would limit the scope other wise things will be applied on all the other children of the parent as well.
Further links to play around with
some alignment trickery