HTML连接样式CSS和表格,表单

HTML连接样式CSS

html 复制代码
<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>菜鸟教程(runoob.com)</title> 
</head>
<-设置背景都是红色->
<body style="background-color:red;">
<-设置该段落字体颜色黄色->
<h2 style="background-color:red;color:yellow">这是一个标题</h2>
<-设置字体大小30px>
<p style="background-color:black;color:red;font-size:30px">这是一个段落。</p>
</body>
</html>

效果如下图:

HTML表格

HTML 表格由 <table> 标签来定义。

HTML 表格是一种用于展示结构化数据的标记语言元素。

每个表格均有若干行(由 <tr> 标签定义),每行被分割为若干单元格(由 <td> 标签定义),表格可以包含标题行(<th>)用于定义列的标题。

tr:tr 是 table row 的缩写,表示表格的一行。
td:td 是 table data 的缩写,表示表格的数据单元格。
th:th 是 table header的缩写,表示表格的表头单元格。

html 复制代码
<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>菜鸟教程(runoob.com)</title> 
</head>
<body>

<p>
每个表格从一个 table 标签开始。 
每个表格行从 tr 标签开始。
每个表格的数据从 td 标签开始。
</p>

<h4>一列:</h4>

<table border="1">
	<thead>
		<tr>
			<th>员工</th>
			<th>员工</th>
			<th>员工</th>
			<th>员工</th>
		</tr>
	</thead>
<tr>
  <td>100</td>
	 <td>100</td>
	 <td>500</td>
	 <td>100</td>
	
</tr>
</table>

<h4>一行三列:</h4>
<table border="1">
	<thead>
		<tr>
			<th>工资</th>
			<th>工资</th>
			<th>工资</th>
		</tr>
	</thead>
<tr>
  <td>100</td>
  <td>200</td>
  <td>300</td>
</tr>
<tr>
  <td>100</td>
  <td>200</td>
  <td>300</td>
</tr>
</table>

<h4>两行三列:</h4>
<table border="1">
<tr>
  <td>100</td>
  <td>200</td>
  <td>300</td>
</tr>
<tr>
  <td>400</td>
  <td>500</td>
  <td>600</td>
</tr>
</table>

</body>
</html>

运行效果如下图所示:

HTML表单

html 复制代码
<form action="/" method="post">
    <!-- 文本输入框 -->
    <label for="name">用户名:</label>
    <input type="text" id="name" name="name" required>
	<br>
	<br>
	<label for="name">出生日期:</label>
	<input type="date" id="date" name="date" required>
    <br>
	<br>
    <!-- 密码输入框 -->
    <label for="password">密码:</label>
    <input type="password" id="password" name="password" required>
    <br>
	<br>
    <!-- 单选按钮 -->
    <label>性别:</label>
    <!-- 四个参数,type,id,name和value>
    <input type="radio" id="male" name="gender" value="male" checked>
    <label for="male">男</label>
    <input type="radio" id="female" name="gender" value="female">
    <label for="female">女</label>
	<input type="radio" id="none" name="gender" value="none">
    <label for="none">性别无法判定</label>	
    <br>
	<br>
    <!-- 复选框 -->
    <input type="checkbox" id="subscribe" name="subscribe" checked>
    <label for="subscribe">订阅推送信息</label>
	<input type="checkbox" id="subscribe_zazhi" name="subscribe_zazhi" checked>
    <label for="subscribe">订阅杂志<label>
    <br>
	<br>
    <!-- 下拉列表 -->
    <label for="country">国家:</label>
    <select id="country" name="country">
        <option value="cn">CN</option>
        <option value="usa">USA</option>
        <option value="uk">UK</option>
		<option value="uk">US</option>
		<option value="uk">WXZ</option>
    </select>
    <br>
    <!-- 提交按钮 -->
    <input type="submit" value="提交信息">
</form>

运行效果如下图所示:

相关推荐
群联云防护小杜11 分钟前
深度隐匿源IP:高防+群联AI云防护防绕过实战
运维·服务器·前端·网络·人工智能·网络协议·tcp/ip
DanB2424 分钟前
html复习
javascript·microsoft·html
汉得数字平台28 分钟前
【鲲苍提效】全面洞察用户体验,助力打造高性能前端应用
前端·前端监控
花海如潮淹35 分钟前
前端性能追踪工具:用户体验的毫秒战争
前端·笔记·ux
_丿丨丨_5 小时前
XSS(跨站脚本攻击)
前端·网络·xss
天天进步20156 小时前
前端安全指南:防御XSS与CSRF攻击
前端·安全·xss
拾光拾趣录8 小时前
括号生成算法
前端·算法
拾光拾趣录9 小时前
requestIdleCallback:让你的网页如丝般顺滑
前端·性能优化
前端 贾公子9 小时前
vue-cli 模式下安装 uni-ui
前端·javascript·windows
拾光拾趣录9 小时前
链表合并:双指针与递归
前端·javascript·算法