当前位置: 首页 > news >正文

django学习入门系列之第三点《CSS基础样式介绍2》

文章目录

  • 文字对齐方式
  • 外边距
  • 内边距
  • 往期回顾


文字对齐方式

  • 水平对齐方式
text-align: center;
  • 垂直对齐方式
/* 注意,这个只能是一行来居中 */
line-height:/*长度*/ ;
  • 样例
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>中国移动</title><style>.c1{height: 100px;width: 100px;border : 1px solid red;text-align: center;line-height: 100px;}</style>
</head>
<body><div class="c1">中国</div>
</body>
</html>

外边距

  • 简单设置外部的距离
    • 我与别人有距离
    • 设置语法margin-内容 像素
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>中国移动</title><style>.c2{width: 60px;height: 60px;border: 1px solid red;padding: 20px 10px 30px 40px;margin-top: 50px;}</style>
</head>
<body>
<div class="c2"></div>
<div class="c2"></div>
</body>
</html>

在这里插入图片描述

内边距

  • 简单来说就是自己的内部可以设置一点距离(空出多少边距)
    • 我自己内部有距离
    • 设置语法padding-内容 像素

例子:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>中国移动</title><style>.c2{width: 60px;height: 60px;border: 1px solid red;padding-top: 50px;padding-left: 50px;padding-right: 50px;}</style>
</head>
<body>
<div class="c2"><div style="background-color: hotpink">text</div>
</div>
</body>
</html>

在这里插入图片描述

  • 如果上下左右都要内边距的话
padding 像素
.c2{width: 60px;height: 60px;border: 1px solid red;padding: 50px;}

或者

/* 按照上右下左的顺序给你安排 */
.c2{width: 60px;height: 60px;border: 1px solid red;padding: 20px 10px 30px 40px;}

往期回顾

1.【快速开发网站】
2.【浏览器能识别的标签1】
3.【浏览器能识别的标签2】
4.【浏览器能识别的标签3】
5.【浏览器能识别的标签4】
6.【案例1:用户注册】
7.【案例2:用户注册改进】
8.【快速了解 CSS】
9.【常用选择器概念讲解】
10.【CSS基础样式介绍1】

http://www.lryc.cn/news/379076.html

相关文章:

  • 分布式光纤测温DTS在工程现场中稳定性与可靠性如何?
  • PHP多线程模块parallel的编译安装和多线程编程演示
  • 记录grid布局属性
  • 12.爬虫---PyMysql安装与使用
  • VS2022遇到的两个问题
  • 【Android14 ShellTransitions】(六)SyncGroup完成
  • 技术管理转型之战:决策之道-管理中的智慧与策略
  • Shell脚本:条件语句(if、case)
  • 在Linux上为Windows目标配置Qt交叉编译
  • Introduction to linear optimization 第 2 章课后题答案 11-15
  • Java——包
  • Pipeline知识小记
  • postman国内外竞争者及使用详解分析
  • 人工智能对决:ChatGLM与ChatGPT,探索发展历程
  • 探索Python元类的奥秘及其应用场景
  • C语言基础关键字的含义和使用方法
  • 【Golang - 90天从新手到大师】Day09 - string
  • 网络安全与区块链技术:信任与安全的融合
  • MySQL之复制(九)
  • 【面试干货】 Java 中的 HashSet 底层实现
  • 爬虫经典案例之爬取豆瓣电影Top250(方法二)
  • 如何优化React应用的性能?
  • css文字镂空加描边
  • python数据分析与可视化
  • webkit 的介绍
  • make与makefile
  • 深度神经网络一
  • Pnpm:包管理的新星,如何颠覆 Npm 和 Yarn
  • 汽车IVI中控开发入门及进阶(三十二):i.MX linux开发之Yocto
  • tessy 编译报错:单元测试时,普通桩函数内容相关异常场景