0

I would like to center this text (Invalid Key) at middle of the page, vertical and horizontal in php code :

if ($_GET['key'] != "lol"){
die("
<center>
<hr>
<h1><b>Invalid Key</b></h1>
<hr>
</center>
");

How, please ? Thank you in advance.

Deepak Yadav
  • 6,804
  • 5
  • 31
  • 49

1 Answers1

1

In HTML documents - including those pre-processed by PHP - presentation is handled by CSS (Cascading Stylesheets):

PHP:

if ($_GET['key'] != "lol"){
die("
<h1>Invalid Key</h1>
");

CSS:

h1 {
position: relative;
top: calc(50vh - 50px);
height: 56px;
line-height: 56px;
padding: 20px 0;
border-top: 2px solid rgb(120,120,120);
border-bottom: 2px solid rgb(120,120,120);
text-align: center;
font-weight: bold;
}
Rounin
  • 27,134
  • 9
  • 83
  • 108