1
Young made this quick example only with CSS that I think will suit you!
It is responsive, always adjusted to the size of the .container
just the balls at the end of the lines you’ll have to make a @media
for them, because with measures in %
they are stretched, because the size reference is . line (which is wider than high and the ball turns ellipse)
I made a simplified version, but you can do the rest of the lines and change the transform: rotate();
as I did in the example to have as many lines as you want.
* {
box-sizing: border-box;
}
body {
margin: 0;
}
.container {
width: 300px;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.bola {
width: 25%;
height: 25%;
border-radius: 50%;
background-color: red;
border: 5px solid black;
box-shadow: 0 0 0 10px #fff;
position: absolute;
z-index: 100;
}
.linha {
width: 100%;
height: 2px;
background-color: black;
position: absolute;
}
.linha::before, .linha::after {
content: "";
width: 20px;
height: 20px;
border-radius: 50%;
background-color: red;
border: 3px solid black;
box-shadow: 0 0 0 6px #fff;
position: absolute;
z-index: 100;
top: 50%;
transform: translateY(-50%);
}
.linha::after {
right: 0;
}
.linha:nth-child(2) {
width: 60%;
height: 2px;
background-color: black;
position: absolute;
transform: rotate(90deg);
}
.linha:nth-child(3) {
width: 90%;
height: 2px;
background-color: black;
position: absolute;
transform: rotate(45deg);
}
.linha:nth-child(3)::before, .linha:nth-child(3)::after {
width: 35px;
height: 35px;
}
.linha:nth-child(4) {
width: 90%;
height: 2px;
background-color: black;
position: absolute;
transform: rotate(-45deg);
}
.linha:nth-child(4)::before, .linha:nth-child(4)::after {
width: 35px;
height: 35px;
}
<div class="container">
<div class="bola"></div>
<div class="linha"></div>
<div class="linha"></div>
<div class="linha"></div>
<div class="linha"></div>
</div>
OBS1: Adjust the size of .container
to see that it doesn’t dislodge! :)
.container {
width: 300px;
height: 300px;
}
OBS2: The lines are always proportional to the size of the .container
Okay, like I said, you just need to treat the size of the smaller balls.
You can do the same template above only with CSS, but you’ll need some experience. I suggest you take a look at this link: https://jornadadodev.com.br/cursos/curso-completo-de-css-3
– Mike Otharan
You can use the canvas. to create these lines. Just use Javascript to capture the distance between the images and apply it to the canvas.
– Valdeir Psr
Svg not made to climb well? Both up and down? Or do you need to reposition the neighboring points open in another resolution?
– Jefferson Quesado
Young the scheme of the Balls and the lines will always be the same or will they keep changing position or quantity? The example you posted has a reasonable symmetry, I believe it is possible to do only with pure CSS depending on exactly what you want that it is not very clear whether it is always the same scheme or not
– hugocsl