css - inline\inline-block\block

复制代码
 1 <!DOCTYPE html>
 2 <html lang="en">
 3 
 4 <head>
 5     <meta charset="UTF-8">
 6     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 7     <meta http-equiv="X-UA-Compatible" content="ie=edge">
 8     <title>Document</title>
 9     <style>
10         body {
11             text-align: center;
12             color: #fff;
13             line-height: 80px;
14         }
15 
16         h1 {
17             /* inline不能设置宽高,没有 */
18             /* display: inline;
19             height: 20px;
20             padding: 10%; */
21 
22             /* display-inline 我们称之为行内块,可以设置宽高,拥有一切属性 */
23             /* display: inline-block;
24             height: 30px; */
25 
26             /*  display: block 块级元素,占满一行 */
27             display: block;
28             width: 80px;
29             height: 80px;
30             background-color: #000;
31         }
32 
33         h2 {
34             display: inline-block;
35             width: 80px;
36             height: 80px;
37             background-color: #000;
38             /* text-align: center; */
39         }
40 
41         h3 {
42             display: inline;
43             width: 80px;
44             height: 80px;
45 
46             background-color: #000;
47         }
48     </style>
49 </head>
50 
51 <body>
52     <h1>块级元素</h1>
53     <h2>行间块</h2>
54     <br>
55     <h3>行内(没有宽高,我能怎么办)</h3>
56 </body>
57 
58 </html>
复制代码

 

posted @   Sunsin  阅读(167)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示