当前位置:网站首页>区块元素、内联元素(<div>元素、span元素)
区块元素、内联元素(<div>元素、span元素)
2022-08-02 05:03:00 【五彩大铁猿】
目录
HTML<div>元素
HTML区块元素:
eg:<h1><p><ul><table>
HTML内联元素:
eg:<b>加粗 <td><a><img>
具体点击下面这条链接
(27条消息) HTML 区块元素_csdn123t的博客-CSDN博客_html 区域元素
HTML<div> 元素
- HTML <div> 元素是块级元素,它可用于组合其他 HTML 元素的容器。
- <div> 元素没有特定的含义。除此之外,由于它属于块级元素,浏览器会在其前后显示折行。
- 如果与 CSS 一同使用,<div> 元素可用于对大的内容块设置样式属性。
- <div> 元素的另一个常见的用途是文档布局。它取代了使用表格定义布局的老式方法。使用 <table> 元素进行文档布局不是表格的正确用法。<table> 元素的作用是显示表格化的数据。
具体代码实现:
<div style="border:1px dashed red;width:500px;margin-bottom:50px;position: relative;left: 400px;">

同样的我们将下面的表格、列表也划分到一个区块上。
完整代码如下 :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My first web page</title>
</head>
<body>
<div style="border:1px dashed red;width:500px;margin-bottom:50px;position: relative;left: 400px;">
<h2>LY python 练习</h2>
<h3>hahahaahhahhahahaha</h3>
<p>hello world ,练习web加油加油,<span style="color:red">LY</span></p>
<a href="https://blog.csdn.net/weixin_47314602?type=blog" target="_blank">小渣渣主页面</a>
<br/>
<img src="C:\Users\1\Pictures\Saved Pictures\aa.jpg" width="100">
</div>
<div style="border:1px dashed red;width:500px;margin-bottom:50px;position: relative;left: 400px;">
<table border="1" cellpadding="5">
<tr>
<th>data1</th>
<th>data2</th>
<th>data3</th>
</tr>
<tr>
<td>11</td>
<td>22</td>
<td>33</td>
</tr>
<tr>
<td>111</td>
<td>222</td>
<td>333</td>
</tr>
</table>
<ol>
<li>情深缘浅</li>
<li>情非得以</li>
<li>纸短情长</li>
</ol>
<ol start="10">
<li>说散就散</li>
<li>绿色</li>
<li>三生三世</li>
</ol>
<ul>
<li>我曾</li>
<li>鼓楼先生
<ul>
<li>汉斯</li>
<li>男</li>
<li>32</li>
</ul>
</li>
<li>寒鸦少年</li>
</ul>
</div>
</body>
</html>
展示图:

span元素
- HTML <span> 元素是内联元素,可用作文本的容器
- <span> 元素也没有特定的含义。
- 当与 CSS 一同使用时,<span> 元素可用于为部分文本设置样式属性。
在这一段代码上加上span
<p>hello world ,练习web加油加油,<span style="color:red">LY</span></p>
<div style="border:1px dashed red;width:500px;margin-bottom:50px;position: relative;left: 400px;">
<h2>LY python 练习</h2>
<h3>hahahaahhahhahahaha</h3>
<p>hello world ,练习web加油加油,<span style="color:red">LY</span></p>
<a href="https://blog.csdn.net/weixin_47314602?type=blog" target="_blank">小渣渣主页面</a>
<br/>
<img src="C:\Users\1\Pictures\Saved Pictures\aa.jpg" width="100">
</div>展示图我们可以看到LY这个地方变成红色。


边栏推荐
- mysql安装教程【安装版】
- Grid布局介绍
- mysql练习题
- 100 latest software testing interview questions in 2022, summary of common interview questions and answers
- Navicat报错:1045 -拒绝访问用户[email protected](使用passwordYES)
- Mysql常用命令大全
- ELK log analysis system
- 浏览器的onload事件
- ApiPost is really fragrant and powerful, it's time to throw away Postman and Swagger
- Go语学习笔记 - 处理超时问题 - Context使用 从零开始Go语言
猜你喜欢
随机推荐
mysql 查询表 所有字段
MySQL String Concatenation - Various String Concatenation Practical Cases
MYSQL unique constraint
大屏UI设计-看这一篇就够了
apisix-Getting Started
Go语学习笔记 - grpc serverclient protobuf 从零开始Go语言
AMQP协议详解
[Digital IC hand-tear code] Verilog fixed priority arbiter | topic | principle | design | simulation
MySQL安装常见报错处理大全
系统(层次)聚类
Matlab paper illustration drawing template No. 41 - bubble chart (bubblechart)
12个MySQL慢查询的原因分析
MES如何做好生产过程监控,本文给出了详细解答
Js数据类型转化之数组的join方法
MySQL大批量造数据
2022河南萌新联赛第(四)场:郑州轻工业大学 C - 最大公因数
Jmeter使用多线程测试web接口
go项目的打包部署
MySql copies data from one table to another table
navicat连接MySQL报错:1045 - Access denied for user ‘root‘@‘localhost‘ (using password YES)









