Title with lines filling remaining space on both sides - html

I've been asked to create this title, purely with css, Is it even possible?
The background of the text needs to remain transparent, the h2 needs to span the width of any container and have the left and right borders fill automatically the remaining space.
h2 {
font-size:42px;
line-height:48px;
width:100%;
overflow: hidden;
&:before {
content:'';
position:relative;
padding-left:50px;
padding-right:10px;
margin-right:10px;
margin-bottom:10px;
background:red;
height:3px;
display:inline-block;
}
&:after {
content:'';
margin-left:10px;
width:100%;
background:red;
height:3px;
display:inline-block;
}
}
The left side is easy, however I'm stuck on the right side.
https://jsfiddle.net/kab5qtbb/
I can't seem to figure out how to only make the right line fill the remaining space on the right of the container.

You can use margin-right:-100%; and vertical-align:middle; on the :after pseudo element. (Based on this answer: Line separator under text and transparent background) :
h2 {
font-size: 42px;
line-height: 48px;
width: 100%;
overflow: hidden;
}
h2:before, h2:after {
content: '';
display: inline-block;
vertical-align:middle;
width:50px;
height:3px;
border-top:1px solid #fff;
border-bottom:1px solid #fff;
}
h2:after {
width:100%;
margin-right: -100%;
}
/**** FOR THE DEMO ***/
body{background-image: url('https://farm9.staticflickr.com/8760/17195790401_ceeeafcddb_o.jpg');background-repeat:no-repeat;background-size:cover;color:#fff;}
<h2>HEALTH BENEFITS</h2>
<h2>HEALTH</h2>
Note that I also simplified your CSS.

If you are not too fussed about absolute positioning, you can do
h2 {
font-size:42px;
line-height:48px;
width:100%;
overflow: hidden;
&:before {
content:'';
position:relative;
padding-left:50px;
padding-right:10px;
margin-right:10px;
margin-bottom:10px;
border-top:1px solid #000;
border-bottom:1px solid #000;
height:3px;
display:inline-block;
}
&:after {
content:'';
margin-left:10px;
width:50%;
height:3px;
position:absolute;
border-top:1px solid #000;
border-bottom:1px solid #000;
top:60px;
}
}
will need tweaking but in jsfiddle this gets you what you need

Here is solution using display: table;
and display: table-cell;
The lines on the side grow and shrink after the content of the header.
.headline {
display: table;
line-height: 3px;
white-space: nowrap;
}
.headline:before {
width: 20%;
height: 2px;
margin-top: 20px;
border-right: 10px solid transparent;
}
.headline:after {
width: 80%;
border-left: 10px solid transparent;
}
.headline:before,
.headline:after {
content: '';
display: table-cell;
border-top: 1px solid black;
border-bottom: 1px solid black;
}
<h2 class="headline">
Headline
</h2>
<h2 class="headline">
Headline thats longerrrrrrrrrrrrrrrrr
</h2>

<style type="text/css">
h2 {
background-image:url(\.give url....);
font-size: 42px;
line-height: 48px;
width: 100%;
overflow: hidden;
}
h2:before {
content: '';
position: relative;
padding-left: 50px;
padding-right: 10px;
margin-right: 10px;
margin-bottom: 10px;
background: red;
height: 3px;
display: inline-block;
}
h2:after {
content: '';
margin-right: -100%;
width: 100%;
background: red;
height: 3px;
display: inline-block;
vertical-align:middle;
}
</style>
the html is:-
you also need to add background image or to use css3-gradients.

This is what Im using :)
https://jsfiddle.net/v7gze6ox/2/
fieldset {
border: 0px;
border-top: 3px solid red;
display: block;
padding-left: 25px;
padding-right: 25px;
width: 100%;
}
fieldset h2 {
margin: 10px;
color: white;
}
.bg {
background: url("http://images.all-free-download.com/images/graphiclarge/abstract_vector_green_background_277778.jpg");
}
<div class="bg">
<fieldset>
<legend align="right">
<h2>Text</h2>
</legend>
</fieldset>
</div>

Related

Make a right outer curved layer for paragraph with CSS

