ycchang0324
    • 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
    --- title: HTML&CSS教學 tags: 網服導論, B&B組, EE+ slideOptions: # 簡報相關的設定 transition: 'fade' # 換頁動畫 theme: white parallaxBackgroundImage: 'https://ycchang0324.github.io/webprogramming/tutorial-background.png' --- # HTML&CSS教學 投影片:https://hackmd.io/@ycchang0324/web-lecture01-html-and-css ![](https://i.imgur.com/hElWb4E.png) --- ## 我是誰 ![](https://i.imgur.com/0dcmvPi.png) * 1.B&B組負責人 * 2.二手書網站後端組組長 --- ## 上完這堂課要學會的知識 * 1.學會html和css的使用方法,能夠寫一個網頁 * 2.了解javascript和html的關聯 --- ## 大綱 * 簡介 * HTML教學 * CSS教學 * 作業講解 * 參考資料 --- ## 簡介 ---- ### 100%的網站都會用到html和css ---- ### 甚麼是html * hypertext markdown language 超文本標記語言 * html不是程式(programming language) * html是一個網頁的架構 ---- ### html的環境 * 1.文字編輯:notepad、textedit(mac)、記事本、visual studio、bracket... * 2.執行:瀏覽器 ---- ### 線上程式編輯器 codepen.io ==[點我](https://codepen.io/ycchang0324/pen/zYBxZzP)== :computer: --- ## HTML教學 ---- ### 註解 ```htmlmixed= <!-- --> ``` * 1.讓人易讀程式碼 * 2.debug時可以用 ---- ### 命名規則 * 1.全部小寫 * 2.如果有兩個字,中間用hyphen(-)連結,如:first-paragraph * 不好的命名方法 * 1.firstParagraph(camel case) * 2.FirstParagraph(Pascal case) * 3.first_paragraph * 4.firstparagraph ---- ### 縮排 * 1.html不強制縮排 * 2.極度強烈建議縮排(除非你想被coworker揍) ---- ### html tag ```htmlmixed= <!DOCTYPE html> <!--定義網頁的型態為html--> <html></html> <!--整個檔案的root tag--> <head></head> <!--裝檔案的資訊--> <body></body> <!--裝內文--> ``` 一個tag包含三樣東西 * 1.starting tag、closing tag * 2.attribute屬性 * 3.text內文 ---- ### html樹狀結構 html Document of Model(html DOM) ```graphviz digraph hierarchy { nodesep=1.0 // increases the separation between nodes node [color=Red,fontname=Courier,shape=box] //All nodes will this shape and colour edge [color=Blue, style=line] //All the lines look like this document -> html html -> head html -> body head->{title} body-> p {rank=same;} // Put them on the same level } ``` parent element、child element、sibling element ---- ### head底下的tag ```htmlmixed= <title></title> <!--標題--> <meta> <!--資料的資料--> <link></link> <!--外部連結--> <style></style> <!--網頁樣式--> <script></script> <!--放javascript程式--> ``` ==[點我](https://codepen.io/ycchang0324/pen/vYKEWpp)== :computer: ---- ### body底下的tag * 1.headings * 2.paragraph * 3.layout of a webpage * 4.links * 5.images * 6.videos * 7.list * 8.tables * 9.container * 10.input ---- ### 1.heading tags ```htmlmixed= <h1></h1> <!--最大的標頭--> <h2></h2> <!--第二大的標頭--> ... ``` ==[點我](https://codepen.io/ycchang0324/pen/KKMwXJx?editors=1001)== :computer: ---- ### 2.paragraph tags ```htmlmixed= <p></p> <!--段落--> <!--字體變化--> <b></b><!--粗體--> <i></i><!--斜體--> <u></u> <!--底線--> <sub></sub> <!--下標--> <sup></sup> <!--上標--> <!--single tag--> <br/><!--空白行--> <hr/><!--水平直線--> ``` * 1.段落排放的方式,決定在瀏覽器顯現的方式 * 2.在html檔裡面空白行不會影響 ==[點我](https://codepen.io/ycchang0324/pen/LYZEeNd)== :computer: ---- ### 3.layout of a webwage ```htmlmixed= <header></header> <!--放標題--> <nav></nav> <!--上列選單--> <main></main> <!--主要文字--> <article></article> <!--文章內容--> <section></section> <!--段落--> <aside></aside> <!--和主網頁無關,如廣告--> <footer></footer> <!--網頁結尾--> ``` * 增加組織性、易讀性 * 增加搜尋引擎的排名 ==[點我](https://codepen.io/ycchang0324/pen/zYBxpyj)== :computer: ---- ### 4.links ```htmlmixed= <a href="url" target="_blank"> <!--用絕對路徑,新開分頁--> <a href="./page2.html" target="_blank"> <!--用相對路徑,新開分頁--> <a href="./image.png" target="_blank"> <!--也可以用瀏覽器開圖檔--> ``` ==[點我](https://codepen.io/ycchang0324/pen/rNLapbd)== :computer: ---- ### 5.images ```htmlmixed= <img src="https://codepen.io/ycchang0324/pen/MWeYVLa" alt="cute chiwawa" /><!--網址及替代名稱--> width="100" <!--寬度100px--> height="100" <!--高度100px--> ``` ==[點我](https://codepen.io/ycchang0324/pen/MWeYVLa)== :computer: ---- ### 6.videos ```htmlmixed= <video width="400" controls loop autoplay poster="bookmark.png"> <source src="video.mp4" type="video/mp4"> </video> ``` ==[點我](https://codepen.io/ycchang0324/pen/JjKovPr)== :computer: ---- ### 7.list ```htmlmixed= <ul></ul> <!--無序清單--> <ol></ol> <!--有序清單--> <li></li> <!--清單項目--> ``` ==[點我](https://codepen.io/ycchang0324/pen/NWrPMbW)== :computer: ---- ### 8.tables ```htmlmixed= <table></table> <!--表格--> <tr></tr> <!--一列--> <td></td> <!--一行--> <th></th> <!--欄位名稱--> <Caption></Caption> <!--表格名稱--> <thead></thead> <!--表格的標頭--> <tbody></tbody> <!--表格主要資料--> ``` ==[點我](https://codepen.io/ycchang0324/pen/gOMbzxJ)== :computer: ---- ### 9.container 1.wrapper all the thing into a container ```htmlmixed= <span></span> <!--inline container--> <div></div> <!--block container--> ``` ==[點我](https://codepen.io/ycchang0324/pen/oNLgdda)== :computer: ---- ### 10.input and form ```htmlmixed= <input/> type = "" <textarea></textarea> <!--可輸入文字--> <form></form> <!--把input資料包起來--> ``` ==[點我](https://codepen.io/ycchang0324/pen/jOrExoB)== :computer: --- ## CSS教學 ---- ### 大綱 * 1.css是甚麼 * 2.css寫在哪裡 * 3.css的規則 ---- ### CSS是甚麼 * cascading style sheet 階層式樣式表 * 網頁美化的魔術師 * css不是程式 ---- ### CSS寫在哪裡 * 1.直接在tag裡面寫(inline css) * 2.head裡面的style(internal css) * 3.外面的css檔(external css) ==[點我](https://codepen.io/ycchang0324/pen/YzWXQEV)== :computer: ---- ### CSS檔的架構 <font size=7>規則</font> ![](https://sites.google.com/site/guishanguoxiaowunianliuban/_/rsrc/1329996332932/rules/%E7%8F%AD%E8%A6%8F%E6%B5%B7%E5%A0%B1%E7%89%88.PNG?height=400&width=290) ---- ### 為甚麼要有CSS檔 * 1.可以讓多個html檔共用 * 2.html檔較簡潔 ---- ### CSS檔的規則 ```css= selector{ property1:value1; /*注意:css要加分號*/ property2:value2; /*注意:css的property是冒號不是等號,且沒有雙引號*/ /*注意:css的註解和html的不一樣,且沒有 // 這種註解*/ } ``` ---- ### selector介紹 ```css= .class{} /*類別selector*/ #id{} /*id selector*/ * {} /*universal selector*/ p{} /*tag selector*/ h1,h2,p{} /*group selector*/ div p{} /*select p in div*/ p.class{} /*select p in the class*/ p#id{} /*slector p in id*/ ``` ---- ### CSS功能教學 * 1.color * 2.background * 3.font * 4.box model * 5.pseudo class * 6.position * 7.flexbox ---- ### 1.color ```css= color:red; /*一般的顏色*/ color:Lavender; /*html自訂顏色的名字*/ color:#00ff00; /*十六進位*/ color:rgb(0,255,0); /*rgb值*/ } ``` ==[點我]( https://codepen.io/ycchang0324/pen/YzWypmX)== :computer: ---- ### 2.background ```css= background-color: #AAAAAA; /*背景顏色*/ background-image : url("image.jpg"); /*背景圖片*/ background-repeat: no-repeat; /*是否重複*/ background-position: right top; /*圖片位置*/ } ``` ==[點我]( https://codepen.io/ycchang0324/pen/xxOwgxN)== :computer: ---- ### 3.font ```css= font-weight: bold; /*字體粗細*/ font-family: 'Open Sans', sans-serif; /*字型*/ font-style: italic; /*字體樣式*/ font-size: 14px; /*字體大小/ } ``` [font 中文字型](https://www.wibibi.com/info.php?tid=67) ==[點我]( https://codepen.io/ycchang0324/pen/WNxbmjY)== :computer: ---- ### 4.box model ![](https://i.imgur.com/u9vdblp.png) ==[點我]( https://codepen.io/ycchang0324/pen/eYzpgJQ)== :computer: ---- ### 5.pseudo class ```css= li:first-child /*第一個子元素*/ li:last-child /*最後一個子元素*/ li:nth-child(5) /*第五個子元素*/ li:nth-child(even) /*偶數子元素*/ a:link { /*未點擊前*/ color: red; } a:active{ /*點擊時*/ color:green; } a:hover{ /*滑鼠飄過連結時*/ color:blue; } a:visited{ /*已點過連結*/ color:black; } ``` ==[點我](https://codepen.io/ycchang0324/pen/xxOGLLX)== :computer: ==[點我](https://codepen.io/ycchang0324/pen/NWrqvpQ)== :computer: ---- ### 6.position ```css= position:relative; position:absolute; position:fixed; ``` ==[點我](https://codepen.io/ycchang0324/pen/VwjLzKX)== :computer: ---- ### 7.flexbox ```css= display:flex; flex-direction: column; vertical-align: center; justify-content: center; justify-content: flex-end; justify-content: space-around; ``` ==[點我](https://codepen.io/ycchang0324/pen/KKMdaYE)== :computer: --- ## 作業連結 [網服導論HW1 HTML&CSS](https://hackmd.io/5wGLpTcdQWqIow5xWIstFA?view) --- ## 參考資料 * 1.HTML Full Course - Build a Website Tutorial * https://www.youtube.com/watch?v=pQN-pnXPaVg * 2.CSS Crash Course For Absolute Beginners * https://www.youtube.com/watch?v=yfoY53QXEnI * 3.W3school * https://www.w3schools.com/

    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 Google 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