Skip to content

syuanc19/html.md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 

Repository files navigation

html.md

基本结构

<!DOCTYPE html>
<html lang="zh-TW">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    
</body>
</html>

基礎文本格式

標籤 效果
<strong>, <b> 加粗
<em>, <i> 傾斜
<ins>, <u> 下划線
<del>, <s> 刪除線

圖像標籤

<img src="圖像url" alt="替代文字" title="懸停時提示文字>

音頻標籤

<audio src="音頻url" control>

屬性:

  • controls 控制面板
  • loop 循環播放
  • autoplay 自動播放

影片標籤

<video src="影片url" controls>

屬性:

  • controls 控制面板
  • loop 循環播放
  • autoplay 自動播放
  • muteplay 靜音播放

路徑- 相對與絕對

相對路徑:從 當前文件位置 出發尋找目標
 / 表示進入某個文件夾裡面
 . 表示當前文件所在的資料夾
 .. 代表上一級

e.g. ../../example/a.jpg 訪問以當前位置為主,上上個資料夾的example裡的a.jpg

絕對路徑:從 硬碟 出發尋找目標(windows從硬碟出發,Mac從根目錄出發)

e.g. F:\User\Desktop\example.jpg


表格

table嵌套tr, tr嵌套 th/td, thead與 tbody則用來使語法更工整
表格最好用来展示数据,而非用来布局

<table align="center" border="1" cellpadding="1" cellspacing="0" width="500" height="500">
	<thead>
		<tr>
			<th> 标题单元格1 </th>
			<th> 标题单元格2 </th>
			<th> 标题单元格3 </th>
        </tr>
	</thead>
	<tbody>
		<tr>
			<td> 内文1 </td>
			<td> 内文2 </td>
			<td> 内文3 </td>
		</tr>
	</tbody>
</table>

效果:

标题单元格1 标题单元格2 标题单元格3
内文1 内文2 内文3
标签名 含义
taable 表格标签
thead,tbody 标题、内文群组标签
th [th] 标题标签(自动置中加粗)
tr,td [tr] 行标签、[td] 内文标签

table属性

(弃用) 因后续会在CSS里设置

align、bgcolor、border、cellpadding、cellspacing

合并表格

标签名 含义
colspan=数字 行合并
rowspan=数字 列合并

自定义列表

<dl>
	<dt>名词一</dt>
	<dd>名词一释义</dd>
	<dd>名词二释义</dd>
</dl>

dl里只允许有 dt or dd,但dt dd里可以放任何标签


表单

<form action="url地址" method="get/post" name="表单域名称">
method = get method = post
/xxx.php?username=syuan19&pwd=a140472 /xxx.php

input

<input type="属性" name="name" value="value" checked="checked">

checked="checked" 可实现选项标签预设选择值


属性 描述 效果
button 可点击按钮
checkbox 复选框 复选1 复选2
file 供文件上传
password 密码字段
radio 单选按钮 (禁止复选需定义相同name) 选项1
选项2
选项3
reset 重置按钮
submit 提交按钮
text 单行输入字段,默认20em
image 图像形式的提交按钮
hidden 隐藏的输入段

Label标签

<input type="text" id="指定id"> <Label for="指定id"> 用户名: </Label> 

能实现点击标签名也能选取框元素的功能

select列表

代码 效果
<select>
     <option>选项一</option>
     <option>选项二</option>
     <option>选项三</option>
</select>
选项一 选项二 选项三

selected="selected" 可实现选项标签预设选择值

效果:

代码 效果
<select>
     <option>选项一</option>
     <option>选项二</option>
     <option selected="selected">选项三 </option>
</select>
选项一 选项二 选项三

textarea文本域

代码 效果
自我介绍:
<textarea placeholder="篇幅120为限" maxlength="120">
</textarea>
自我介绍:<textarea placeholder="篇幅120为限" maxlength="120"></textarea>

textarea属性

一般不用,会在CSS里改

<textarea cols="100" rows="5"></textarea>
标签名 含义
cols 每行中的字符数
rows 预设显示的行数

About

html notebook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published