I’m somewhat new to css and I’ve been trying to create a header with the website title sitting in the middle of it. Only thing is when I try to make the font bigger it moves down and eventually overflows out of the header box. I want to keep it contained within but I have no idea how.
This is what I have so far:
header {
background-color: #ffd7f5;
color: #fe8fd3;
text-align: center;
font-size: 47px;
position: fixed;
top: 0;
width: 100%;
height: 110px;
z-index: 5;
margin: auto;
border-radius: 5px;
border: 5px dashed #fe8fd3;
}
and this is the html:
<body>
<header>
<h1>Header Title</h1>
</header>
</body>
2
Answers
I changed your code little bit as below. Try it.
H1 tag is taking default margin, you need to set it up. Just add the below css code in your style and it will work fine.