[html] CSS technique for a horizontal line with words in the middle

Horizontal and Vertical line with words in the middle

_x000D_
_x000D_
.box{_x000D_
    background-image: url("https://i.stack.imgur.com/N39wV.jpg");_x000D_
    width: 350px;_x000D_
    padding: 10px;_x000D_
}_x000D_
_x000D_
/*begin first box*/_x000D_
.first{_x000D_
    width: 300px;_x000D_
    height: 100px;_x000D_
    margin: 10px;_x000D_
    border-width: 0 2px 0 2px;_x000D_
    border-color: red;_x000D_
    border-style: solid;_x000D_
    position: relative;_x000D_
}_x000D_
_x000D_
.first span {_x000D_
    position: absolute;_x000D_
    display: flex;_x000D_
    right: 0;_x000D_
    left: 0;_x000D_
    align-items: center;_x000D_
}_x000D_
.first .foo{_x000D_
    top: -8px;_x000D_
}_x000D_
.first .bar{_x000D_
    bottom: -8.5px;_x000D_
}_x000D_
.first span:before{_x000D_
    margin-right: 15px;_x000D_
}_x000D_
.first span:after {_x000D_
    margin-left: 15px;_x000D_
}_x000D_
.first span:before , .first span:after {_x000D_
    content: ' ';_x000D_
    height: 2px;_x000D_
    background: red;_x000D_
    display: block;_x000D_
    width: 50%;_x000D_
}_x000D_
_x000D_
_x000D_
/*begin second box*/_x000D_
.second{_x000D_
    width: 300px;_x000D_
    height: 100px;_x000D_
    margin: 10px;_x000D_
    border-width: 2px 0 2px 0;_x000D_
    border-color: red;_x000D_
    border-style: solid;_x000D_
    position: relative;_x000D_
}_x000D_
_x000D_
.second span {_x000D_
    position: absolute;_x000D_
    top: 0;_x000D_
    bottom: 0;_x000D_
    display: flex;_x000D_
    flex-direction: column;_x000D_
    align-items: center;_x000D_
}_x000D_
.second .foo{_x000D_
    left: -15px;_x000D_
}_x000D_
.second .bar{_x000D_
    right: -15.5px;_x000D_
}_x000D_
.second span:before{_x000D_
    margin-bottom: 15px;_x000D_
}_x000D_
.second span:after {_x000D_
    margin-top: 15px;_x000D_
}_x000D_
.second span:before , .second span:after {_x000D_
    content: ' ';_x000D_
    width: 2px;_x000D_
    background: red;_x000D_
    display: block;_x000D_
    height: 50%;_x000D_
}
_x000D_
<div class="box">_x000D_
    <div class="first">_x000D_
        <span class="foo">FOO</span>_x000D_
        <span class="bar">BAR</span>_x000D_
    </div>_x000D_
_x000D_
   <br>_x000D_
_x000D_
    <div class="second">_x000D_
        <span class="foo">FOO</span>_x000D_
        <span class="bar">BAR</span>_x000D_
    </div>_x000D_
</div>
_x000D_
_x000D_
_x000D_

This is also answered in https://stackoverflow.com/a/57279326/6569224

Examples related to html

Embed ruby within URL : Middleman Blog Please help me convert this script to a simple image slider Generating a list of pages (not posts) without the index file Why there is this "clear" class before footer? Is it possible to change the content HTML5 alert messages? Getting all files in directory with ajax DevTools failed to load SourceMap: Could not load content for chrome-extension How to set width of mat-table column in angular? How to open a link in new tab using angular? ERROR Error: Uncaught (in promise), Cannot match any routes. URL Segment

Examples related to css

need to add a class to an element Using Lato fonts in my css (@font-face) Please help me convert this script to a simple image slider Why there is this "clear" class before footer? How to set width of mat-table column in angular? Center content vertically on Vuetify bootstrap 4 file input doesn't show the file name Bootstrap 4: responsive sidebar menu to top navbar Stylesheet not loaded because of MIME-type Force flex item to span full row width

Examples related to cross-browser

Show datalist labels but submit the actual value Stupid error: Failed to load resource: net::ERR_CACHE_MISS Click to call html How to Detect Browser Back Button event - Cross Browser How can I make window.showmodaldialog work in chrome 37? Cross-browser custom styling for file upload button Flexbox and Internet Explorer 11 (display:flex in <html>?) browser sessionStorage. share between tabs? How to know whether refresh button or browser back button is clicked in Firefox CSS Custom Dropdown Select that works across all browsers IE7+ FF Webkit