21.08.05

Today I Learned

game.index

<body id="game-body">
        <!-- GAME Header -->
        <header id="game-header">
            <div class="game-container">
                <!-- GAME NAV -->
                <nav class="game-flex-between">
                    <!-- GAME Header NAV Left -->
                    <div class="left game-flex-start">
                        <h1><a href="#">GAME</a></h1>
                        <ul class="game-flex-start">
                            <li><a href="#">e스포츠</a></li>
                            <li><a href="#">PC게임</a></li>
                        </ul>
                    </div>

                    <!-- GAME Header NAV Right -->
                    <div class="right game-flex-end">
                        <div class="search-wrap game-flex-start">
                            <input type="text" placeholder="라운지, 게시물 검색" />
                            <button class="btn-search"></button>
                        </div>
                        <div class="ticket-wrap">
                            <a href="#" class="btn-ticket"></a>
                            <p class="bubble-msg">응모티켓받고 꿀템 도전!</p>
                        </div>
                        <a href="#" class="btn-login">로그인</a>
                    </div>
                </nav>
                <!-- GAME Events Wrap -->
                <div class="game-events-wrap game-flex-between">
                    <div class="event-wrap one">
                        <div class="event-title-wrap">
                            <span>HOT</span>
                            <h2>디아블로 이모탈<br />알파 테스트 참가 이벤트</h2>
                        </div>
                    </div>
                    <div class="event-wrap two">
                        <div class="event-title-wrap">
                            <span>HOT</span>
                            <h2>디아블로 이모탈<br />알파 테스트 참가 이벤트</h2>
                        </div>
                    </div>
                    <div class="event-wrap three">
                        <div class="event-title-wrap">
                            <span>HOT</span>
                            <h2>디아블로 이모탈<br />알파 테스트 참가 이벤트</h2>
                        </div>
                    </div>
                </div>
            </div>
        </header>

        <!-- GAME Main -->
        <main role="main" id="game-main">
            <div class="game-container game-flex-between">
                <!-- GAME Main Left -->
                <div class="left"></div>

                <div class="right"></div>
            </div>
        </main>
    </body>

style.css

/* NAVER GAME */
#game-body {
    background-color: #f8f9fd;
}

.game-container {
    width: 1280px;
    margin: 0 auto;
}

.game-flex-between {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.game-flex-start {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.game-flex-end {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

.game-flex-center {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.game-shadow {
    box-shadow: 0 2px 30px 0 rgb(0 0 0 / 6%);
}

/* 공통적인 요소들은 클래스화해라 */
.game-p-30 {
    padding: 30px;
}

.font-17 {
    font-size: 17px;
}

.font-19 {
    font-size: 19px;
}

.font-400 {
    font-weight: 400px;
}

/* GAME Header */
#game-header {
    width: 100%;
    background-color: #4e41db;
}

#game-header nav {
    height: 60px;
}

/* GAME Header NAV Left */
#game-header nav .left {
}

#game-header nav .left h1 {
    font-size: 20px;
}

#game-header nav .left h1 a {
    color: #fff;
}

#game-header nav .left ul {
}

#game-header nav .left ul li {
}

#game-header nav .left ul li a {
    color: #9daeb6;
    font-size: 18px;
}

#game-header nav .left ul li a::before {
    content: "";
    display: inline-block;
    width: 1px;
    height: 11px;
    border-radius: 0.5px;
    background-color: #9daeb6;

    margin: 0 12px;
}

/* GAME Header NAV Right */
#game-header nav .right {
}

#game-header nav .right .search-wrap {
    /* border-radius 속성을 적용하려면 overflow 속성값으로 hidden을 적용해야 함 */
    overflow: hidden;
    width: 300px;
    border-radius: 20px;
    background-color: rgba(0, 0, 0, 0.28);
}

#game-header nav .right .search-wrap input {
    width: calc(100% - 38px);
    height: 38px;
    background-color: transparent;
    padding: 10px 12px 9px 14px;
    border: none;

    color: #fff;
    font-size: 15px;
}

#game-header nav .right .search-wrap input:focus {
    outline: none;
}

#game-header nav .right .search-wrap button {
    width: 38px;
    height: 38px;
    background-color: transparent;
    border: none;
}

#game-header nav .right .ticket-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    margin-left: 10px;
}

#game-header nav .right .ticket-wrap .btn-ticket {
    display: block;
    width: 40px;
    height: 40px;
    border: solid 1px #fff;
}

#game-header nav .right .ticket-wrap .bubble-msg {
    /* 
    position이 absolute일 경우 margin: 0 auto;를 적용해 x축 중앙정렬을 하지 못함
    */
    position: absolute;
    width: 165px;
    background-color: #697183;
    border-radius: 8px;

    padding: 10px 12px;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);

    font-size: 14px;
    color: #fff;
    font-weight: 600;

    z-index: 100;
}

#game-header nav .right .btn-login {
    width: 50px;
    border: solid 1px hsla(0, 0%, 80%, 0.3);
    border-radius: 8px;

    padding: 7px 0 6px;
    margin-left: 10px;

    font-size: 12px;
    color: #fff;
    text-align: center;
}

/* GAME Events Wrap */
#game-header .game-events-wrap {
    padding: 80px 0;
}

#game-header .game-events-wrap .event-wrap {
    position: relative; /* 일종의 안전 장치 */
    width: 407px;
    height: 264px;
    border-radius: 40px;

    top: 0;
    transition: top linear 0.45s;
}

#game-header .game-events-wrap .event-wrap:hover {
    top: -20px;
}

#game-header .game-events-wrap .event-wrap.one {
    background-color: rgb(112, 104, 236);
}

#game-header .game-events-wrap .event-wrap.two {
    background-color: rgb(69, 39, 39);
}

#game-header .game-events-wrap .event-wrap.three {
    background-color: rgb(112, 177, 181);
}

#game-header .game-events-wrap .event-wrap .event-title-wrap {
    position: absolute;

    left: 30px;
    bottom: 30px;

    color: #fff;
}

#game-header .game-events-wrap .event-wrap .event-title-wrap span {
    display: inline-block;
    border: solid 2px #fff;
    border-radius: 10px;

    padding: 4px 8px 2px;

    font-size: 12px;
    font-weight: 600;

    text-align: center;

    margin-bottom: 15px;
}

#game-header .game-events-wrap .event-wrap .event-title-wrap h2 {
    font-size: 20px;
}

/* GAME Main */
/* GAME Main Left */
#game-main .game-container {
    align-items: stretch;
}

#game-main .left {
    width: 900px;
    height: 2000px;
    background-color: yellow;
}

#game-main .right {
    width: 358px;
    height: 2000px;
    background-color: gray;
}

Review

네이버 게임 페이지 상단 영역을 카피캣 작업을 했다. 다른 페이지와 달리 게임 페이지는 최신 기술로 코드를 작성해서 그런지 조금 더 세련되고 깔끔한 느낌이 들었다. 요즘은 자바스크립트를 이용해 구현을 많이 하는구나... 자바스크립트를 얼른 마스터해야겠다!

좋은 웹페이지 즐겨찾기