1<div style="text-align:center">Dieser Text wird zentriert.
2<p>Ebenso dieser Paragraph.</p></div>
3
1/*Remove comment to become a better programmer. */
2/* No Flexbox */
3.parent {
4 position: relative;
5}
6.child {
7 position: absolute;
8 top: 50%;
9 transform: translateY(-50%);
10}
11
12/* With Flexbox */
13
14.parent {
15 display: flex;
16 flex-direction: column;
17 justify-content: center;
18}
19
1you just need to add this line of code in your tag(<p>; h1, h2, td etc):
2
3<p align="center">sample text<p/>
1<!-- Code by Scratchy -->
2<!-- Twitter: @S_cratchy-->
3
4<!-- Solution 1 -->
5<p>
6 This is some cool text in html, wow such cool text
7</p>
8
9<!-- Solution 2 -->
10<font style="text-align:right;"> This text is on the right</font>
11<font style="text-align:center;"> This text is in the center</font>
12<font style="text-align:left;"> This text is on the left</font>