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">
    <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">
    <title>asideMenu</title>
</head>

<body>
    <div class="sideMenu">
        <form>
            <input type="search" placeholder="請輸入搜尋名稱">
            <button><i class="fas fa-search"></i></button>
        </form>
        <nav>
            <a href="#"><i class="fas fa-sitemap"></i>課程簡介</a>
            <a href="#"><i class="fas fa-chalkboard"></i></i>報名須知</a>
            <a href="#"><i class="fas fa-book-reader"></i>師資介紹</a>
            <a href="#"><i class="fas fa-user-graduate"></i>學員分享</a>
            <a href="#"><i class="fas fa-trophy"></i>比賽資訊</a>
        </nav>
    </div>
</body>

</html>
              
            
!

CSS

              
                * {
    font-family: 'noto Sans TC', 'sans-serif';
}

html,
body {
    height: 100%;
}

body {
    background-color: #546377;
}

a {
    text-decoration: none;
}

.sideMenu {
    width: 300px;
    height: 100%;
    background-color: #ff7575;
    border-right: 3px solid #d1d1d1;
    display: flex;
    //讓 sideMenu 裡面的元素變成橫排
    flex-direction: column;
    //讓 flex 的方向變成直排
    padding: 50px 0;
    //因為有 boxsizing 的關係,所以不會有 Y 軸 bar
    box-shadow: 5px 0 5px hsla(240, 40%, 15%, .6);
    //H 為 hue(色相)、S 為 saturation(飽合度)、L 為 lightness(亮度),a透明度

    form {
        display: flex;
        //讓 form 裡面的元素橫向排列
        margin: 0 10px 50px;
        border-radius: 100px;
        border: 1px solid #fff;

        input {
            width: 230px;
        }

        button {
            width: 50px;
        }

        input,
        button {
            border: none;
            padding: 5px 10px;
            background-color: transparent;
            color: #fff;

        }

        //把共同的屬性拉出來寫一次就好,CSS會比較漂亮且清楚

        input:focus,
        button:focus {
            outline: none;
            //讓表單不要有 focus 效果
        }
    }

}

nav {
    a {
        display: block;
        color: #fff;
        padding: 20px 10px;
        position: relative;

        .fas {
            margin-right: -1.1em;
            //用 margin 的特性往右拉負值,讓文字靠左對齊
            transform: scale(0);
            //使圖示消失
            transition: 0.3s;

        }

        &:hover .fas {
            margin-right: 0em;
            //使文字回到原來的位置
            transform: scale(1) //使圖示出現
        }

        &+a::before {
            content: '';
            //要寫分隔線在選項中間,這邊使用偽元素呈現,使用偽元素一定要使用 content:'',不然不會有效果
            position: absolute;
            border-top: 1px solid #ffffff;
            left: 10px;
            right: 10px;
            top: 0px;
            //使用絕對定位方式編寫,因為 padding已設定左右 10px,所以左右邊要推擠 10px
            //然後使分隔線定位在 top:0px,固定在中間

        }
    }

}
              
            
!

JS

              
                
              
            
!
999px

Console