Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Text overlapping itself instead of going to next line

I have this very straightforward jumbotron class :

HTML

<div class="jumbotron">Welcome to my fake shop</div>

CSS

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

body, html {
  margin:0;
  padding:0;
  height:100%
}

.jumbotron {
  background: blue;
  height:100%;
  display:flex;
  justify-content: center;
  align-items: center;
  font-size: 10vw;
  text-align:center;
}

It works perfectly fine and as expected in CodePen:
https://codepen.io/laudem/pen/ZExYvMZ

enter image description here

  1. Div is taking all the place
  2. Text is centered both vertically and horizontally
  3. If the font-size get larger, the phrase wraps onto the next line

However, this exact same code produces a different result in my code (angular)
enter image description here

  1. Div is taking all the place – Good
  2. Text is centered, both vertically and horizontally – Good
  3. But if the font-size gets larger, instead of the phrase wrapping onto the new line, it overlaps the first one.

Any idea why?

>Solution :

**Set line height **

.jumbotron {line-height:1.5;}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading