Reason:
The percentages in the gradient definition specifies the color stop points and not the length/duration of each color. So, it should be 0% for first color, 33/34% for second color (in the middle), 67% for second color (in the middle) and 100% for the 3rd if you are looking for a 3 color gradient.
When you specify it as linear-gradient(to top, rgba(18, 61, 87, 1) 34%, rgba(0, 0, 0, 0.6) 33%, rgba(18, 61, 87, 1) 34%), it means rgba(18, 61, 87, 1) till 34% mark and then rgba(0, 0, 0, 0.6) from 33% mark (which won't show up because previous color is applied till 34% mark and the next color starts at 34%) and then it has rgba(18, 61, 87, 1) from 34% till the end which is the same as first color and so you will end up seeing a solid color only.
Why two colors with 50% works?:
It would work when you give 50% for both because that would produce a hard-stop gradient where the first color ends sharp at 50% and second color starts sharp from 50% to 100%. So it would look like there are two segments.
#box {
border: 1px solid #ccc;
width: 400px;
height: 400px;
background: linear-gradient(to top, rgba(18, 61, 87, 1) 50%, rgba(0, 0, 0, 0.6) 50%);
}
<div id="box">
</div>
Producing a 3 Color Gradient:
Actually if you need a 3 color gradient then the correct approach is to set the color stops at 0%, 50% and 100%. This would mean the color starts at rgba(18, 61, 87, 1), slowly changes from this color to rgba(0, 0, 0, 0.6) and complete the change at 50%, then again start to change from that color to rgba(18, 61, 87, 1) and complete that change at 100%.
#box {
border: 1px solid #ccc;
width: 400px;
height: 400px;
background: linear-gradient(to top, rgba(18, 61, 87, 1) 0%, rgba(0, 0, 0, 0.6) 50%, rgba(18, 61, 87, 1) 100%);
}
<div id="box">
</div>
Producing 3 Stripes: (I think this is what you need)
If you need three stripes and not gradients, then you need more color stops like here
#box {
border: 1px solid #ccc;
width: 400px;
height: 400px;
background: linear-gradient(to top, rgba(18, 61, 87, 1) 34%, rgba(0, 0, 0, 0.6) 34%, rgba(0, 0, 0, 0.6) 67%, rgba(18, 61, 87, 1) 67%);
}
<div id="box">
</div>
background: linear-gradient(to top, rgba(18,61,87, 1) 34%, rgba(0,0,0, 0.6) 67%, rgba(18,61,87, 1) 100%);?