Reputation: 268
someone recommend me to use the fieldset but it didn't work,
here is the code
.block{
display: inline-block;
border: 2px solid white;
}
.title2{
color: white;
font-size: 1.5em;
text-align: center;
}
<fieldset class="block">
<legend class="title2">
Services
</legend>
</fieldset>
it show like this
I want is like this
here is the underline
Upvotes: 0
Views: 875
Reputation: 4205
Try this code:
Because your theme can override your fieldset
style, you can just use !important
to fix.
fieldset.block {
font-family: sans-serif!important;
border: 5px solid #1F497D!important;
background: #eee!important;
border-radius: 5px!important;
padding: 15px!important;
}
fieldset.block legend.title2 {
background: #1F497D!important;
color: #fff!important;
padding: 5px 10px!important;
font-size: 32px!important;
border-radius: 5px!important;
box-shadow: 0 0 0 5px #ddd!important;
margin-left: 20px!important;
}
<fieldset class="block">
<legend class="title2">Services</legend>
<p>Some text.</p>
</fieldset>
Upvotes: 1