I have been searching all over for a way to make my <br>
tag display less whitespace between the two lines it is separating.
I have some text with a text-input and beneath that I want to have an image. The <br>
tag makes too large of a gap, but without the <br>
tag the image appears on the line with the text. Note that the <br>
makes the perfect size gap for the rest of the elements in the div
.
<div>
...<!--Some other text and text inputs-->
<br>Some stuff: <input type="text">
<br><!--I need this br to be a smaller gap-->
<img id="plus" src="plus.png" height="30px" width="30px">
</div>
So my question is how do I make that distance smaller?
What I've tried
Now I have tried a lot of things! Some of these include editing the br in CSS like
br {
display: block;
margin: 1px 0;
line-height:1px;
content: " ";
}
or a combination of those attributes, but no matter which ones I use the minimum height it gets the space down to is the same as the default <br>
. It works well for increasing the <br>
space, though.src
I tried putting the <br>
tag inside of a <div>
, but when that <div>
is inside my other <div>
, it immediately makes a gap that is the same height as a default <br>
(even if I don't have a <br>
inside my new <div>
). Setting the line-height of the new <div>
doesn't affect this either.src
<div style="line-height:0px;">
<br>
</div>
I tried using a <hr>
with the visibility: hidden, but that made the gap larger than the <br>
.src
I tried many, many, different variations of putting <div>
s within <div>
s and setting the line-height, but no matter what I get to it ends up not affecting the space between the text-area and the image without messing up everything else in the original <div>
.
`. The correct one tag is `label` around the text (you can include input into label too). – pavel Dec 12 '17 at 18:51
` or a `
` it makes an even larger gap in between the text-area and the image? And I can't mess with the outermost `
`s earlier in it.