본문 바로가기
HTML&CSS

연혁(History) 다이어그램 만들기

by 작업자C 2023. 9. 13.
728x90

일반적으로 회사나 박물관 등 기관 홈페이지의 연혁페이지에서 자주 볼 수 있는 항목입니다.

연혁 표 만들기(예시)

연혁 만들기

HTML

연도를 묶는 dl태그를 사용하고 dt를 연도를 지정합니다. 그리고 dd는 그 연도에 해당하는 사건을 기입합니다.
그 아래에 dl태그를 추가해나가면서 연도를 늘려나갑니다.

<div class="history">
    <dl>
        <dt>2020</dt>
        <dd>회사 창립</dd>
    </dl>
    <dl>
        <dt>2021</dt>
        <dd>서울지사 설립</dd>
    </dl>
    <dl>
        <dt>2022</dt>
        <dd>코스닥 상장</dd>
    </dl>
    <dl>
        <dt>2023</dt>
        <dd>2호점 출점</dd>
    </dl>
</div>

CSS

.history dl:before는 선을 깔아 주고, 그 위에 .history dt:before에는 원을 배치시킵니다.

.history dl{
    position: relative;
    padding: 0 0 30px 48px;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

.history dl:before{
    content: "";
    position: absolute;
    left: 8px;
    top: 0;
    width: 2px;
    height: 100%;
    background: #ddd;
}

.history dl:first-child:before{
    top: 10px;
    height: calc(100% - 10px);
}

.history dt{
    position: relative;
    font-weight: bold;
    color: #000;
    line-height: 1;
    width: 15%;
}

.history dt:before{
    content: "";
    position: absolute;
    left: -47px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    border-radius: 100%;
    background: #fff;
    border: 4px solid #ffd67a;
    box-sizing: border-box;
}

.history dd{
    width: 85%;
}

이 포스팅은 쿠팡 파트너스 활동의 일환으로 이에 따른 일정액을 수수료를 제공받고 있습니다

728x90