HTML+CSS: 자기소게 페이지 Timeline

Jinsung·2021년 9월 29일
0

article 태그

해당 문서나 페이지 또는 사이트와는 완전히 독립적으로 구성할 수 있는 요소를 정의할 때 사용

html

<section id="timeline">
                 <div class="textbox">
                <p>Timeline</p>
               </div>
                <article>
                    <div class="inner">
                        <span class="date">
                            <span class="year">2015</span>
                        </span>
                        <h2>첫 직장 생활</h2>
                        <p>군대 제대 후 쉬는것보다는 일을 해보고 싶었습니다.</p>
                    </div>
                </article>

                <article>
                    <div class="inner">
                        <span class="date">
                            <span class="year">2017</span>
                        </span>
                        <h2>대학 졸업</h2>
                        <p>직장 생활 후 졸업장은 필요해서 복학 후 졸업</p>
                    </div>
                </article>

                <article>
                    <div class="inner">
                        <span class="date">
                            <span class="year">2018</span>
                        </span>
                        <h2>네트워크 취업성공패키지</h2>
                        <p>IT쪽 전공이라 관련된 곳으로 취업 준비</p>
                    </div>
                </article>

                <article>
                    <div class="inner">
                        <span class="date">
                            <span class="year">2019</span>
                        </span>
                        <h2>CDN 회사 취업</h2>
                        <p>처음 취업당시 3교대 모니터링으로 처음 일을 시작</p>
                    </div>
                </article>

                <article>
                    <div class="inner">
                        <span class="date">
                            <span class="year">2020</span>
                        </span>
                        <h2>부서 이동</h2>
                        <p>회사에서 실력을 인정 받아 서버 하드웨어 설치 및 서버 관리 시작</p>
                    </div>
                </article>

                <article>
                    <div class="inner">
                        <span class="date">
                            <span class="year">2021</span>
                        </span>
                        <h2>퇴사 후 도전</h2>
                        <p>서버 관리 및 이슈 처리를 하다 제가 직접 만들고 관리해 보고 싶어서 퇴사</p>
                    </div>
                </article>
            </section>

CSS

section#timeline {
    width: 80%;
    margin: 20% auto;
    position: relative;
}

section#timeline::before {
    content: '';
    display: block;
    position: absolute;
    left:50%;
    top: 0;
    margin: 0 0 0 -1px;
    width: 2px;
    height: 100%;
    background: rgba(255,255,255,0,2);
}

section#timeline article {
    width: 100%;
    margin: 0 0 20px 0;
    position: relative;
}

section#timeline article:after{
    content:'';
    display: block;
    clear: both;
}

section#timeline article div.inner {
    width: 40%;
    float: left;
    margin: 5px 0 0 0;
    border-radius: 6px;
}

section#timeline article div.inner span.date{
    display: block;
    padding: 20px 5px;
    position: absolute;
    width: 60px;
    height: 60px;
    top: 0;
    left: 50%;
    margin: 0 0 0 -20px;
    border-radius: 100%;
    font-size: 12px;
    font-weight: 900;
    background: #DCDCDC;
    color: rgba(255,255,255,0,5);
    border: 2px solid rgba(255,255,255,0,2);
    box-shadow: 0 0 0 7px #DCDCDC;
}

section#timeline article div.inner span.year span {
    display: block;
    text-align: center;
}

section#timeline article div.inner span.date span.year {
    font-size: 18px;
}

section#timeline article div.inner h2 {
    padding: 15px;
    margin: 0;
    color: #fff;
    font-size: 20px;
    text-transform: uppercase;
    letter-spacing: -1px;
    border-radius: 6px 6px 0 0;
    position: relative;
}

section#timeline article div.inner h2:after {
    content: '';
    position: absolute;
    top:20px;
    right: -5px;
    width:10px;
    height: 10px;
    -webkit-transform: rotate(45deg);
}

section#timeline article div.inner p {
    padding: 15px;
    margin: 0;
    font-size: 14px;
    background: #FFF;
    color: #656565;
    border-radius: 0 0 6px 6px;
}

section#timeline article:nth-child(2n+2) div.inner {
    float: right;
  }
  section#timeline article:nth-child(2n+2) div.inner h2:after {
    left: -5px;
  }
  section#timeline article:nth-child(2) div.inner h2 {
    background: #E74C3C;
  }
  section#timeline article:nth-child(2) div.inner h2:after {
    background: #E74C3C;
  }
  section#timeline article:nth-child(3) div.inner h2 {
    background: #2ECC71;
  }
  section#timeline article:nth-child(3) div.inner h2:after {
    background: #2ECC71;
  }
  section#timeline article:nth-child(4) div.inner h2 {
    background: #E67E22;
  }
  section#timeline article:nth-child(4) div.inner h2:after {
    background: #E67E22;
  }
  section#timeline article:nth-child(5) div.inner h2 {
    background: #1ABC9C;
  }
  section#timeline article:nth-child(5) div.inner h2:after {
    background: #1ABC9C;
  }
  section#timeline article:nth-child(6) div.inner h2 {
    background: #9B59B6;
  }
  section#timeline article:nth-child(6) div.inner h2:after {
    background: #9B59B6;
  }
    section#timeline article:nth-child(7) div.inner h2 {
        background: #FFF00F;
      }
      section#timeline article:nth-child(7) div.inner h2:after {
        background: #FFF00F;

      }

0개의 댓글