Skip to content Skip to sidebar Skip to footer

How To Stop Css From Overlaying Text

Maybe this is a really dumb question but how do I stop css from overlaying when I'm trying to bigger the font size? Thanks on advance for the help. I'm just started so again mayb

Solution 1:

You have to adjust the line-height as well, e.g. set it like the font-size to 60px. The text overlaps, if the line-height is to small for a given font-size.

@import url(https://fonts.googleapis.com/css?family=Fjalla+One);
html {
  height: 100%;
}

body {
  font-family: 'Fjalla One', sans-serif;
  background: #2C3E50;
  /* fallback for old browsers */
  background: -webkit-linear-gradient(to top, #4CA1AF, #2C3E50);
  /* Chrome 10-25, Safari 5.1-6 */
  background: linear-gradient(to top, #4CA1AF, #2C3E50);
  /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}

.container {
  margin: auto;
}

h1 {
  text-transform: uppercase;
  font-size: 60px;
  line-height: 60px;
  letter-spacing: 2px;
  text-shadow: #533d4a 1px 1px, #533d4a 2px 2px, #533d4a 3px 3px, #533d4a 4px 4px;
  text-align: center;
}

.title {
  transform: translateX(-50%) rotate(-5deg);
  display: block;
  margin-left: 50%;
}
<section class="container">
  <h1>
    <span class="title">
       <label style="color:#e55643;">Burger</label><label style="color:#2b9f5e;">school</label>
    </span>
    <span class="title" style="color:#f1c83c;">afspraken</span>
  </h1>
</section>

Solution 2:

In your code you have set the line-height : 47px; but you are trying to increase your font size to be even bigger than line-height.

font-size: 60px;
line-height: 47px;  <!--This is what causing the problem, increase it as much as you increase the font size-->

For example :

font-size: 60px;
line-height: 60px; <!--It will do the job-->

Solution 3:

change line-height:47px; and increase it equal to font-size


Post a Comment for "How To Stop Css From Overlaying Text"