Reputation: 8978
Two svg elements a line
and path
are rendered vertically. There is a gap between these two elements, which I would like to get rid of, but I don't know how.
#upload-line-join {
position: relative;
left: 47px;
}
.svg-lines-wrapper {
width: 97px;
}
<div class="svg-lines-wrapper">
<svg id="upload-play-vert-line" width="97" height="60">
<line
id="vert-line-1"
x1="49.4"
y1="0"
x2="49.4"
y2="60"
stroke="#7e7e7e"
stroke-width="2"
/>
</svg>
<svg id="upload-line-join" fill="none" height="15" width="15" viewBox="-1.3 0 15 15">
<path
id="vert-line-2"
d="M 11, 10 C 5, 10, 1, 6, 1, 0"
stroke="#7e7e7e"
stroke-width="2"
/>
</svg>
</div>
Upvotes: 1
Views: 2396
Reputation: 106078
SVG are like img, inline-block boxes, you just need here to reset vertical-align to avoid that gap.
#upload-line-join {
position: relative;
left: 47px;
}
.svg-lines-wrapper {
width: 97px;
}
svg {vertical-align:top;}
<div class="svg-lines-wrapper">
<svg id="upload-play-vert-line" width="97" height="60">
<line
id="vert-line-1"
x1="49.4"
y1="0"
x2="49.4"
y2="60"
stroke="#7e7e7e"
stroke-width="2"
/>
</svg>
<svg id="upload-line-join" fill="none" height="15" width="15" viewBox="-1.3 0 15 15">
<path
id="vert-line-2"
d="M 11, 10 C 5, 10, 1, 6, 1, 0"
stroke="#7e7e7e"
stroke-width="2"
/>
</svg>
</div>
Upvotes: 2
Reputation: 274384
This is white spaces so you can simply add font-size:0
like this :
#upload-line-join {
position: relative;
left: 47px;
}
.svg-lines-wrapper {
width: 97px;
font-size: 0;
}
<div class="svg-lines-wrapper">
<svg id="upload-play-vert-line" width="97" height="60">
<line
id="vert-line-1"
x1="49.4"
y1="0"
x2="49.4"
y2="60"
stroke="#7e7e7e"
stroke-width="2"
/>
</svg>
<svg id="upload-line-join" fill="none" height="15" width="15" viewBox="-1.3 0 15 15">
<path
id="vert-line-2"
d="M 11, 10 C 5, 10, 1, 6, 1, 0"
stroke="#7e7e7e"
stroke-width="2"
/>
</svg>
</div>
Upvotes: 2
Reputation: 12118
You can take advantage of the position
and top
properties:
#upload-line-join {
position: relative;
left: 47px;
}
.svg-lines-wrapper {
width: 97px;
}
.svg-lines-wrapper > svg:nth-child(2) {
position: relative;
top: -5px;
}
<div class="svg-lines-wrapper">
<svg id="upload-play-vert-line" width="97" height="60">
<line
id="vert-line-1"
x1="49.4"
y1="0"
x2="49.4"
y2="60"
stroke="#7e7e7e"
stroke-width="2"
/>
</svg>
<svg id="upload-line-join" fill="none" height="15" width="15" viewBox="-1.3 0 15 15">
<path
id="vert-line-2"
d="M 11, 10 C 5, 10, 1, 6, 1, 0"
stroke="#7e7e7e"
stroke-width="2"
/>
</svg>
</div>
Upvotes: 2