Loading...
<style>
ol,
li {
/* 0 可以去掉默认的数字序号 */
margin: 0;
padding: 0;
/* 可以去掉数字后的 . */
list-style: none;
}
</style>
<ol>
<li>银魂</li>
<li>命运石之门</li>
<li>死亡笔记</li>
</ol>
浏览器会自动加上序号 1. 2. 3.
<style>
ul {
/* decimal 可以将无序列表变为有序列表 */
/* none 去掉默认的 . */
list-style-type: decimal;
}
</style>
<ol>
<li>银魂</li>
<li>命运石之门</li>
<li>死亡笔记</li>
</ol>
无序列表默认会自动加上 ·
<dl>
<dt>React</dt>
<dd>jsx</dd>
<dd>react-router-dom</dd>
<dd>dva</dd>
<dd>redux</dd>
<dt>Vue</dt>
<dd>vue-router</dd>
<dd>vuex</dd>
<dd>pinia</dd>
</dl>
表格最常见元素:
table 存在很多被弃用的属性:
align
(表格如何对齐)、bgcolor
(表格背景色)、border
(表格边框样式)、cellpadding
(单元格与边框之间的间距)、cellspacing
(单元格之间的间距)、frame
、rules
、summary
、width
(表格宽度)
详情请参照 MDN 文档 table 弃用的属性
border-collapse: collapse;
来决定 border 的边框是合并的
<table>
<caption>
热门股票
</caption>
<thead>
<tr>
<td>排名</td>
...
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
...
</tr>
...
</tbody>
<tfoot>
<tr>
<td>其它1</td>
...
</tr>
</tfoot>
</table>
<table>
<tr>
<!-- 跨列合并几列就写几,合并列后边通常不再有td -->
<td colspan="2">1-1</td>
</tr>
<tr>
<td>2-1</td>
<!-- 跨行合并,应提前看 tr 对应的td -->
<td rowspan="2">2-2</td>
</tr>
<tr>
<td>3-1</td>
</tr>
</table>
常见表单元素:
input 元素有如下常见的属性:
type:input 的类型
readonly:只读
disabled:禁用
checked:默认被选中
autofocus:当页面加载时,自动聚焦
name:名字
value:取值
type 类型的其他取值和 input 的其他属性, 查看 MDN 文档
<input type="text" readonly />
<!-- 等价于 -->
<input type="text" readonly="readonly" />
<input type="button" value="普通按钮" />
<input type="reset" value="重置按钮" />
<input type="submit" value="提交按钮" />
<!-- 等价于 -->
<button type="button">普通按钮</button>
<button type="reset">重置按钮</button>
<button type="submit">提交按钮</button>
label 和 input 的联系
label 的 for 和 input 的 id 相同,点击 label 即可聚焦 input
<label for="username"> 用户: <input id="username" type="text" /> </label>
<label for="password"> 密码: <input id="password" type="password" /> </label>
<label for="male"> <input id="male" type="radio" name="sex" value="male" />男 </label>
<label for="female"> <input id="female" type="radio" name="sex" value="female" />女 </label>
<label for="song"> <input id="song" type="checkbox" name="hobby" value="song" checked />唱 </label>
<label for="jump"> <input id="jump" type="checkbox" name="hobby" value="jump" />跳 </label>
<select name="fruits" id="" multiple size="2">
<option value="apple" selected>苹果</option>
<option value="banana">香蕉</option>
<option value="orange">橘子</option>
</select>