-2

How do I prevent line overlapping and make media queries work for large screens for a webpage with the following HTML and CSS?

This is the HTML

<p style="font-family: &quot;verdana&quot;; font-size: 18px; color: black; line-height: 18px; text-align: justify; font-style: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: transparent;"><span style="font-size: 13.5pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><code style="background-color: cyan;"><b>Diagnosis and Tests for Addison&#39;s disease:-</b></code></span></p>
<p style="font-family: &quot;verdana&quot;; font-size: 18px; color: black; line-height: 18px; text-align: justify; font-style: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: transparent;"><span style="font-size: 13.5pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><code><b>Please E-mail us for any questions with respect to the above.</b></code></span></p>

This is the CSS

code {
  font-family: &quot;verdana&quot;;
  font-size: 18px;
  color: black;
  font-weight: bold !important;
  line-height: 1.5 !important;
  }
@media (max-width: 480px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 481px) and (max-width: 767px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 768px) and (max-width: 1024px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 1025px) and (max-width: 1280px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 1281px) {
code {
  font: 18px "verdana" !important;
  }
}
1
  • The inline-height and @media query don't seem to be working Commented Apr 2 at 7:22

1 Answer 1

-1

Using this CSS finally solved it

code {
  font-family: &quot;verdana&quot;;
  font-size: 18px;
  color: black;
  font-weight: bold !important;
  line-height: 1.5 !important;
  }
@media (max-width: 480px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 481px) and (max-width: 767px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 768px) and (max-width: 1024px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 1025px) and (max-width: 1280px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 1281px) {
code {
  font: 18px "verdana" !important;
  }
}

Please run the code snippet below to see how it works, then read the comments below that also

code {
  font-family: &quot;verdana&quot;;
  font-size: 18px;
  color: black;
  font-weight: bold !important;
  line-height: 1.5 !important;
  }
@media (max-width: 480px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 481px) and (max-width: 767px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 768px) and (max-width: 1024px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 1025px) and (max-width: 1280px) {
code {
  font: 18px "verdana" !important;
  }
}
@media (min-width: 1281px) {
code {
  font: 18px "verdana" !important;
  }
}
<p style="font-family: &quot;verdana&quot;; font-size: 18px; color: black; line-height: 18px; text-align: justify; font-style: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: transparent;"><span style="font-size: 13.5pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><code style="background-color: cyan;"><b>Diagnosis and Tests for Addison&#39;s disease:-</b></code></span></p>
<p style="font-family: &quot;verdana&quot;; font-size: 18px; color: black; line-height: 18px; text-align: justify; font-style: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: transparent;"><span style="font-size: 13.5pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><code><b>Please E-mail us for any questions with respect to the above.</b></code></span></p>

Sign up to request clarification or add additional context in comments.

1 Comment

For small screened mobiles, I had to remove this media query:- @media (max-width: 480px) { code { font: 18px "verdana" !important; } }

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.