当前位置:网站首页>区块元素、内联元素(<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这个地方变成红色。


边栏推荐
- ELK log analysis system
- Matlab论文插图绘制模板第41期—气泡图(bubblechart)
- ERROR 1045 (28000) Access denied for user ‘root‘@‘localhost‘解决方法
- MySQL大批量造数据
- ERROR 1045 (28000) Access denied for user 'root'@'localhost'Solution
- MYSQL unique constraint
- 【热题】LeetCode 热题 HOT 100分类+题解
- Towhee 每周模型
- MySQL 5.7 detailed download, installation and configuration tutorial
- HSCTF2022-re题解
猜你喜欢

元宇宙:活在未来

21天学习挑战赛安排

18年程序员生涯,读了200多本编程书,挑出一些精华分享给大家

The original question on the two sides of the automatic test of the byte beating (arranged according to the recording) is real and effective 26

C language: Check for omissions and fill in vacancies (3)

腾讯注册中心演进及性能优化实践

【HCIE】NO.30 OSPFv3的基本配置

Detailed explanation of the software testing process (mind map) of the first-tier manufacturers

ORA-04044:此处不允许过程、函数、程序包或类型,系统分析与解决

Google 安装印象笔记剪藏插件
随机推荐
Introduction and use of apifox (1).
元宇宙:活在未来
Navicat new database
18年程序员生涯,读了200多本编程书,挑出一些精华分享给大家
JDBC revisited
分享|5G+智慧工业园区解决方案(附PDF)
Go语学习笔记 - grpc serverclient protobuf 从零开始Go语言
MobaXsterm如何使用
Browser onload event
Go语言中定时任务库Cron使用详解
MySQL 5.7 upgrade to 8.0 detailed process
数据湖:流计算处理框架Flink概述
MySQL(7)
ES6——class类实现继承
12 reasons for MySQL slow query
迅为RK3568开发板编译Buildroot-全自动编译
Android studio connects to MySQL and completes simple login and registration functions
navicat连接MySQL报错:1045 - Access denied for user ‘root‘@‘localhost‘ (using password YES)
MySQL如何创建用户
ApiPost is really fragrant and powerful, it's time to throw away Postman and Swagger