2022 summer-vacation HTML&CSS seminar: week6

가오리·2022년 11월 19일
0

seminar

목록 보기
12/15
post-thumbnail

How To Make A Website Like YouTube Using HTML CSS JS | Video Sharing Website Design

Domain 연결

  • index.html
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Video Sharing Website - Easy Tutorials YouTube Channel</title>
        <link rel="stylesheet" href="./style.css" />
      </head>
      <body>
        <nav class="flex-div">
          <div class="nav-left flex-div">
            <img src="./images/menu.png" class="menu-icon" />
            <img src="./images/logo.png" class="logo" />
          </div>
          <div class="nav-middle flex-div">
            <div class="search-box flex-div">
              <input type="text" placeholder="Search" name="" id="" />
              <img src="./images/search.png" />
            </div>
            <img src="./images/voice-search.png" class="mic-icon" />
          </div>
          <div class="nav-right flex-div">
            <img src="./images/upload.png" />
            <img src="./images/more.png" />
            <img src="./images/notification.png" />
            <img src="./images/Jack.png" class="user-icon" />
          </div>
        </nav>
        <!-- flex-nav end -->
        <div class="sidebar">
          <div class="shortcut-links">
            <a href="">
              <img src="./images/home.png" />
              <p>Home</p>
            </a>
            <a href="">
              <img src="./images/explore.png" />
              <p>Explore</p>
            </a>
            <a href="">
              <img src="./images/subscriprion.png" />
              <p>Subscription</p>
            </a>
            <a href="">
              <img src="./images/library.png" />
              <p>Library</p>
            </a>
            <a href="">
              <img src="./images/history.png" />
              <p>History</p>
            </a>
            <a href="">
              <img src="./images/playlist.png" />
              <p>Playlist</p>
            </a>
            <a href="">
              <img src="./images/messages.png" />
              <p>Messages</p>
            </a>
            <a href="">
              <img src="./images/show-more.png" />
              <p>Show More</p>
            </a>
            <hr />
          </div>
          <div class="subscribed-list">
            <h3>SUBSCRIBED</h3>
            <a href="">
              <img src="./images/Jack.png" />
              <p>Jack Nicholson</p>
            </a>
            <a href="">
              <img src="./images/simon.png" />
              <p>Simon Baker</p>
            </a>
            <a href="">
              <img src="./images/tom.png" />
              <p>Tom Hardy</p>
            </a>
            <a href="">
              <img src="./images/megan.png" />
              <p>Megan Ryan</p>
            </a>
            <a href="">
              <img src="./images/cameron.png" />
              <p>cameron Diaz</p>
            </a>
          </div>
        </div>
        <!-- sidebar end -->
        <div class="container">
          <div class="banner">
            <img src="./images/banner.png" />
          </div>
          <div class="list-container">
            <!-- vid-list start -->
            <div class="vid-list">
              <a href="./play-video.html">
                <img src="./images/thumbnail1.png" class="thumbnail" />
              </a>
              <div class="flex-div">
                <img src="./images/Jack.png" />
                <div class="vid-info">
                  <a href="./play-video.html">Best channel to learn coding that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views &bull; 2days</p>
                </div>
              </div>
            </div>
            <!-- vid-list start -->
            <div class="vid-list">
              <a href="">
                <img src="./images/thumbnail2.png" class="thumbnail" />
              </a>
              <div class="flex-div">
                <img src="./images/Jack.png" />
                <div class="vid-info">
                  <a href="">Best channel to learn coding that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views &bull; 2days</p>
                </div>
              </div>
            </div>
            <!-- vid-list start -->
            <div class="vid-list">
              <a href="">
                <img src="./images/thumbnail3.png" class="thumbnail" />
              </a>
              <div class="flex-div">
                <img src="./images/Jack.png" />
                <div class="vid-info">
                  <a href="">Best channel to learn coding that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views &bull; 2days</p>
                </div>
              </div>
            </div>
            <!-- vid-list start -->
            <div class="vid-list">
              <a href="">
                <img src="./images/thumbnail4.png" class="thumbnail" />
              </a>
              <div class="flex-div">
                <img src="./images/Jack.png" />
                <div class="vid-info">
                  <a href="">Best channel to learn coding that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views &bull; 2days</p>
                </div>
              </div>
            </div>
            <!-- vid-list start -->
            <div class="vid-list">
              <a href="">
                <img src="./images/thumbnail5.png" class="thumbnail" />
              </a>
              <div class="flex-div">
                <img src="./images/Jack.png" />
                <div class="vid-info">
                  <a href="">Best channel to learn coding that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views &bull; 2days</p>
                </div>
              </div>
            </div>
            <!-- vid-list start -->
            <div class="vid-list">
              <a href="">
                <img src="./images/thumbnail6.png" class="thumbnail" />
              </a>
              <div class="flex-div">
                <img src="./images/Jack.png" />
                <div class="vid-info">
                  <a href="">Best channel to learn coding that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views &bull; 2days</p>
                </div>
              </div>
            </div>
            <!-- vid-list start -->
            <div class="vid-list">
              <a href="">
                <img src="./images/thumbnail7.png" class="thumbnail" />
              </a>
              <div class="flex-div">
                <img src="./images/Jack.png" />
                <div class="vid-info">
                  <a href="">Best channel to learn coding that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views &bull; 2days</p>
                </div>
              </div>
            </div>
            <!-- vid-list start -->
            <div class="vid-list">
              <a href="">
                <img src="./images/thumbnail8.png" class="thumbnail" />
              </a>
              <div class="flex-div">
                <img src="./images/Jack.png" />
                <div class="vid-info">
                  <a href="">Best channel to learn coding that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views &bull; 2days</p>
                </div>
              </div>
            </div>
            <!-- vid-list[8] end -->
          </div>
        </div>
        <!-- main end -->
        <script src="./script.js"></script>
      </body>
    </html>
  • play-video.html
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Play Video - Easy Tutorials YouTube Channel</title>
        <link rel="stylesheet" href="./style.css" />
      </head>
      <body>
        <nav class="flex-div">
          <div class="nav-left flex-div">
            <img src="./images/menu.png" class="menu-icon" />
            <img src="./images/logo.png" class="logo" />
          </div>
          <div class="nav-middle flex-div">
            <div class="search-box flex-div">
              <input type="text" placeholder="Search" name="" id="" />
              <img src="./images/search.png" />
            </div>
            <img src="./images/voice-search.png" class="mic-icon" />
          </div>
          <div class="nav-right flex-div">
            <img src="./images/upload.png" />
            <img src="./images/more.png" />
            <img src="./images/notification.png" />
            <img src="./images/Jack.png" class="user-icon" />
          </div>
        </nav>
        <!-- flex-nav end -->
        <div class="container play-container">
          <div class="row">
            <div class="play-video">
              <video controls autoplay>
                <source src="./images/video.mp4" type="video/mp4" />
              </video>
              <div class="tags">
                <a href="">#Coding</a>
                <a href="">#HTML</a>
                <a href="">#CSS</a>
                <a href="">#JavaScript</a>
              </div>
              <h3>Best YouTube Channel To Learn Web Development</h3>
              <div class="play-video-info">
                <p>1225 Views &bull; 2 days ago</p>
                <div>
                  <a href=""><img src="./images/like.png" />125</a>
                  <a href=""><img src="./images/dislike.png" />2</a>
                  <a href=""><img src="./images/share.png" />Share</a>
                  <a href=""><img src="./images/save.png" />Save</a>
                </div>
              </div>
              <hr />
              <div class="publisher">
                <img src="./images/Jack.png" />
                <div>
                  <p>Easy Tutorials</p>
                  <span>500k Subscribers</span>
                </div>
                <button type="button">Subscribe</button>
              </div>
              <div class="vid-description">
                <p>Channel that makes learning easy</p>
                <p>Subscribe Easy Tutorials to watch more tutorials on web development</p>
                <hr />
                <h4>134 Comments</h4>
                <div class="add-comment">
                  <img src="./images/Jack.png" />
                  <input type="text" placeholder="Write comments..." />
                </div>
                <!-- old-comment start  -->
                <div class="old-comment">
                  <img src="./images/Jack.png" />
                  <div>
                    <h3>Jack Nicholson <span>2 days ago</span></h3>
                    <p>
                      A global computer network providing a variety of information and communication facilities, consisting of interconnected networks using
                      standardized communication protocols.
                    </p>
                    <div class="acomment-action">
                      <img src="./images/like.png" />
                      <span>244</span>
                      <img src="./images/dislike.png" />
                      <span>2</span>
                      <span>REPLY</span>
                      <a href="">All Replies</a>
                    </div>
                  </div>
                </div>
                <!-- old-comment start  -->
                <div class="old-comment">
                  <img src="./images/Jack.png" />
                  <div>
                    <h3>Jack Nicholson <span>2 days ago</span></h3>
                    <p>
                      A global computer network providing a variety of information and communication facilities, consisting of interconnected networks using
                      standardized communication protocols.
                    </p>
                    <div class="acomment-action">
                      <img src="./images/like.png" />
                      <span>244</span>
                      <img src="./images/dislike.png" />
                      <span>2</span>
                      <span>REPLY</span>
                      <a href="">All Replies</a>
                    </div>
                  </div>
                </div>
                <!-- f -->
              </div>
            </div>
            <div class="right-sidebar">
              <!-- side-video-list start -->
              <div class="side-video-list">
                <a href="" class="small-thumbnail">
                  <img src="./images/thumbnail1.png" />
                </a>
                <div class="vid-info">
                  <a href="">Best channel that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views</p>
                </div>
              </div>
              <!-- side-video-list start -->
              <div class="side-video-list">
                <a href="" class="small-thumbnail">
                  <img src="./images/thumbnail2.png" />
                </a>
                <div class="vid-info">
                  <a href="">Best channel that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views</p>
                </div>
              </div>
              <!-- side-video-list start -->
              <div class="side-video-list">
                <a href="" class="small-thumbnail">
                  <img src="./images/thumbnail3.png" />
                </a>
                <div class="vid-info">
                  <a href="">Best channel that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views</p>
                </div>
              </div>
              <!-- side-video-list start -->
              <div class="side-video-list">
                <a href="" class="small-thumbnail">
                  <img src="./images/thumbnail4.png" />
                </a>
                <div class="vid-info">
                  <a href="">Best channel that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views</p>
                </div>
              </div>
              <!-- side-video-list start -->
              <div class="side-video-list">
                <a href="" class="small-thumbnail">
                  <img src="./images/thumbnail5.png" />
                </a>
                <div class="vid-info">
                  <a href="">Best channel that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views</p>
                </div>
              </div>
              <!-- side-video-list start -->
              <div class="side-video-list">
                <a href="" class="small-thumbnail">
                  <img src="./images/thumbnail6.png" />
                </a>
                <div class="vid-info">
                  <a href="">Best channel that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views</p>
                </div>
              </div>
              <!-- side-video-list start -->
              <div class="side-video-list">
                <a href="" class="small-thumbnail">
                  <img src="./images/thumbnail7.png" />
                </a>
                <div class="vid-info">
                  <a href="">Best channel that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views</p>
                </div>
              </div>
              <!-- side-video-list start -->
              <div class="side-video-list">
                <a href="" class="small-thumbnail">
                  <img src="./images/thumbnail8.png" />
                </a>
                <div class="vid-info">
                  <a href="">Best channel that help you to be a web developer</a>
                  <p>Easy Tutorials</p>
                  <p>15k views</p>
                </div>
              </div>
              <!-- side-video-list end -->
            </div>
          </div>
        </div>
      </body>
    </html>
  • style.css
    * {
      margin: 0;
      padding: 0;
      font-family: "poppins", sans-serif;
      box-sizing: border-box;
    }
    a {
      text-decoration: none;
      color: #5a5a5a;
    }
    img {
      cursor: pointer;
    }
    .flex-div {
      display: flex;
      align-items: center;
    }
    nav {
      padding: 10px 2%;
      justify-content: space-between;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
      background: #fff;
      position: sticky;
      top: 0;
      z-index: 10; /* 쌓임 맥락 */
    }
    .nav-right img {
      width: 25px;
      margin-right: 25px;
    }
    .nav-right .user-icon {
      width: 35px;
      border-radius: 50%;
      margin-right: 0;
    }
    .nav-left .menu-icon {
      width: 22px;
      margin-right: 25px;
    }
    .nav-left .logo {
      width: 130px;
    }
    .nav-middle .mic-icon {
      width: 16px;
    }
    .nav-middle .search-box {
      border: 1px solid #ccc;
      margin-right: 15px;
      padding: 8px 12px;
      border-radius: 25px;
    }
    .nav-middle .search-box input {
      width: 400px;
      border: 0;
      outline: 0;
      background: transparent;
    }
    .nav-middle .search-box img {
      width: 15px;
    }
    /* flex-div end */
    .sidebar {
      background: #fff;
      width: 15%;
      height: 100vh;
      position: fixed;
      top: 0;
      padding-left: 2%;
      padding-top: 80px;
    }
    .shortcut-links a img {
      width: 20px;
      margin-right: 20px;
    }
    .shortcut-links a {
      display: flex;
      align-items: center;
      margin-bottom: 20px;
      width: fit-content; /* fit-content */
      flex-wrap: wrap;
    }
    .shortcut-links a:first-child {
      color: #ed3833;
    }
    .sidebar hr {
      border: 0;
      height: 1px;
      background-color: #ccc;
      width: 85%;
    }
    .subscribed-list h3 {
      font-size: 13px;
      margin: 20px 0;
      color: #5a5a5a;
    }
    .subscribed-list a {
      display: flex;
      align-items: center;
      margin-bottom: 20px;
      width: fit-content;
      flex-wrap: wrap;
    }
    .subscribed-list a img {
      width: 25px;
      border-radius: 50%;
      margin-right: 20px;
    }
    .small-sidebar {
      width: 5%;
    }
    .small-sidebar a p {
      display: none;
    }
    .small-sidebar h3 {
      display: none;
    }
    .small-sidebar hr {
      width: 50%;
      margin-bottom: 25px;
    }
    /* sidebar end */
    .container {
      background: #f9f9f9;
      /* padding-left: 17%;
      padding-right: 2%;
      padding-top: 20px;
      padding-bottom: 20px; */
      padding: 20px 2% 20px 17%;
    }
    .large-container {
      padding-left: 7%;
    }
    .banner {
      width: 100%;
    }
    .banner img {
      width: 100%;
      border-radius: 8px;
    }
    .list-container {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
      grid-column-gap: 16px;
      grid-row-gap: 30px;
      margin-top: 15px;
    }
    .vid-list .thumbnail {
      width: 100%;
      border-radius: 5px;
    }
    .vid-list .flex-div {
      align-items: flex-start;
      margin-top: 7px;
    }
    .vid-list .flex-div img {
      width: 35px;
      margin-right: 10px;
      border-radius: 50%;
    }
    .vid-info {
      color: #5a5a5a;
      font-size: 13px;
    }
    .vid-info a {
      color: #000;
      font-weight: 600;
      display: block;
      margin-bottom: 5px;
    }
    /* media */
    ¡¡{
      .menu-icon {
        display: none;
      }
      .sidebar {
        display: none;
      }
      .container,
      .large-container {
        padding-left: 5%;
        padding-right: 5%;
      }
      .nav-right img {
        display: none;
      }
      .nav-right .user-icon {
        display: block;
        width: 30px;
      }
      .nav-middle .search-box input {
        width: 100px;
      }
      .nav-middle .mic-icon {
        display: none;
      }
      .logo {
        width: 90px;
      }
    }
    /* play video page */
    .play-container {
      padding-left: 2%;
    }
    .row {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
    }
    .play-video {
      flex-basis: 69%;
    }
    .right-sidebar {
      flex-basis: 30%;
    }
    .play-video video {
      width: 100%;
    }
    .side-video-list {
      display: flex;
      justify-content: space-between;
      margin-bottom: 8px;
    }
    .side-video-list img {
      width: 100%;
    }
    .side-video-list .small-thumbnail {
      flex-basis: 49%;
    }
    .side-video-list .vid-info {
      flex-basis: 49%;
    }
    .play-video .tags a {
      color: #0000ff;
      font-size: 13px;
    }
    .play-video h3 {
      font-weight: 600;
      font-size: 22px;
    }
    .play-video .play-video-info {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      margin-top: 10px;
      font-size: 14px;
      color: #5a5a5a;
    }
    .play-video .play-video-info a img {
      width: 20px;
      margin-right: 8px;
    }
    .play-video .play-video-info a {
      display: inline-flex;
      align-items: center;
      margin-left: 15px;
    }
    .play-video hr {
      border: 0;
      height: 1px;
      background: #ccc;
      margin: 10px 0;
    }
    .publisher {
      display: flex;
      align-items: center;
      margin-top: 20px;
    }
    .publisher div {
      flex: 1;
      line-height: 18px;
    }
    .publisher img {
      width: 40px;
      border-radius: 50%;
      margin-right: 15px;
    }
    .publisher div p {
      color: black;
      font-weight: 600;
      font-size: 18px;
    }
    .publisher div span {
      font-size: 13px;
      color: #5a5a5a;
    }
    .publisher button {
      background-color: red;
      color: #fff;
      padding: 8px 30px;
      border: 0;
      outline: 0;
      border-radius: 4px;
      cursor: pointer;
    }
    .vid-description {
      padding-left: 55px;
      margin: 15px 0;
    }
    .vid-description p {
      font-size: 14px;
      margin-bottom: 5px;
      color: #5a5a5a;
    }
    .vid-description h4 {
      font-size: 14px;
      color: #5a5a5a;
      margin-top: 15px;
    }
    .add-comment {
      display: flex;
      align-items: center;
      margin: 30px 0;
    }
    .add-comment img {
      width: 30px;
      border-radius: 50%;
      margin-right: 15px;
    }
    .add-comment input {
      border: 0;
      outline: 0;
      border-bottom: 1px solid #ccc;
      width: 100%;
      padding-top: 10px;
      background: transparent;
    }
    .old-comment {
      display: flex;
      align-items: center;
      margin: 20px 0;
    }
    .old-comment img {
      width: 35px;
      border-radius: 50%;
      margin-right: 15px;
    }
    .old-comment h3 {
      font-size: 14px;
      margin-bottom: 2px;
    }
    .old-comment h3 span {
      font-size: 12px;
      color: #5a5a5a;
      font-weight: 500;
      margin-left: 8px;
    }
    .old-comment .acomment-action {
      display: flex;
      align-items: center;
      margin: 8px 0;
      font-size: 14px;
    }
    .old-comment .acomment-action img {
      border-radius: 0;
      width: 20px;
      margin-right: 5px;
    }
    .old-comment .acomment-action span {
      margin-right: 20px;
      color: #5a5a5a;
    }
    .old-comment .acomment-action a {
      color: #0000ff;
    }
    /* media */
    @media (max-width: 900px) {
      .play-video {
        flex-basis: 100%;
      }
      .right-sidebar {
        flex-basis: 100%;
      }
      .play-container {
        padding-left: 5%;
      }
      .vid-description {
        padding-left: 0;
      }
      .play-video .play-video-info a {
        margin-left: 0;
        margin-right: 15px;
        margin-top: 15px;
      }
    }
  • script.js
    const menuIcon = document.querySelector(".menu-icon");
    const sidebar = document.querySelector(".sidebar");
    const container = document.querySelector(".container");
    
    menuIcon.onclick = function () {
      sidebar.classList.toggle("small-sidebar");
      container.classList.toggle("large-container");
    };
profile
가오리의 코딩일기

0개의 댓글