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

Remove spacing between lines in CSS

I was trying to get rid of spacing between lines in one text element. I need to completely remove it or even get on the previous line. Property line-height doesn’t work with negative numbers and I don’t want to separate the element into several so margin and padding won’t help either.

screenshot
(I have to remove the red area)

<span id="my_line">lalalalalalalalala</span> <!--the word is cutting off-->
#my_line{
  overflow-wrap: break-word;
  line-height: 0; /* I need even less */
}

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

>Solution :

not a good answer but you can try this.

you can use <p> and remove margin, padding and give it line-hight and font-size same for removing the space between lines.
or you can decrease the line-height if you still see space between lines.

<html>
<head>
<style>
p{
padding:0px;
margin:0px;
line-height:12px;
font-size:14px
}
</style>
</head>
<body>

<p>My First Heading My First Heading My first paragraph. My first paragraph. My first paragraph. My first paragraph.My My First Heading My first paragraph. My first paragraph. My first paragraph. My first paragraph.My first paragraph. My first paragraph. first paragraph. My first paragraph.</p>


</body>
</html>
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