This is probably a simple question but:
How can I make a title using any headling tag but I want the title between to lines like this:
HTML :
<h4>Staging Server</h4>
Illustration :
This is probably a simple question but:
How can I make a title using any headling tag but I want the title between to lines like this:
HTML :
<h4>Staging Server</h4>
Illustration :
Literally the first result on Google...
body
{
background-color: black;
color: white;
}
.subtitle {
margin: 0 0 2em 0;
}
.fancy {
line-height: 0.5;
text-align: center;
}
.fancy span {
display: inline-block;
position: relative;
}
.fancy span:before,
.fancy span:after {
content: "";
position: absolute;
height: 5px;
border-bottom: 1px solid white;
border-top: 1px solid white;
top: 0;
width: 600px;
}
.fancy span:before {
right: 100%;
margin-right: 15px;
}
.fancy span:after {
left: 100%;
margin-left: 15px;
}
<p class="subtitle fancy"><span>A fancy subtitle</span></p>
Taken from here.
You could use :after
and :before
:pseudo-elements.
h4 span {
position: relative;
color: #00C8FF;
padding: 0 15px;
margin: 0 80px;
font-size: 16px;
font-weight: 100;
}
h4 span:before, h4 span:after {
content: '';
position: absolute;
width: 60%;
height: 1px;
transform: translateY(-50%);
top: 50%;
background: #6F6F6F;
left: -60%;
}
h4 span:after {
left: 100%;
}
<h4><span>Staging Server</span></h4>
<fieldset style="border:none; border-top: 1px solid #999;">
<legend style="text-align:center;"> Staging Server </legend>
</fieldset>
Simple example could be like this:
<hr><h4>Staging Server</h4><hr>
And a little CSS tweak:
hr, h4 {
display:inline-block;
}
hr {
width:30%;
}