I'm coding a free PSD to HTML and everything is fine except one thing - I have no idea how to get something like this:
How do I get h1 above border so it can cover a part of it? Can it be done with pure CSS or do I have use JS?
I'm coding a free PSD to HTML and everything is fine except one thing - I have no idea how to get something like this:
How do I get h1 above border so it can cover a part of it? Can it be done with pure CSS or do I have use JS?
Maybe with some regular tags (not against semantic) and flex you can do it:
div {
magin: 2em;
margin-top: 2em;
border: solid;
border-top: 0;
padding: 1px;
text-align: center;
}
h1 {
margin-top: -0.6em;
display: flex;
align-items: center;
}
h1:before,
h1:after {
content: '';
flex: 1;
border-bottom: solid;
margin: auto -3px auto 2em;
}
h1:before {
margin: auto 2em auto -3px;
}
p {
padding: 1em;
}
/* do i see through ? */
body {
background:linear-gradient(to bottom left, gray,yellow,purple,gold,pink,tomato);
<div>
<h1>HTML Ipsum Presents</h1>
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris
placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis
tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
Mauris placerat eleifend leo.</p>
</div>
Are you looking for this?
Here is JSFiddle
Hope this helps.