horizontal line css center code example
Example 1: css text line in middle
h2 {
text-decoration: line-through;
}
Example 2: css align center vertical and horizontal
.parent-class {
display: flex;
align-items: center;
justify-content: space-around;
}
Example 3: how to horizontal center a div in css
#inner {
width: 50%;
margin: 0 auto;
}
Example 4: CSS technique for a horizontal line with icons in the middle
<h1>Heading</h1>
<h1>This is a longer heading</h1>
h1 {
overflow: hidden;
text-align: center;
}
h1:before,
h1:after {
background-color: #000;
content: "";
display: inline-block;
height: 1px;
position: relative;
vertical-align: middle;
width: 50%;
}
h1:before {
right: 0.5em;
margin-left: -50%;
}
h1:after {
left: 0.5em;
margin-right: -50%;
}