0

Good evening! I am trying to center a two lines span. If the width of the screen is big enough for the span to keep everything on the same line it is fine, it is centered and the span background wraps the text. If i go for a small width though, it will break in two lines and have the span background full width. I want to keep the blue background wraping the text span. What is this behaviour? Also if i do not put text-align: center; the span on two lines will not even be centered, so the flex is not considered.

html:

body{
  margin:0;
  padding:0;
}

.text-container{
  background-color: red;
  display:flex;
  justify-content: center;
  align-items:center;
  flex-wrap: wrap;
}

.text {
  background-color: blue;
  text-align:center;
 
}
<div class="text-container">
   <span class="text">OPORTUNITATI PROFESIONALE</span>
</div>
Stefan Denis
  • 3
  • 1
  • 4

0 Answers0