I have tried searching for answers but nothing worked. I am trying to align a paragraph. I am pretty sure nothing is overwriting code in CSS. Here is the HTML and CSS:
body {
background-image: url("../../images/pic01.jpg");
background-repeat;
}
#main {
background-color: rgb(255, 84, 0);
width: 75%;
margin-left: auto;
margin-right: auto;
margin-bottom: auto;
margin-top: auto;
overflow: auto;
height: 100%;
color: rgb(255, 255, 255);
}
#center {
text-align: center;
}
<body id="top">
<div id="main">
<p id="center">
<h1> TEST </h1>
</p>
</div>
</body>
What is the mistake here?
<p>
can't contain a<h1>
– Affectingh1 { display: inline-block; }
(which btw would also solve the text-centering issue). – Tawana<p>
elements are block level by default. – Affectingh1
toinline
orinline-block
? – Tawana</p>
tag after the</h1>
.<p id="center"> <h1> TEST </h1>
should be perfectly valid HTML since it is allowed to not explicitly close<p>
tags. – Tawana