I am trying to make a list of paragraphs, and one of them should be selected, just like the image below, but it seems I just cannot succeed.
I have tried something at: http://jsfiddle.net/bmj2j2wd/ but the end just just does not curve the way I would like it to... ie outwards, not inwards.
This is the css from there:
.active{
border:2px solid dodgerblue;
border-bottom:0;
width:80px;
height:32px;
margin:10px;
position:relative;
border-radius:16px 16px 0 0;
}
.active:after,
.active:before{
content:'';
width:80px;
height:32px;
border:2px solid dodgerblue;
position:absolute;
bottom:-8px;
border-top:0;
}
.active:after{
border-left:0;
border-radius:0 0 16px 0;
down:-16px;
}
.active:before{
border-right:0;
border-radius:0 0 0 16px;
up:-16px;
}
but it looks totally not right.
Very important would be that the two right lines after the curvature would go all the way up and down till the top and bottom of the page.
So, I'd like to ask for some help from the community in order to get this working.
You can basically use :before and :after to create a box on top and a box on bottom of your active <p> element (p.active). With these two boxes you can change the direction of the border. The following shows an example with a dynamic length based on the elements (Code on JSFiddle):
See the following solution (the original answer before edit):
.container :not(.active) {
border-right:1px solid dodgerblue;
margin:0;
padding:10px 10px 10px 20px;
width:72px;
}
.active {
border:1px solid dodgerblue;
border-radius:5px 0 0 5px;
border-right:0;
height:32px;
line-height:32px;
margin:10px;
padding-left:10px;
position:relative;
width:80px;
}
.active:after, .active:before {
border-right:1px solid dodgerblue;
content:'';
height:32px;
right:-2px;
position:absolute;
width:80px;
}
.active:after {
border-bottom-right-radius: 5px;
transform:translateY(-100%);
}
.active:before {
border-top-right-radius:5px;
transform:translateY(100%);
}
<div class="container">
<p>item1</p>
<p>item2</p>
<p>item3</p>
<p class="active">item4</p>
<p>item5</p>
<p>item6</p>
</div>
You want to set vertical border on the full height of the page. This is a very difficult thing but you can use the following solution using a container which hides the overflow (the too long borders) (Code on JSFiddle):
body, html {
margin:0;
padding:0;
}
.container {
height:100vh;
margin:0;
overflow:hidden;
padding:0;
}
p {
display:block;
height:32px;
line-height:32px;
margin:10px;
padding:0;
padding-left:10px;
}
.active {
border:1px solid dodgerblue;
border-radius:5px 0 0 5px;
border-right:0;
position:relative;
width:80px;
}
.active:after, .active:before {
border-right:1px solid dodgerblue;
content:'';
height:100vh; /** same height like container */
position:absolute;
right:-2px;
width:80px;
}
.active:after {
border-bottom-right-radius:5px;
transform:translateY(-100%);
}
.active:before {
border-top-right-radius:5px;
transform:translateY(32px);
}
<div class="container">
<p>item1</p>
<p>item2</p>
<p>item3</p>
<p class="active">item4</p>
<p>item5</p>
<p>item6</p>
<p>item7</p>
</div>
An additional, maybe useful, example using :hover instead of .active to set the active element. This is useful for tests too (Code on JSFiddle):
body, html {
margin:0;
padding:0;
}
.container {
height:80vh;
margin:0;
overflow:hidden;
padding:0;
}
p {
border:1px solid transparent;
display:block;
height:32px;
line-height:32px;
margin:10px;
padding:0;
padding-left:10px;
}
p:hover {
border:1px solid dodgerblue;
border-radius:5px 0 0 5px;
border-right:0;
position:relative;
width:80px;
}
p:hover:before, p:hover:after {
border-right:1px solid dodgerblue;
content:'';
height:100vh; /** same height like container */
position:absolute;
right:-2px;
width:80px;
z-index:-1;
}
p:hover:after {
border-bottom-right-radius:5px;
transform:translateY(-100%);
}
p:hover:before {
border-top-right-radius:5px;
transform:translateY(32px);
}
<div class="container">
<p>item1</p>
<p>item2</p>
<p>item3</p>
<p class="active">item4</p>
<p>item5</p>
<p>item6</p>
<p>item7</p>
</div>
You could use :after and :before pseudo elements and add border-radius.
.active {
padding: 15px;
margin: 60px;
border: 1px solid blue;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
padding-right: 0;
display: inline-block;
border-right: none;
position: relative;
}
.active:before,
.active:after {
content: '';
position: absolute;
width: 30px;
height: 40px;
}
.active:before {
border-right: 1px solid blue;
border-bottom: 1px solid blue;
border-bottom-right-radius: 50%;
right: -30px;
top: 0;
transform: translateY(-100%);
}
.active:after {
border-right: 1px solid blue;
border-top: 1px solid blue;
border-top-right-radius: 50%;
right: -30px;
bottom: 0;
transform: translateY(100%);
}
<div class="active">Some selection</div>
Another option that uses span elements for the curved lines, instead of pseudoelements
fiddle
body {
margin: 0;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.active {
border: 1px solid red;
border-right: 0;
width: 80px;
height: 32px;
position: relative;
border-radius: 5px 0 0 5px;
display: flex;
align-items: center;
padding-left: 1em;
}
.curvy {
flex: 1;
width: 80px;
margin-left: 30px;
border: 1px solid red;
border-left: 0;
border-top: 0;
border-radius: 0 0 5px 0;
margin-bottom: -1px;
}
.active+.curvy {
margin-bottom: 0;
margin-top: -1px;
border-top: 1px solid red;
border-radius: 0 5px 0 0;
border-bottom: 0;
}
<span class="curvy"></span>
<div class="active">hi</div>
<span class="curvy"></span>
While the other two works but it was not all the way up & down.
To make the line longer/shorter, change the height & top value.
height: 50vh;
top: calc(-50vh - 1px);
.active{
border:1px solid red;
border-right:0;
width:80px;
height:32px;
margin: 150px auto 0;
position:relative;
border-radius: 10px 0px 0 10px;
padding: 10px;
}
.active:after,
.active:before {
content: '';
position: absolute;
width: 20px;
height: 50vh;
}
.active:before {
top: calc(-50vh - 1px);
right: -20px;
border-bottom-right-radius: 10px;
border: 1px solid red;
border-left: none;
border-top: none;
}
.active:after{
bottom: calc(-50vh - 1px);
right: -20px;
border-top-right-radius: 10px;
border: 1px solid red;
border-left: none;
border-bottom: none;
}
<div class="active">hi</div>

How to cut a corner with CSS when background image is necessary?

The above is an image of a project I'm working on. This is how far I got:
Creating the box was fairly simple; however, now I have NO IDEA how to create this cut corner on the bottom left. I've tried a bunch of things already and most things work if the background isn't transparent but a block of color. Since the background needs to be this image, I can't make the cut corner work without having one side show a certain color. This is my code:
<div class="profile">
// HTML content
</div>
<style>
profile {
border: 2px solid #fff;
color: #fff;
height: 100%;
padding: 10px;
width: 250px;
</style>
I've tried multiple things already, such as this here (not the exact code I used, but I followed this example):
.cut {
border: none;
position: relative;
}
.cut:before {
content: "";
position: absolute;
bottom: 0;
right: 0;
border-bottom: 20px solid lightgrey;
border-left: 20px solid #e67e22;
width: 0;
}
This creates a cut corner, but with a block of a solid color and I need the image to be shown, not the color.
Does anyone have a clue how to do this? Suggestions are much appreciated. Thanks!
You may use before/after element to make the bottom part like this :
.profile {
position:relative;
display:inline-block;
margin:50px;
border:1px solid #000;
border-bottom:none;
width:100px;
height:200px;
background:#ccc;
}
.profile:after {
content:" ";
position:absolute;
border:1px solid #000;
height:20px;
width:80px;
bottom:-20px;
right:-1px;
border-top:0;
border-left:0;
background:#ccc;
}
.profile:before {
content:" ";
position:absolute;
border-bottom:1px solid #000;
height:29px;
width:29px;
transform:rotate(45deg);
bottom:-15px;
left:6px;
background:#ccc;
}
<div class="profile"></div>
the bottom is split into tow part : a rectangle with only two border + a square with one border rotated with 45°
Hope it helps
NB : Becarefull when changing the dimensions
.profile {
position: relative;
display: inline-block;
width: 200px;
height: 200px;
border-top: 2px solid #000;
border-left: 2px solid #000;
border-right: 2px solid #000;
padding: 20px;
box-sizing: border-box;
font-family: Arial, sans-serif;
}
.profile h2 {
margin: 0 0 10px;
}
.profile p {
font-size: 14px;
}
.profile .bottom {
position: absolute;
bottom: -30px;
right: -2px;
width: 180px;
height: 30px;
border-bottom: 2px solid #000;
box-sizing: border-box;
border-right: 2px solid #000;
}
.profile .bottom::before {
content: '';
position: absolute;
left: -10px;
bottom: -4px;
width: 2px;
height: 35px;
background-color: #000;
transform: rotate(-35deg);
}
<div class="profile">
<h2>Name</h2>
<p>Description</p>
<div class="bottom"></div>
</div>
I think you're trying to cut the corner of an image instead of div, so you can do something like this:
body {
background: url('https://www.lunapic.com/editor/premade/o-paint-bucket.gif');
}
.container {
display: inline-block;
width: 200px;
height: 300px;
overflow: hidden;
}
.container .image_container {
width: 320px;
height: 550px;
overflow: hidden;
display: block;
position: relative;
transform: rotate(45deg);
margin-left: calc(260px - 360px);
margin-top: -40px;
}
.container .image_container .image {
transform: rotate(-45deg);
margin-top: 10px;
margin-left: -10px;
}
<div class="container">
<div class="image_container">
<div class="image">
<img src="https://www.w3schools.com/css/img_fjords.jpg" />
</div>
</div>
</div>

span text over the image

i am try to dsiplay span text over the image when mouse hover the div.
i am try this.
html
<div id="some-div">
<a href="#"><img class='round_border type_border' src='http://www.jewsnews.co.il/wp-content/uploads/2013/08/Donald_Duck.gif'/>
<span id="some-element">Dounald
</span></a>
</div>
css look like this
<style>
#some-div{
position:relative
}
#some-element {
width:100px;
height:100px;
border: 1px solid orange;
display: none;
font-size: 10px;
bottom: 0px;
left: 0px;
right: 0px;
text-align: center;
text-transform: uppercase;
position: absolute;
top:0;
left:0;
background:rgba(255,79,50,.5);
color:Black !important;
margin-top:2px;
border:1px solid gray;
-webkit-border-radius: 500px;
-moz-border-radius: 500px;
border-radius: 500px;
}
#some-div:hover #some-element {
display: block;
position: relative;
cursor: pointer;
color:#FFFFFF;
}
a{
position: relative;
}
.type_border {
width: 100px;
height: 100px;
background: white;
position: absolute;
}
.round_border {
float: left;
border:1px solid gray;
-webkit-border-radius: 500px;
-moz-border-radius: 500px;
border-radius: 500px;
background: white;
}
</style>
Add position: absolute to span and position:relative to main div
#some-div{
position:relative
}
#some-element {
width:80px;
border: 1px solid #ccc;
display: none;
font-size: 10px;
bottom: 0px;
left: 0px;
right: 0px;
text-align: center;
text-transform: uppercase;
position: absolute;
top:0;
left:0
}
DEMO
Use Title.
<img class='img' title='Donald Duck' src='http://www.jewsnews.co.il/wp-content/uploads/2013/08/Donald_Duck.gif'/>
If you want text to be displayed on mouse hover image.
You can simply do it by using title attribute of html image element
For ex:
You will be able to see that text when mouse hoveered.
Hope this helps..
Unfortunately as far as i know you cannot insert text on the image.
Workaround for this is to have span in a div which is having background image can work
#some-div{
background-image:url('http://www.jewsnews.co.il/wp-content/uploads/2013/08/Donald_Duck.gif');
background-repeat:no-repeat;
}
check this link http://jsfiddle.net/sy6MG/

