or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
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.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
計算機概論Lab-7
HTML5 CSS
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →https://hackmd.io/@IMOK/Lab7
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →講師: 賴昱有
網頁的構成
網頁可以由以下三種語言去撰寫完成的,分別為 Html, CSS, Javascript
網頁開發的優點
網頁開發較為容易,速度快速,可以很快地做出成品
由於使用 Html, CSS 來定義APP, 桌面應用 UI (User Interface)對於開發上來說十分的便利
學習網頁的開發,對於未來進行其他的平台的 UI 撰寫也有很大的幫助。
Fifteen Puzzle Game
是由一塊有凹槽的板和數個寫有數字的大小相同的方塊所組成。
遊戲者要移動板上的方塊,讓所有的方塊順著數字的次序排列。
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →連接 : https://lorecioni.github.io/fifteen-puzzle-game/
環境設定
Visual Studio Code
並在 Visual Studio Code 中安裝以下項目:
安裝Visual Studio Code
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →載點 : https://code.visualstudio.com/
安裝 Extensions
1. 點選左方的 Extension 頁面
2. 輸入 Extension 的名子
3. 點選 Install
HTML
https://www.w3schools.com/
HTML 特徵
1. HTML 描述了整個網頁的架構與內容
2. HTML 由很多不同的 element 所組成
3. 瀏覽器會根據不同的 element 來使用不同的方式呈現 element 中的內容
Simple Example (Hello World)
DTD(Document Type Definition)
告訴瀏覽器說,使用 html 5 的語法來進行render
如果同學有興趣,可以看看其他格式的 DTD 宣告方式。
W3schools-DTD
Elements and Tags
剛剛提到 HTML 由很多不同的 element 所組成。
而每個element 由 start tag 與 end tag 組成
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →奇怪,有一個沒有 end Tag 的 element。
它是”Empty Element”,指沒有內容的 element,因此他沒有 end tag 。
其他常見 Empty Element 。如:
Attribute
attribute 對於 element 來說就像是一些可以改變的選項,
像是 img element 有 height / width attribute 可以更改寬高等。
※attribute 只能定義在 start tag 裡面
HTML Basic Structure
Heading
通常是用來放置要作為標題的文字,這類的標籤有 6 個,由文字的大到小分別為 h1, h2, …, h6
Paragraph
Paragraph Element 會將其中的內容視為一個段落。
不過 Paragraph Element 有些特性需要注意:
1. 前後自動換行
2. 不能nesting (paragraph裡面不能有另一個paragraph)
HTML 的語法檢查
由於現在多數的瀏覽器十分的聰明,
當我們撰寫錯誤的 html 語法的時候也會去猜測我們的語意,並嘗試的修復錯誤。
因此多數的時候,我們就算寫錯語法,也可以正常的顯示出來。
不過對於學習 HTML 時會造成學習者的一些困擾,我們會無法得知自己所撰寫的 HTML 是否是正確的。
這個時候,我們可以利用 World Wide Web Consortium (W3C) 所提供的
Markup Validation Service(https://validator.w3.org/)
來驗證我們所撰寫的 HTML 有那些部分是可以改正的。
使用 Markup Validation Service
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →HTML Link
建立超連結的基本寫法
• a : anchor tag
• href attribute 來設定連結的網頁
• element content 則是表示連結顯示的文字
Target Attribute
網頁中開啟另外一個網頁的方式其實有很多種,
如” 在新分頁開啟連結”、” 在目前頁面開啟連結”、” 在新視窗開啟連結” 等。
在 HTML 中,我們可以透過 target attribute 來設定連結開啟的效果。
最後三個牽涉到 frame 的使用,因此這邊的示範會只先介紹前兩種。
若有興趣的同學可以參考這個部分:https://www.w3schools.com/html/html_iframe.asp
Internal Linking(內部連結)
創建一個element 加上 id
HTML Image
• src : 設定圖片的來源
• height: 設定圖片的高度,單位為 pixels
• width: 設定圖片的寬度,單位為 pixels
W3schools-Width property
Alt Attribute
當網頁中的圖片無法顯示的時候,會顯示出來的文字。
這個屬性主要是用於當瀏覽器,無法顯示圖片時,
為了讓人能正常閱讀網頁內容,會將圖片使用文字替代。
HTML Table Elements
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →合併儲存格
如果大家有用過 Word, Excel 的表格應該會對這個功能不陌生。
HTML table中也有相似的功能,不過他將橫向合併與縱向合併分別拆開變成 rowspan 與 colspan。
※rowspan 與 colspan 都是 td/th 的 attribute
Rowspan
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →Colspan
HTML Lists
Order List v.s. Unorder List
在 HTML 中,列表有兩種,分別為 Ordered List 與 Unordered List。
這兩種的差別在於Unordered List 在每個項目的開頭會放置一個圖案,
而 Ordered List 則是放置有順序性的數字、字母。
Unordered List
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →Unordered List 符號更換
有四種可以選擇
Order List
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →Ordered List 符號更換
有五種可以選擇
Input Element
Input Element 是表單元件中最常見,也是用途最廣泛的元件。
input element 擁有 type attribute 可以進行設定,當設定為不同的內容時,會變化成不同的輸入元件。
Input Type
W3schools-Input type
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →Button
Checkbox
File
Radio
※ type 為 radio 時的用法較為特殊,使用相同 name attribute 的 radio element同時只能選擇一個。
create a search bar
HTML CSS
Inline CSS
Internal CSS
External CSS
searchbar.css
Selectors
W3schools-selectors reference
margin
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →border
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →padding
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →color
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →color(HSL)
HTML Javascript
searchbar.js
buld
https://www.w3schools.com/js/tryit.asp?filename=tryjs_intro_lightbulb
Lab Questions
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →Question 1
建立一個自我介紹的網頁
(需使用html及css)
Question 2
建立一個介紹你最喜歡的神奇寶貝的網頁
需包含名稱及神奇寶貝圖片及左下方介紹
建立一個外部連結,連結到你最喜歡的神奇寶貝頁面,URL由下連結取得
https://tw.portal-pokemon.com/play/pokedex
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →Question 3
將自我介紹作為主頁面,建立內部連結至最喜歡的神奇寶貝網頁
並可以由最喜歡的神奇寶貝頁面回到主頁面
Question 4
建立一個表格在介紹寶可夢的網頁
並將你最喜歡的神奇寶貝依據各種進化型態把數值列出
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →Question 5
使用CSS美化Question4的表格(需要width、margin、padding、border、background-color、color)

Question 6(bonus)
完善講義中的searchbar
將其美化並使其具備CRUD及reset的function
作業網站
http://140.121.197.13/tutorial
Pokemon TCG pocket
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →