HTML介绍
HTML骨架标签
- 根标签
- 浏览器可见
- 眼睛可见
编写HTML工具
常用标签
标题标签
- 标题:h1~h6
<h1>我是h1</h1>
<h6>我是h6</h6>
- 段落:p
<p>我是段落</p>
- 超链接 a
<a href="https://www.baidu.com">⽂本</a>
href:跳转的地址或⽂件
target:打开窗⼝模式。 新窗⼝:target=“_blank”
- 图⽚
<!--
图像标签:img
属性:
src:图⽚路径
title:悬停显示⽂字
width:宽100px px:像素
height:⾼
alt:图⽚未加载显示
-->
<img src="011.jpg" title="希望在⽥野" width="100px" height="200px"
alt="此处有⼀张⽥野照⽚"/>
测试点:必须有title属性(悬停和未加载显示)
- 空格与换⾏
<!DOCTYPE html>
<html>
<head>
<title>My HTML Page</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is a paragraph of text.<br />
This is a new line.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</body>
</html>
空格:
&->shift+7
换⾏:<br />
- 布局标签
<!DOCTYPE html>
<html>
<head>
<title>盒子布局</title>
<style>
.big-box {
display: block; /* 独占一行 */
background-color: lightgray;
padding: 10px;
margin-bottom: 10px;
}
.small-box {
display: inline; /* 一行可以放多个 */
background-color: lightblue;
padding: 5px;
margin-right: 5px;
}
</style>
</head>
<body>
<div class="big-box">
<span class="small-box">小盒子1</span>
<span class="small-box">小盒子2</span>
<span class="small-box">小盒子3</span>
</div>
<div class="big-box">
<span class="small-box">小盒子4</span>
<span class="small-box">小盒子5</span>
</div>
</body>
</html>
⼤盒⼦:div、独占⼀⾏
⼩盒⼦:span、⼀⾏可以放多个
- 列表标签
script:js标签
style:css标签
link:外部加载css标签
- 表单input标签
文本框:
<input type="text" name="" id="">
<br> 密码框:
<input type="password" name="" id="" placeholder="请输入密码">
<br> 单选框:
<input type="radio" name="" id="">
<br> 多选框:
<input type="checkbox" name="" id="">
<input type="checkbox" name="" id="">
<input type="checkbox" name="" id="">
<br> 文件选择:
<input type="file" name="" id="">
<br> 提交按钮:
<input type="submit" name="" id="">
<br> 重置按钮:
<input type="reset" name="" id="">
<br> 普通按钮:
<input type="button" name="" id="">
⽂本框:
<input type="text" />
密码框:<input type="password" />
普通按钮:type=button
提交按钮:type=submit
重置按钮:type=reset
- 表单标签from
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<!DOCTYPE html>
<html>
<head>
<title>表单元素</title>
</head>
<body>
<form action="submit.html">
文本框:<input type="text" name="textbox" id="textbox"><br>
密码框:<input type="password" name="password" id="password" placeholder="请输入密码"><br>
单选框:<input type="radio" name="radio" id="radio1"><br>
多选框:
<input type="checkbox" name="checkbox1" id="checkbox1">
<input type="checkbox" name="checkbox2" id="checkbox2">
<input type="checkbox" name="checkbox3" id="checkbox3"><br>
文件选择:<input type="file" name="file" id="file"><br>
提交按钮:<input type="submit" name="submit" id="submit"><br>
重置按钮:<input type="reset" name="reset" id="reset"><br>
普通按钮:<input type="button" name="button" id="button">
</form>
</body>
</html>
</body>
</html>