iT邦幫忙

2023 iThome 鐵人賽

DAY 30
0
影片教學

一起來實作響應式網頁設計系列 第 30

一起來實作響應式網頁設計:用bootstrap的元件打造景點介紹網站 Day30

  • 分享至 

  • xImage
  •  

影片教學

Yes

程式碼回顧

<!DOCTYPE html>
<html lang="en">
<head>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>台灣城市景點</title>
</head>
<body style="padding-top: 70px;">
    <!--導覽列-->
    <nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
        <div class="container-fluid">
            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-geo-alt-fill" viewBox="0 0 16 16">
                <path d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10zm0-7a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"/>
              </svg>
            <a class="navbar-brand" href="">台灣城市景點</a>

            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                    <li class="nav-item">
                        <a class="nav-link active" aria-current="page" href="#">全部</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#">北部</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#">中部</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#">南部</a>
                    </li>
                    
                </ul>
          </div>
        </div>
      </nav>

    <!--輪播處-->
    <div id="carouselExampleCaptions" class="carousel slide" data-bs-ride="carousel">
        <div class="carousel-indicators">
          <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
          <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="1" aria-label="Slide 2"></button>
          <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="2" aria-label="Slide 3"></button>
        </div>
        <div class="carousel-inner">
          <div class="carousel-item active">
            <img src="img/ch.jpg" class="d-block w-100" alt="...">
            <div class="carousel-caption d-none d-md-block">
              <p>Photo by <a href="https://unsplash.com/@geo810371?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Yao-ting Tsai</a> on <a href="https://unsplash.com/photos/31UvcGZKgS8?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Unsplash</a>
              </p>
            </div>
          </div>
          <div class="carousel-item">
            <img src="img/pei.jpg" class="d-block w-100" alt="...">
            <div class="carousel-caption d-none d-md-block">
              <p>Photo by <a href="https://unsplash.com/@magict1911?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Timo Volz</a> on <a href="https://unsplash.com/photos/phjpsNFw6pM?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Unsplash</a>
              </p>
            </div>
          </div>
          <div class="carousel-item">
            <img src="img/kao.jpg" class="d-block w-100" alt="...">
            <div class="carousel-caption d-none d-md-block">
              <p>Photo by <a href="https://unsplash.com/@ccs935151?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Johnson Hung</a> on <a href="https://unsplash.com/photos/nOMuGT_hcY0?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Unsplash</a>
              </p>
            </div>
          </div>
        </div>
        <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="prev">
          <span class="carousel-control-prev-icon" aria-hidden="true"></span>
          <span class="visually-hidden">Previous</span>
        </button>
        <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="next">
          <span class="carousel-control-next-icon" aria-hidden="true"></span>
          <span class="visually-hidden">Next</span>
        </button>
      </div>

      <!--卡片區-->
      <div class="container-fluid">
      <div class="row">
        <div class="col ">
            <div class="card " style="width: 18rem;">
                <img src="img/pei.jpg" class="card-img-top" alt="...">
                <div class="card-body">
                  <h5 class="card-title">台北101</h5>
                  <p class="card-text">很高很高很高!</p>
                  <a href="#" class="btn btn-primary">更多資訊</a>
                </div>
            </div>
        </div>

        <div class="col ">
            <div class="card" style="width: 18rem;">
                <img src="img/ch.jpg" class="card-img-top" alt="...">
                <div class="card-body">
                  <h5 class="card-title">台中歌劇院</h5>
                  <p class="card-text">台中歌劇院很讚!</p>
                  <a href="#" class="btn btn-primary">更多煙火</a>
                </div>
              </div>
        </div>

        <div class="col ">
            <div class="card" style="width: 18rem;">
                <img src="img/kao.jpg" class="card-img-top" alt="...">
                <div class="card-body">
                  <h5 class="card-title">高雄85大樓</h5>
                  <p class="card-text">我...才不是蚊子館勒</p>
                  <a href="#" class="btn btn-primary">更多資訊</a>
                </div>
              </div>
        </div>
      </div>
    </div>
      
      <footer class="container-fluid">
        <hr>
        <!-- Copyright -->
        <div class="float-right">
          <p>© 2023 Copyright:coding19</p>
        </div>
        <!-- Copyright -->
      </footer>
    <script src="index.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>

</body>
</html>

參考資料&使用資源

以上就是今天的影片教學,感謝大家這30天的觀看,我們下次見!


上一篇
一起來實作響應式網頁設計:探究Bootstrap Day29
系列文
一起來實作響應式網頁設計30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言