"Heading Text bottom border using css :child attributes"
Bootstrap 3.0.0 Snippet by msaevan

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<div class="col-md-12 root">
<h2 class="text-center">
Create your snippet's HTML
<div class="border-root">
<div></div>
<div></div>
<div></div>
</div>
</h2>
</div>
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
.root h2{
position:relative;
padding-bottom:10px;
}
.root h2 div.border-root div{
position:absolute;
bottom:0;
height:5px;
background:red;
}
.root h2 div.border-root div:first-child, .root h2 div.border-root div:last-child{
width:30px;
}
.root h2 div.border-root div:first-child{
left:0;
}
.root h2 div.border-root div:nth-child(2){
width:80px;
left:0;
right:0;
margin:0 auto;
}
.root h2 div.border-root div:last-child{
right:0;
}
.root .border-root{
position: relative;
width: 200px;
margin: 0 auto;
margin-top: 15px;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: