Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>hamburgar menu pracice</title>
    <link rel="stylesheet" href="css/all.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css">
</head>

<body>

</body>
<div class="header">
    <div class="container">
        <h1 class="logo">
            <a href="#">LOGO</a>
        </h1>

        <ul class="menu">
            <li><a href="#">選項</a></li>
            <li><a href="#">選項</a></li>
            <li><a href="#">選項</a></li>
            <li><a href="#">選項</a></li>
        </ul>
       
        <a href="#" class="burgar_btn">
            <i class="fas fa-bars"></i>
        </a>
    </div>
</div>

<div class="content">
    <div class="container">
        <h2>領先傳說簡直一定觀。</h2>
        <p>轉帖高興人生毫不節目民間財務允許關閉指導理由聲音,後面滑鼠衛生發達檢測啟動信譽篇文章電源天氣,大型死了形象你的並沒有路線傢伙興趣先生遇到總體不對帶來樓上,對不起超市超過全體,小組我的心試驗下去曝光功能地球幾年,遊戲根據中文突破該公司專用警察創建什麼事模組。
        </p>

        <h2>領先傳說簡直一定觀。</h2>
        <p>轉帖高興人生毫不節目民間財務允許關閉指導理由聲音,後面滑鼠衛生發達檢測啟動信譽篇文章電源天氣,大型死了形象你的並沒有路線傢伙興趣先生遇到總體不對帶來樓上,對不起超市超過全體,小組我的心試驗下去曝光功能地球幾年,遊戲根據中文突破該公司專用警察創建什麼事模組。
        </p>

        <h2>領先傳說簡直一定觀。</h2>
        <p>轉帖高興人生毫不節目民間財務允許關閉指導理由聲音,後面滑鼠衛生發達檢測啟動信譽篇文章電源天氣,大型死了形象你的並沒有路線傢伙興趣先生遇到總體不對帶來樓上,對不起超市超過全體,小組我的心試驗下去曝光功能地球幾年,遊戲根據中文突破該公司專用警察創建什麼事模組。
        </p>

        <h2>領先傳說簡直一定觀。</h2>
        <p>轉帖高興人生毫不節目民間財務允許關閉指導理由聲音,後面滑鼠衛生發達檢測啟動信譽篇文章電源天氣,大型死了形象你的並沒有路線傢伙興趣先生遇到總體不對帶來樓上,對不起超市超過全體,小組我的心試驗下去曝光功能地球幾年,遊戲根據中文突破該公司專用警察創建什麼事模組。
        </p>
    </div>
</div>

</html>
              
            
!

CSS

              
                * {
  boxsizing: border-box;
}
@mixin pc {
  @media (max-width: 1024px) {
    @content;
  }
}

@mixin pad {
  @media (max-width: 768px) {
    @content;
  }
}

@mixin phone {
  @media (max-width: 375px) {
    @content;
  }
}

$font-m: 16px;
$font-l: $font-m * 1.5;
$font-s: $font-m * 0.8;

// 變數設定

$primary-color:#03ac87;

a {
    text-decoration: none;
    color: $primary-color;
}

body {
    background: #06232e;
    font-family: 'noto Sans TC', 'sans-serif';
}

.container {
    max-width: 960px;
    // 要設定為 max-width 才能做響應式
    height: auto;
    margin: 0 auto;
}

.clearfix {
    clear: both;
}

// 全域設定

.header {
    height: 50px;
    border-bottom: 3px solid $primary-color;
    position: relative;
    // header 設定成 menu 選單的相對定位父元素

}


.logo {
    font-size: $font-l;
    float: left;
    margin-left: 1em;
    color: $primary-color;
    line-height: 50px;
}

.menu {
    float: right;

    li {
        float: left;

        a {
            font-size: $font-m;
            padding: 17px 20px;
            line-height: 50px;

            // 優化的內容寫在 a 連結裡面
            &:hover {
                background-color: $primary-color;
                color: #06232e;
            }

            // 只要寫 hover 的效果就好
        }
    }

    @include pad {
        max-height: 0px;
        // 隱藏選單高度
        overflow: hidden;
        // 在 pad 上隱藏選單
        transition: max-height 2s;
        position: absolute;
        z-index: 100;
        top: 51px;
        left: 0;
        right: 0;
        // 用絕對定位在 header 的 menu 上面
        // 因為 header 的高度為 50px,下方線條為 3px,所以要超過 50px 的高度
        // 左右推開變成滿版
        background: #06232e;
    }
}

.burgar_btn {
    display: none;
    // PC 時不顯示

    .fas {
        display: none;

    }

    @include pad {
        display: block;
        // 在 pad 螢幕解析度以下顯示
        color: $primary-color;
        font-size: $font-l;
        float: right;
        margin-right: 1em;
        line-height: 50px;

        .fas {
            display: block;
            line-height: 50px;
            // 在 pad 螢幕解析度以下顯示  
        }

    }

}

.content {
    line-height: 1.8;
    font-size: $font-m;
    color: $primary-color;
    margin-top: 2em;

    h2 {
        font-size: $font-l;
        font-weight: bold;
        margin-left: 24px;
        color: #07f7ff;
    }

    p {
        margin-left: 24px;
        padding-right: 20px;
        margin-bottom: 1em;
    }

}
              
            
!

JS

              
                
              
            
!
999px

Console