How do I simplify this header with lines on the side, so that it doesn't need css3 background properties?

I have a css class for centering a heading, and adding vertically centered lines on either side. Problem is, it uses css3 background properties, and not every browser supports those. So I'd like to simplify this for cross browser compatibility, but am not sure how to do that.
Is there a simpler way to achieve this, without the css3 background (and without adding any extra elements or static heights/widths)?
demo here
.section-heading {
display: table;
white-space: nowrap;
}
.section-heading:before {
background: linear-gradient(to bottom, black, black) no-repeat left center / 95% 1px;
content: "";
display: table-cell;
width: 50%;
}
.section-heading:after {
background: linear-gradient(to bottom, black, black) no-repeat right center / 95% 1px;
content: "";
display: table-cell;
width: 50%;
}
<h2 class="section-heading">Example</h2>
You can use fieldset and legend, it's not very beautiful code but you don't need CSS3
http://jsfiddle.net/dASCv/9/
fieldset {
text-align: center;
border: none;
border-top: 1px solid black;
}
legend {
padding: 20px;
}
<fieldset>
<legend>
<h2>Example</h2>
</legend>
</fieldset>
OR this other method whit :after and :before
http://jsfiddle.net/dASCv/10/
div {
text-align: center;
}
h2:before,
h2:after {
border-top: 1px solid black;
display: block;
height: 1px;
content: " ";
width: 40%;
position: absolute;
left: 0;
top: 1.4em;
}
h2:after {
right: 0;
left: auto;
}
<div>
<h2>text TEXT</h2>
</div>
There is my best try.
I have a little isue that I have corrected in Chrome; but I really don't know even why it works.
The CCS is
.test {
display: table-row;
white-space: nowrap;
line-height: 0px;
}
.test:before,
.test:after {
border-color: transparent;
border-top: solid black 1px;
border-left: solid transparent 1px;
border-bottom: solid rgba(0,0,0,0.01) 11px;
border-right: solid transparent 1px;
content: "";
display: table-cell;
width: 50%;
}
.test:before {
border-right: solid 30px transparent;
}
.test:after {
border-left: solid 30px transparent;
}
I am using the border to display the black line, and to have it positioned in place I have reduced the height of the table to 0.
fiddle
In the fiddle, I have kept your original demo, so that you can compare side by side.
And now, the weird part. change rgba(0,0,0,0.01) in the border bottom to rgba(0,0,0,0.001), and it will break (at least in Chrome).
I really would like to understand that ...
new answer
All the above was asuming that the requirement was to have a transparent style (that is , that it was posible to set a background that could be seen thru the h1. If this is not the case, there is another posible solution, using box-shadow instead of gradient barckground:
.test {
display: table-row;
white-space: nowrap;
}
.test:before,
.test:after {
border: solid white 10px;
content: "";
display: table-cell;
width: 50%;
height: 10px;
line-height: 10px;
box-shadow: inset 0px 5px white, inset 0px 6px black;
}
.test:before {
border-right-width: 10px;
border-left-width: 1px;
}
.test:after {
border-left-width: 10px;
border-right-width: 1px;
}
new demo
1-element solution
FIDDLE
div {
display: inline-block;
background: #fff;
padding: 0 10px;
}
div:before {
content: '';
display: block;
position: absolute;
left: 0;
width: 100%;
height: 20px;
border-bottom: 1px solid #c2c2c2;
margin-top: -9px;
z-index: -1;
}
<div>A header</div>
(NB: for this solution to work, you need to set text-align:center on its parent element)
2-element solution (works over a background image)
FIDDLE
.splitHR {
text-align: center;
overflow: hidden;
}
.splitHRText {
display: inline-block;
position: relative;
padding: 0 10px;
}
.splitHRText:before,
.splitHRText:after {
content: '';
display: block;
width: 1000px;
position: absolute;
top: 0.73em;
border-top: 1px solid #c2c2c2;
}
.splitHRText:before {
right: 100%;
}
.splitHRText:after {
left: 100%;
}
<div class="splitHR">
<span class="splitHRText">A header</span>
</div>
Please add Prefix for the CSS
For Webkit browswers
-webkit-gradient
Firefox
-moz-linear-gradient
IE
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#000000');
More Details Here http://webdesignerwall.com/tutorials/cross-browser-css-gradient
Using this way also you can achieve the answer, please check this
<p style="display:block; width:100%; text-align:center;
border-bottom:1px #ccc solid; line-height:3px">
<span style="background-color:red; ">Examples</span></p>
http://jsfiddle.net/dASCv/11/
css
h2 {
border-bottom: 1px solid black;
text-align: center;
margin: 0;
padding: 0;
}
h2 span {
display: inline-block;
position: relative;
padding: 0 20px;
bottom: -15px;
background-color: white;
}
markup
<h2><span>text Textsssssssssssssssss</span></h2>
You could set the bottom for span in percentage if you set the height for h2.
you can use this code:
JsFiddle DEMO
HTML:
<h2><span>Title is here</span></h2>
CSS:
h2{
display:block;
text-align:center;
line-height:30px;
}
h2 span{
background:#fff;
padding:0 10px;
}
h2:after{
content:"";
display:block;
border-top:1px solid black;
margin-top:-15px;
}
Update:
you can use this code too: (single element)
JsFiddle
HTML:
<h2>Title is here</h2>
CSS:
h2{
display: table;
margin: 0 auto;
text-align: center;
line-height: 30px;
padding: 0 10px;
background: #FFF;
}
h2:after{
content:"";
display:block;
border-top:1px solid;
margin-top:-15px;
position:absolute;
width:100%;
left:0;
z-index:-1;
}

bracket style border around elements

I'm looking for a way to implement a bracket style border around my <h2> headings; I've attached an image showing exactly what I'm trying to accomplish.
The only way I can think of to achieve this effect is by using images, but I'm unsure of exactly how to do so(all of my <h2>s are of varying length/height, or if maybe there is a better way.
Any tips & insight are greatly appreciated.
**I hate to resurrect this, but what can I look towards as being the solution to the problem shown int he updated image? The right line is too far right, as well as some opacity issues above and below the text..
UPDATE:
Working jsFiddle example.
Use the following. You just need to change the font of the text or replace it for an image, and maybe change the color of the borders to match yours.
For the HTML:
<div id="h2pre"></div>
<h2>
<div id="h2inpre"></div>
<div id="h2cont">Ready for the event of a lifetime?<br/>
We'd love to hear from you.
</div>
<div id="h2inpos"></div>
</h2>​
For the CSS:
h2{
text-align:center;
position:relative;
margin-left:50%;
left:-150px
}
div{ float:left; }
#h2inpre, #h2inpos{
background-color:#fff;
height:50px;
width:20px;
border-bottom:1px solid #FFA500;
border-top:1px solid #FFA500;
}
#h2inpre{
border-left:1px solid #FFA500;
}
#h2inpos{
border-right:1px solid #FFA500;
clear:right;
}
#h2cont{
font-family:"Arial",sans-serif;
padding:5px;
background-color:#fff;
}
#h2pre{
height:1px;
width:100%;
background-color:#FFA500;
margin-top:25px;
position:absolute;
float:none;
}
​
html:
<h2 class="bracket"><span class="text">Ready for the event of a lifetime?<br>We'd love to hear from you.</span></h2>
css:
.bracket {
position: relative;
text-align: center;
color: #999;
font-size: 1.2em;
}
.bracket:before {/* vertical stripe */
content: " ";
border-top: solid 1px orange;
position: absolute;
bottom: 50%;
left: 0;
right: 0;
}
.bracket .text {
position: relative;
display: inline-block;
background: #fff;
padding: .2em 1em;
max-width: 80%;/* force that at least some of vertical stripe is still shown */
}
.bracket .text:before {/*left bracket*/
content: " ";
border: solid 1px orange;
border-right: 0px;
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: .4em;
right: 0;
}
.bracket .text:after {/*right bracket*/
content: " ";
border: solid 1px orange;
border-left: 0px;
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: .4em;
right: 0;
}
demo: http://jsbin.com/ibiyal/2
You'll probably have to tinker with the padding of the text block, and the width of the left and right bracket.
Only downside is that it only works on a solid background.
It is perfectly possible. Take a look: http://tinkerbin.com/zQ1VWLLi
The HTML...
<h2 class="box">
<span>Ready for the event of a lifetime? <br/> We'd love to hear from you.</span>
</h2>
The CSS...
h2:before,
h2 span:before,
h2 span:after {
content: "";
position: absolute;
}
h2 {
position: relative;
font: 16px/1.2em cambria;
text-align: center;
}
h2:before {
top: 50%;
height: 1px; width: 100%;
background-color: orange;
}
h2 span {
display: block;
width: 50%;
padding: 7px;
margin: 0 auto;
position: relative;
background: /*same as background where it sits*/;
border: 1px solid orange;
}
h2 span:before,
h2 span:after {
left: 7%; right: 7%;
height: 1px;
background: /*same as background where it sits*/;
}
h2 span:before {
top: -1px;
}
h2 span:after {
bottom: -1px
}
You could do this with HTML and CSS.
CSS
#container {
position: relative;
height: 43px;
}
#bracks {
background-color: #fff;
margin:0 auto;
border: 1px solid black;
width: 200px;
height: 40px;
position: relative;
}
#text {
background-color: #fff;
position: absolute;
width: 150;
left: 15;
height: 22px;
top: -1;
padding: 10px;
text-align: center;
}
#strike {
position: absolute;
top: 21;
width: 100%;
border-top: 1px solid black;
}
HTML
<div id="container">
<div id="strike"> </div>
<div id="bracks">
<div id="text">Some text here.</div>
</div>
</div>