Maybe from the title above some of you will become confused, But it exactly as the title said, I want to make this pipeline design using CSS, I think I can achieve it using border
but how can I add the round bullet like in the image below?
to make it easier, my layout will look like this:
First row : Image 1 & text
second row : Text & Image 2
Third row : Image 3 & text
fourth row : Image 4
so this is some question I want to ask:
Can I make this kind of line using the border?
How can I make the line stop in the middle like before the Image 4?
How can I make the bullet in the middle of the line that will match the line even when we check it in some device (exclude the mobile view around 576px)?
Can someone help me with this problem? for the first question, I think we can use
1. First Row :
border-right: solid 1px blue;
border-bottom : solid 1px blue;
border-bottom-right-radius : 10px;
2. second Row :
border-left: solid 1px blue;
border-bottom : solid 1px blue;
border-bottom-left-radius : 10px;
3. Third Row :
border-right: solid 1px blue;
border-bottom : solid 1px blue;
border-bottom-right-radius : 10px;
4. Fourth Row :
border-left: solid 1px blue;
border-bottom : solid 1px blue;
border-bottom-left-radius : 10px;
width: 50% (?)
Edit 1 for question one currently I make this CSS code like this:
#first-row-left{
border-left: solid 3px blue;
border-bottom: solid 3px blue;
border-bottom-left-radius: 20px
}
#first-row-right{
border-bottom: solid 3px blue;
}
#second-row-left{
border-bottom: solid 3px blue;
}
#second-row-right{
border-right: solid 3px blue;
border-bottom: solid 3px blue;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px
}
#third-row-left{
border-left: solid 3px blue;
border-bottom: solid 3px blue;
border-bottom-left-radius: 20px;
border-top-left-radius: 20px
}
and it looks like this
As you can see there is slight miss in before the pipeline change the row like from first to second row
Edit 2 I already make a fiddle for this, you can try it in here:
Click here to see the fiddle
Edit 3 Based on @Alexwc_ , I tried to change his code into CSS intead of SCSS, but it seems I miss something in here
SCSS from @Alexwc_ after I convert it to CSS:
this is the fiddle I made : Check in here
It can be done by using the properties border-bottom-color, border-top-color, border-right-color, and border-left-color. The border-color property cannot be used alone. It must be used with other border properties like "border-style" property to set the border; otherwise, it will not work.
Here's one method. Perhaps not the cleanest, and it hasn't been adapted for mobile.
Here is a pen of the work using SCSS.
Here is a pen of the work using CSS. (Please note that I converted SCSS to CSS using this tool)
CAVEATS:
CSS:
:root {
--width: 5px;
--border-radius: calc(var(--width) * 2);
--button-width: 30px;
--button-left-pos: -12.5px;
}
.row {
margin: 0 20px;
}
img {
border-radius: 10px;
}
.one, .two, .three, .four {
position: relative;
}
.one::before, .one::after, .two::before, .two::after, .three::before, .three::after, .four::before, .four::after {
position: absolute;
top: var(--button-width);
left: var(--button-left-pos);
content: "";
height: 30px;
width: 30px;
background: black;
border-radius: 100px;
}
.one::after, .two::after, .three::after, .four::after {
width: calc( var(--button-width) / 2 );
height: calc( var(--button-width) / 2 );
background: red;
top: calc(var(--button-width) + var(--button-width) / 4 );
left: -5px;
}
.two::before, .two::after {
right: var(--button-left-pos);
left: initial;
}
.two::after {
right: -5px;
}
.one::after {
width: calc( var(--button-width) / 2 );
height: calc( var(--button-width) / 2 );
background: red;
top: calc(var(--button-width) + var(--button-width) / 4 );
}
.row {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr;
grid-template-areas: "left right";
position: relative;
}
.row:last-child {
grid-template-areas: "border ..." "full full";
}
.row .left, .row .right {
padding: var(--button-width);
}
.one .left {
padding-top: 0;
border-left: var(--width) solid;
border-bottom: var(--width) solid;
border-bottom-left-radius: var(--width);
}
.two {
top: calc(var(--width) * -1);
}
.two .right {
border-right: var(--width) solid;
border-top: var(--width) solid;
border-top-right-radius: var(--width);
border-bottom-right-radius: var(--width);
border-bottom: var(--width) solid;
}
.three {
top: calc(var(--width) * -2);
}
.three .left {
border-left: var(--width) solid;
border-top: var(--width) solid;
border-top-left-radius: var(--width);
border-bottom-left-radius: var(--width);
}
.four {
top: calc(var(--width) * -3);
}
.four::before, .four::after {
top: 85px;
}
.four::before {
left: calc(50% - 17.5px);
}
.four::after {
top: 92.5px;
left: calc(50% - 10.5px);
}
.four .border {
height: 200px;
display: block;
border-right: var(--width) solid;
border-top-right-radius: var(--width);
position: relative;
}
.four .border::before {
content: "";
position: absolute;
height: var(--width);
background: black;
top: 0;
width: calc(100% + var(--width));
transform: rotate(180deg);
border-bottom-left-radius: var(--width);
border-top-right-radius: var(--width);
}
.border {
grid-area: border;
}
.full-width {
grid-area: full;
justify-self: center;
}
.left {
grid-area: left;
}
.right {
grid-area: right;
}
HTML:
<div class="row one">
<div class="left">
<img src="https://via.placeholder.com/450x250" alt="">
</div>
<div class="right">
<h1>Heading</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
<!-- one -->
<div class="row two">
<div class="left">
<h1>Heading</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="right">
<img src="https://via.placeholder.com/450x250" alt="">
</div>
</div>
<!-- two -->
<div class="row three">
<div class="left">
<img src="https://via.placeholder.com/450x250" alt="">
</div>
<div class="right">
<h1>Heading</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
<!-- three -->
<div class="row four">
<div class="border border-top"></div>
<div class="full-width">
<img src="https://via.placeholder.com/900x500" alt=""></div>
</div>
<!-- four -->
You may consider using SVG. Following code is a sample code to draw path and circle.
<!DOCTYPE html>
<html>
<body>
<svg height="400" width="450">
<path id="lineAB" d="M 100 350 l 150 -300" stroke="red" stroke-width="3" fill="none" />
<path id="lineBC" d="M 250 50 l 150 300" stroke="red" stroke-width="3" fill="none" />
<path d="M 100 350 q 150 -300 300 0" stroke="blue" stroke-width="5" fill="none" />
<g stroke="black" stroke-width="3" fill="black">
<circle id="pointA" cx="100" cy="350" r="3" />
<circle id="pointB" cx="250" cy="50" r="3" />
<circle id="pointC" cx="400" cy="350" r="3" />
</g>
<g font-size="30" font-family="sans-serif" fill="black" stroke="none" text-anchor="middle">
<text x="100" y="350" dx="-30">A</text>
<text x="250" y="50" dy="-10">B</text>
<text x="400" y="350" dx="30">C</text>
</g>
Sorry, your browser does not support inline SVG.
</svg>
</body>
</html>
`#first-row-left:before
{
content: '';
display: inline-block;
position: absolute;
border-radius: 50%;
left: 0;
width: 10px;
height: 10px;
z-index: 3;
top: 25px;
}`
try something like this...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With