html - Strikethrough Element Without Going Over or Under Element -
i want draw lines left , right of element edge of parent element.
i'm not sure how describe otherwise, maybe screenshot trick:

as can see, close perfect, , if put
overflow: hidden; on heading, better, can't see nice rounded corners (red circled parts in screenshot) because it's cut-off.
at moment, is, html:
<div id="intropage" class="intropage"> <div class="test">heading</div> </div> where "intropage" gray part see.
my css this:
.intropage { position: relative; max-width: 1000px; margin: auto; padding-top: 50px; height: 100%; background: gray; } .test { position: relative; /* overflow: hidden; */ text-align: center; } .test:before, .test:after { content: ""; position: relative; background: #0099ff; height: 6px; display: inline-block; width: 50%; border-radius: 2px; } .test:before { right: 10px; margin-left: -50%; } .test:after { left: 10px; margin-right: -50%; } anyone has better solution this?
thanx in advance!
here's quick fiddle sorry , had use 2 divs blue lines cooperate hybrid layout: flexbox modern browsers , display table fallback.
html
<div id="intropage" class="intropage flexbox"> <div class='line'></div> <div class="test"> heading </div> <div class='line'></div> </div> css
body { background: grey; } .intropage { position: relative; width: 100%; max-width: 100vw; padding-top: 3em; height: 100%; background: gray; display: table-row; } .test { position: relative; text-align: center; width: 20%; min-width: 1.5em; display: table-cell; font-variant: small-caps; font-weight: 700; font-size: 2em; line-height: 2.5em; flex-grow: 1; flex-shrink: 1; flex-basis: 20%; } .line { position: relative; background: #0099ff; height: .4em; border-radius: 2px; display: table-cell; height: 6px; flex-grow: 1; flex-shrink: 1; flex-basis: 39%; } .flexbox { display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: center; align-content: center; align-items: center; }
Comments
Post a Comment