Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1675

Centering text with background color [duplicate]

$
0
0

Im currently trying to build a banner with the tagline( 30 years of discovery) to be centered under the title text with a light grey background only around the text. I'm able to have the text centered with a grey background spanning my entire screen. I am also able to have a colored background on just the text as long but without the text being centered on my screen.

.tagline {  font-weight: 300;  display: inline-flexbox;  justify-content: center;  align-items: center;  text-align: center;  background-color: rgba(100, 89, 95, 0.75);}
<div class="tagline"><p> 30 Years of Discovery</p></div>

I would appreciate any insight that could be offered!

I've tried placing <p> in a span, which is where I was able to just have a background color on text. This didn't allow for me to center the div.


Viewing all articles
Browse latest Browse all 1675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>