Background / border behind and below text (CSS) -


i looking create effect css: https://i.stack.imgur.com/zpzvc.png

since don't know how effect called, haven't been able find solution online , can't make work on own unfortunately.

the effect repeats few times on different titles different sizes. border should begin on half of first letter.

who can me?

i'd use :after pseudo class on span element accomplish this.

body {     background: #3e9ce2;     color: white;     font-family: sans-serif;  } /* looks */       h1 span {     position: relative;     display: inline-block;        }    h1 span:after {     position: relative;     display: block;     content: "";     background: #de2f2d;     z-index: -5;       height: 22px;     top: -19px;     left: 7px;         }
<h1>this our <span class="offset-background">showcase</span></h1>

the position , display attributes on span make sure :after element positioned (directly underneath span) , has same width text.

the pseudo element has define height , position offset, negative z-index make sure it's drawn behind text.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -