Как сверстать блоки с фото в html?
Ответы (1 шт):
Автор решения: soledar10
→ Ссылка
Пример
* {
box-sizing: border-box;
}
.timeline {
display: flex;
justify-content: center;
font-size: 1rem;
padding: 2rem;
font-family: sans-serif;
gap: 4rem 2rem;
text-align: center;
}
.timeline__item {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
}
.timeline__circle {
width: 5rem;
height: 5rem;
border: 10px solid #BD4A4E;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 2rem;
position: relative;
}
.timeline__circle::before {
content: '';
position: absolute;
top: -1rem;
left: -1rem;
bottom: -1rem;
right: -1rem;
border: 1px dotted #BD4A4E;
border-radius: 50%;
box-sizing: border-box;
}
.timeline__line {
display: block;
width: 1px;
height: 40px;
border-left: 1px dotted #BD4A4E;
position: relative;
margin-bottom: 1rem;
margin-top: .5rem;
}
.timeline__line::after {
content: '';
position: absolute;
bottom: -.25rem;
left: 50%;
width: .5rem;
height: .5rem;
background-color: #BD4A4E;
transform: translate(-50%, -50%);
border-radius: 50%;
box-sizing: border-box;
}
.timeline__arrow {
position: absolute;
top: 50%;
left: 85%;
width: 70%;
height: 1px;
border-top: 1px dotted #BD4A4E;
transform: rotate(45deg);
}
.timeline__item:nth-of-type(even) {
flex-direction: column-reverse;
}
.timeline__item:nth-of-type(even) .timeline__line {
margin-bottom: .5rem;
margin-top: 1rem;
}
.timeline__item:nth-of-type(even) .timeline__line::after {
bottom: auto;
top: -.25rem;
}
.timeline__item:nth-of-type(even) .timeline__arrow {
transform: rotate(-45deg);
}
<div class="timeline">
<div class="timeline__item">
<div class="timeline__circle">1</div>
<div class="timeline__line"></div>
<div class="timeline__text">Text<br> text</div>
<div class="timeline__arrow"></div>
</div>
<div class="timeline__item">
<div class="timeline__circle">2</div>
<div class="timeline__line"></div>
<div class="timeline__text">Text<br> text</div>
<div class="timeline__arrow"></div>
</div>
<div class="timeline__item">
<div class="timeline__circle">3</div>
<div class="timeline__line"></div>
<div class="timeline__text">Text<br> text</div>
<div class="timeline__arrow"></div>
</div>
<div class="timeline__item">
<div class="timeline__circle">4</div>
<div class="timeline__line"></div>
<div class="timeline__text">Text<br> text</div>
<div class="timeline__arrow"></div>
</div>
<div class="timeline__item">
<div class="timeline__circle">5</div>
<div class="timeline__line"></div>
<div class="timeline__text">Text<br> text</div>
</div>
</div>
