Benben
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # [FE101] 前端基礎:HTML 與 CSS ###### Date : 2021 May. 13 - 15 ## HTML 基礎 - html, head, body - h1 - h6, p - lorem ipsum - div, span - sapn 行內排版,highlight 好用 - img - `<img alt="img_text" title="descibe" src="URL" />` - ul, ol, li - pre, br - table, th, tr, td - th 標頭,tr 行,td 列 - a - href: hypertext reference - main, nav, footer 語意標籤 - iframe 遷入網頁 - `<iframe src="URL" width="100%" height="500px" />` - form, input, textarea 表單相關 - input type=[ attr ] - attr : text, password, email, date, radio, submit - meta tag - SEO : keyword, description - og : 讓 facebook 等更容易抓到網頁 - JSON-ld ( Linking Data ) - rotbot.txt 給爬蟲看的檔案 - Google Search Console 可以看網頁的曝光率等等 - Escape 字元 ```javascript & => &amp; < => &lt; > => &gt; ``` ## CSS 選擇器 Selector - 三種 CSS 用法 - 直接寫在標籤上 - 寫在 header 的 style 裡 - 使用外部資源 `<link rel="stylesheet" href="./style.css" />` rel : relationship href : hypertext reference - Selector 基礎 - `*` : 全選 - `div` : 標籤等 - `#id` : 選擇 id ,只能有一個 - `.class` : 選擇 class ,可以有多個 - Selector 進階 - `div.class` : 同時符合 - `.class div` : 底下所有的元素 - `.class > div` : 底下一層的元素 - `div + span` : 同一層之後下一個的元素 - `div ~ span` : 同一層之後所有的元素 - Selector Pseudo-classes ( 假的 class ) - `:hover` : Pseudo-classes 之一,chrome debug 工具可以常開 - `.wrapper div:nth-child(n)` : Pseudo-classes 之一,下一層第 n 的元素 > 會看第 n 個元素是否符合條件 ( 例如 : div ,如果是 span 就選不到 ) - `.wrapper div:nth-child(odd)` : Pseudo-classes 之一,下一層個奇數個元素,也可用 even ,或是 3n, 5n+1 ...等 - `.span::before` : Pseudo-element > style.css,如下 : ```css .span::before { content: "$"; color: red; } /* 其他寫法 */ .span::before { content: attr(class); color: red; } .span::before { content: ""; color: red; } ``` - Selector 權重 - 基本上 : id > class > tag - 照順序上面順序比下來 : 0, 0, 0 - 如果都一樣就按造前後順序 - 以上都比不過 inline style : 1, 0, 0, 0 - 最後奧義 ( 盡量不要用 ) !important : 1, 0, 0, 0, 0 ## CSS 各種裝飾 - background - background: url("./bg.jpg") no-repeat center center; - backgorund-size: 200px 200px; - backgorund-size: contain; ( 取圖片的寬或高 ) - backgorund-size: cover; ( 常用,會縮放、填滿背景 ) - border & outline - border: 2px solid gold; - border-radius: 5px; - outline: 2px solid black; ( 外框,原本的元素不會動到,少用 ) - 註 : 可以使用 border-top, bottom, left, right 來畫三角形 - margin & padding - padding: 內距, pad 緩衝,所以是裡面的 - margin: 外距,margin 邊緣,所以是外面的 - 文字相關 - color: red; - font-size: 30px - font-weight: bold; - font-family: 微軟正黑體; - text-align: center; - letter-spacing: 1px; - line-height: 1.5em; ( 相對字體的距離 ) - word-break: break-word; - white-space: nowrap; - overflow & text-overflow - overflow: scroll; ( 可以滾動 ) - overflow: hidden; ( 隱藏 ) - text-overflow: ellipsis; ( 可以將多的文字變 `...` ) - transition - transition: all 0.5s ease; ( 需要加在原本的元素上,不是變化的 ) - 延伸 : [貝茲曲線](https://zh.wikipedia.org/zh-tw/%E8%B2%9D%E8%8C%B2%E6%9B%B2%E7%B7%9A) , [cubic-bezier](https://cubic-bezier.com/) ## CSS 盒模型 ( box model ) - 盒模型 - box-sizing: border-box; ( 把 border 的寬高內縮成元素的寬高 ) - display - block: div, h1, p, ... - inline: span, a, ... - inline-block: 結合上面兩種優點 - 補充: ![](https://hackmd.io/_uploads/rJxe4Ncj3.png) ## CSS 定位 ( position ) - position - static: 預設排版方式 - relative: 相對定位,依據上一個元素定位,不會影響到後面的排版 - abosulute: 針對某個參考點定位 ( relative, 沒有給就是參考視窗 ),會影響後面的排版 - fixed: 固定在視窗,相對於瀏覽器 ( viewport ) 定位 - sticky: 新屬性,如果視窗滑過就黏在上面,可以用在導覽列等等 - z-index - 可以決定 z 軸的順序,越小越後面,值可以是負的 ## 切版實戰 - inline-block 其實會有孔隙 - CSS Naming : 使用兩個底線 `__` 連接 - float, flexbox, gird - reset.css vs. normalize.css --- ##### 心得 - 2021 May.15 終於進入前端的世界了,前面的 5 周基本上都是通用技能,CLI、Git、JavaScript基礎、網路基礎概念 ... 等,這周開始會介紹到 html, css 以前學的很雜亂,但藉由 huli 老師的整理,整個很有力,基本上會用到的都講了,較深入的也有補充資料。 html 相對好學,如果前面有跟著使用 markdown 語法,應該很快就可以上了,SEO 那邊講得很詳細,畢竟也是很新穎的領域,所以學校、外面的教材也很少提到,推一個。 CSS 選擇器也都有介紹到,包括假元素,都介紹的很詳細,也有試了很多狀況給我們了解是怎麼運作的,尤其是 nth-child 那邊示範了很多選不到的狀況,也蠻有趣的,可以跟著動手玩一下 CSS 盒模型 ( box moudel ) 跟定位 ( position ) 也都講得很詳細,還有最後實戰切版,直播切一個簡單的 facebook 網頁,也補充了很多知識

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully