CSS——选择器、PxCook软件、盒子模型
选择器
结构伪类选择器
作用:根据元素的结构关系查找元素。
![]()
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>ul li:first-child{color: pink;}ul li:last-child{color: green;}ul li:nth-child(2n){color: blue;}</style> </head> <body><ul><li>我是第1个li</li><li>我是第2个li</li><li>我是第3个li</li><li>我是第4个li</li><li>我是第5个li</li><li>我是第6个li</li><li>我是第7个li</li><li>我是第8个li</li><li>我是第9个li</li><li>我是第10个li</li><li>我是第11个li</li></ul> </body> </html>
:nth-child(公式)
作用:根据元素的结构关系查找多个元素。
提示:公式中的n取值从 0 开始。
伪元素选择器
作用:创建虚拟元素(伪元素),用来摆放装饰性的内容。
注意点:
- 必须设置 content: ””属性,用来 设置伪元素的内容,如果没有内容,则引号留空即可
- 伪元素默认是行内显示模式
- 权重和标签选择器相同
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>/* 一个冒号是伪类 两个冒号是伪元素 */.box::before{content: "我";/* 因为是行内元素所以无法设置宽高 */display: inline-block;width: 30px;height: 30px;background-color: pink;}.box::after{content: "刘德华";}</style> </head> <body><div class="box">是</div> </body> </html>
PxCook
PxCook(像素大厨) 是一款切图设计工具软件。支持PSD文件的文字、颜色、距离自动智能识别。
- 开发面板(自动智能识别)
- 设计面板(手动测量尺寸和颜色)
创建项目 → 输入 项目名称、项目类型 Web → 单击按钮【创建项目】 → 单击按钮【添加】,导入设计稿
盒子模型
盒子模型 – 组成
作用:布局网页,摆放盒子和内容。
盒子模型重要组成部分:
- 内容区域 – width & height
- 内边距 – padding(出现在内容与盒子边缘之间)
- 边框线 – border
- 外边距 – margin(出现在盒子外面)
盒子模型 – 边框线
属性名:border(bd)
属性值:边框线粗细 线条样式 颜色(不区分顺序)
常用线条样式
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.box{width: 200px;height: 200px;background-color: pink;/* border: solid 3px blue; *//* solid 实线 dashed 虚线 dotted 点线 */border: 3px dotted red;}input{width: 490px;height: 30px;border: 2px solid red;font-size: 14px;}</style> </head> <body><div class="box"></div><br><input type="text" placeholder="平板"> </body> </html>
设置单方向边框线
属性名:border-方位名词(bd+方位名词首字母,例如,bdl)
属性值:边框线粗细 线条样式 颜色(不区分顺序)
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.box{width: 200px;height: 200px;background-color: pink;/* border: solid 3px blue; *//* solid 实线 dashed 虚线 dotted 点线 */border: 3px dotted blue;border-top: 3px dotted red;}input{width: 490px;height: 30px;border: 2px solid red;font-size: 14px;}</style> </head> <body><div class="box"></div><br><input type="text" placeholder="平板"> </body> </html>
盒子模型 – 内边距
作用:设置 内容 与 盒子边缘 之间的距离。
属性名:padding / padding-方位名词
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.box{width: 200px;height: 200px;background-color: pink;padding: 30px;/* 内边距 padding: 30px 表示上下左右都是30px */}input{width: 490px;height: 30px;border: 2px red solid;font-size: 14px;/* 可以设置单方向 */padding-left: 15px;}</style> </head> <body><div class="box">文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字</div><input type="text" placeholder="平板"> </body> </html>
盒子模型 – 内边距 – 多值写法
padding 多值写法
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.box{width: 200px;height: 200px;background-color: pink;/* 一个值 上下左右 *//* padding: 10px; *//* 两个值 上下10 左右30 *//* padding: 10px 30px; *//* 三个值 上10 左右30 下50 *//* padding: 10px 30px 50px; *//* 四个值 顺时针 上下左右 */padding: 10px 30px 50px 40px;}</style> </head> <body><div class="box">文字</div> </body> </html>
技巧:从上开始顺时针赋值,当前方向没有数值则与对面取值相同。
盒子模型 – 尺寸计算
默认情况
盒子尺寸 = 内容尺寸 + border 尺寸 + 内边距尺寸
结论:给盒子加 border / padding 会撑大盒子
解决
- 手动做减法,减掉 border / padding 的尺寸
- 內减模式:box-sizing: border-box
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.box{/*1. 手动去减 *//* width 160px *//* height 160px *//* 2.css盒子模型 box-sizing: border-box*/width: 200px;height: 200px;background-color: pink;border: 10px solid red;padding: 10px;box-sizing: border-box;}</style> </head> <body><div class="box">qwe</div> </body> </html>
盒子模型 – 外边距
作用:拉开两个盒子之间的距离
属性名:margin
提示:与 padding 属性值写法、含义相同
技巧:版心居中 – 左右 margin 值 为 auto(盒子要有宽度)
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.box{width: 800px;height: 1000px;background-color: pink;/* 有宽度的块级元素水平居中 */margin:auto;}</style> </head> <body><div class="box"></div> </body> </html>
清除默认样式
清除标签默认的样式,比如:默认的内外边距。
<!DOCTYPE html> <html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>* {/* 清除内外边距 */margin: 0;padding: 0;box-sizing: border-box;}ul {margin: 100px;}li {/* 取消li的小圆点 */list-style: none;}</style> </head><body><h1>标题</h1><ul><li>123</li><li>123</li></ul> </body></html>
盒子模型 – 元素溢出
作用:控制溢出元素的内容的显示方式。
属性名:overflow
属性值
<!DOCTYPE html> <html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.box {/* 超出的部分,隐藏 */overflow: hidden;/* 超出的部分显示滚动条 *//* overflow: scroll; *//* auto 如果超出,则显示滚动条,不超出则不显示滚动条 *//* overflow: auto; */width: 200px;height: 200px;background-color: pink;}</style> </head><body><div class="box">我要写很多很多很多的文字我要写很多很多很多的文字我要写很多很多很多的文字我要写很多很多很多的文字我要写很多很多很多的文字我要写很多很多很多的文字我要写很多很多很多的文字我要写很多很多很多的文字我要写很多很多很多的文字我要写很多很多很多的文字我要写很多很多很多的文字我要写很多很多很多的文字</div> </body></html>
外边距问题 – 合并现象
场景:垂直排列的兄弟元素,上下 margin 会合并
现象:取两个 margin 中的较大值生效
外边距问题 – 塌陷问题
场景:父子级的标签,子级的添加 上外边距 会产生塌陷问题
现象:导致父级一起向下移动
解决方法:
- 取消子级margin,父级设置padding
- 父级设置 overflow: hidden
- 父级设置 border-top
<!DOCTYPE html> <html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>/* .nav ul li a {} */.box1,.box2 {width: 100px;height: 100px;background-color: pink;}.box1 {margin-bottom: 100px;}.box2 {background-color: purple;margin-top: 150px;}/* 结果是 100px, 外边距合并以较大外边距为准 */.father {/* 防止外边距塌陷 *//* 1. 方案1 overflow: hidden; *//* 2. 方案2 border-top: 1px solid red; *//* transparent 颜色透明 */border-top: 1px solid transparent;width: 200px;height: 200px;background: pink;/* 3. 方案3 padding-top: 20px; */}.son {width: 100px;height: 100px;background-color: skyblue;margin-top: 20px;}</style> </head><body><div class="box1">上</div><div class="box2">下</div><div class="father"><div class="son"></div></div> </body></html>
行内元素 – 内外边距问题
场景:行内元素添加 margin 和 padding,无法改变元素垂直位置
解决方法:给行内元素添加 line-height 可以改变垂直位置
<!DOCTYPE html> <html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>span {/* 上下不生效 有问题 给行高可以解决 转换为其他元素 */padding: 30px;line-height: 60px;}</style> </head><body><span>我是span</span> </body></html>
盒子模型 – 圆角
作用:设置元素的外边框为圆角。
属性名:border-radius
属性值:数字+px / 百分比
提示:属性值是圆角半径
技巧:从左上角开始顺时针赋值,当前角没有数值则与对角取值相同。
常见应用 – 正圆形状
给正方形盒子设置圆角属性值为 宽高的一半 / 50%
常见应用 – 胶囊形状
给长方形盒子设置圆角属性值为 盒子高度的一半
<!DOCTYPE html> <html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.box {width: 100px;height: 100px;background-color: pink;/* 圆角边框 */border-radius: 15px;}/* img {border-radius: 50%;} */.box2 {width: 200px;height: 40px;background-color: pink;border-radius: 20px;}.img1 {border-radius: 15px;}.img2 {border: 2px solid red;border-radius: 0 50%;}.img4 {border-radius: 15px 50px 80px 100px;}</style> </head><body><div class="box"></div><img src="./images/1.png" alt=""><div class="box2"></div><img src="./images/1.png" alt="" class="img1"><img src="./images/1.png" alt="" class="img2"><img src="./images/1.png" alt="" class="img3"><img src="./images/1.png" alt="" class="img4"></body></html>
盒子模型 – 阴影(拓展)
作用:给元素设置阴影效果
属性名:box-shadow
属性值:X 轴偏移量 Y 轴偏移量 模糊半径 扩散半径 颜色 内外阴影
注意:
- X 轴偏移量 和 Y 轴偏移量 必须书写
- 默认是外阴影,内阴影需要添加 inset
<!DOCTYPE html> <html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>img {border-radius: 50%;/* 盒子阴影 *//* box-shadow: 3px 5px 4px rgba(0, 0, 0, .4); */}img:hover {box-shadow: 0 15px 30px rgba(0, 0, 0, .3);}</style> </head><body><img src="./images/1.png" alt=""> </body></html>
综合案例1——抖音直播
<!DOCTYPE html> <html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>/* 清除样式 */* {margin: 0;padding: 0;box-sizing: border-box;}body {background-color: #f1f1f1;}.card {width: 270px;height: 255px;background-color: #fff;border-radius: 15px;/* 让块级盒子水平居中 左右margin是auto就可以了 */margin: 100px auto 0;/* 让里面的文字和图片水平居中 */text-align: center;padding-top: 40px;}.card h4 {/* 不加粗 */font-weight: 400;/* 上 15 下 10 左右不要 */margin: 15px 0 10px 0;}.card p {font-size: 14px;}.card:hover {box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);}</style> </head><body><div class="card"><img src="./images/liveSDK.svg" alt=""><h4>抖音直播SDK</h4><p>包含抖音直播看播功能</p></div></body></html>
综合案例2——新闻
<!DOCTYPE html> <html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>* {margin: 0;padding: 0;box-sizing: border-box;}li {/* 取消小点 */list-style: none;}.box {width: 360px;height: 190px;/* background-color: pink; *//* 块级盒子水平居中 */margin: 100px auto;}.box-hd {height: 34px;background-color: #eeeeee;border: 1px solid #dbdee1;border-left: 0;}.box-hd a {/* 转换为块级元素 */display: block;width: 50px;height: 34px;background-color: #fff;text-align: center;line-height: 31px;font-size: 14px;color: #333;text-decoration: none;border-top: 3px solid #ff8400;border-right: 1px solid #dbdee1;/* margin是负值,则盒子往上走 */margin-top: -1px;}.box-bd {margin-top: 3px;}.box-bd li {line-height: 26px;background: url(./images/square.png) no-repeat left center;padding-left: 15px;}.box-bd li a {font-size: 14px;text-decoration: none;color: #333;background: url(./images/img.gif) no-repeat left center;padding-left: 20px;}.box-bd li a:hover {color: #ff8400;text-decoration: underline;}</style> </head><body><div class="box"><!-- 头部 hd 是 head的缩写 --><div class="box-hd"><a href="#">新闻</a></div><!-- 身体部分 bd 是 body的缩写--><ul class="box-bd"><li><a href="#">新农村人,温暖的身手</a></li><li><a href="#">新农村人,温暖的身手</a></li><li><a href="#">新农村人,温暖的身手</a></li><li><a href="#">新农村人,温暖的身手</a></li><li><a href="#">新农村人,温暖的身手</a></li><li><a href="#">新农村人,温暖的身手</a></li></ul></div> </body></html>
相关文章:
CSS——选择器、PxCook软件、盒子模型
选择器 结构伪类选择器 作用:根据元素的结构关系查找元素。 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0&quo…...
Mysql 大表limit查询优化原理实战
文章目录 1 大表查询无条件优化&原理(入门)2 大表查询带 条件 优化&原理(进阶)2.1 where 后面的查询字段只有一个时,要求该字段是索引字段2.2 where 后面的查询字段有多个时,尽量让查询字段为索引字段且字段值基数大 3 大表查询带 排序 优化&…...
在vscode中开发运行uni-app项目
确保电脑已经安装配置好了node、vue等相关环境依赖 进行项目的创建 vue create -p dcloudio/uni-preset-vue 项目名 vue create -p dcloudio/uni-preset-vue uni-app 选择模版 这里选择【默认模版】 项目创建成功后在vscode中打开 第一次打开项目 pages.json 文件会报错&a…...
【JavaEE初阶 — 多线程】Thread的常见构造方法&属性
目录 Thread类的属性 1.Thread 的常见构造方法 2.Thread 的几个常见属性 2.1 前台线程与后台线程 2.2 setDaemon() 2.3 isAlive() Thread类的属性 Thread 类是JVM 用来管理线程的一个类,换句话说,每个线程都有一个唯一的Thread 对象与之关联&am…...
ctfshow(316)--XSS漏洞--反射性XSS
Web316 进入界面: 审计 显示是关于反射性XSS的题目。 思路 首先想到利用XSS平台解题,看其他师傅的wp提示flag是在cookie中。 当前页面的cookie是flagyou%20are%20not%20admin%20no%20flag。 但是这里我使用XSS平台,显示的cookie还是这样…...
ubuntu22.04安装conda
在 Ubuntu 22.04 上安装 Conda 可以通过以下步骤进行: 下载 Miniconda(轻量级版本的 Conda): 打开终端并运行以下命令以下载 Miniconda 安装脚本: wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-…...
D58【python 接口自动化学习】- python基础之异常
day58 异常捕获 学习日期:20241104 学习目标:异常 -- 74 自定义异常捕获:如何定义业务异常? 学习笔记: 自定义异常的用途 自定义异常的方法 # 抛出一个异常 # raise ValueError(value is error) # ValueError: val…...
Java项目实战II基于Spring Boot的便利店信息管理系统(开发文档+数据库+源码)
目录 一、前言 二、技术介绍 三、系统实现 四、文档参考 五、核心代码 六、源码获取 全栈码农以及毕业设计实战开发,CSDN平台Java领域新星创作者,专注于大学生项目实战开发、讲解和毕业答疑辅导。获取源码联系方式请查看文末 一、前言 在快节奏的…...
Java-日期计算工具类DateCalculator
DateCalculator是用于日期计算的工具类。这个工具类将包括日期的加减、比较、周期计算、日期 范围生成等功能。 import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.Period; import java.time.temporal.ChronoUnit;…...
单片机串口接收状态机STM32
单片机串口接收状态机stm32 前言 项目的芯片stm32转国产,国产芯片的串口DMA接收功能测试不通过,所以要由原本很容易配置的串口空闲中断触发DMA接收数据的方式转为串口逐字节接收的状态机接收数据 两种方式各有优劣,不过我的芯片已经主频跑…...
ipv6的 fc00(FC00::/7) 和 fec0(FEC0::/10)
ipv6的 fc00(FC00::/7)(唯一本地地址) 替代了 fec0(FEC0::/10) (站点本地地址,已弃用) ipv6的 fc00(FC00::/7) 替代了 fec0(FEC0::/10) , 在IPv6地址中,FC00::/7(通常简写为FC00)和…...
Chat GPT英文学术写作指令
目录 Chat GPT英文学术写作指令 Chat GPT英文学术写作指令 1."为我捉供一些建议和技巧,以提高我的学术写作质最和风格" (Provide me with some suggestions andtips to improve the quality andstyleofmyacademic writing.) 2."帮我提写一个清晰而有逻辑的…...
超详细Pycharm安装汉化教程,Python环境配置和使用指南,Python零基础入门看这个就够了!
包含编程资料、学习路线图、源代码、软件安装包等!【[点击这里]】! PyCharm 是由 JetBrains 打造的一款 Python IDE (集成开发环境,Integrated Development Environment),带有一整套可以帮助用户在使用 Py…...
react-native:解决使用webView后部分场景在安卓10崩溃闪退问题
app闪退问题原因: 安卓7以上版本(7和7以下版本不会出现闪退):在屏幕不可视区域加载webView或者webView不在可视区域内切换页面时app崩溃闪退(在屏幕可视区域加载webView或者webView在可视区域内切换页面不会闪退&…...
大数据工具 flume 的安装配置与使用 (详细版)
参考网址:Flume 1.9用户手册中文版 — 可能是目前翻译最完整的版本了 1,上传安装包 安装包链接:文件下载-奶牛快传 Download |CowTransfer 口令:x8bhcg 1,切换盘符到安装目录 cd /opt/moudles 解压文件…...
智慧城市智慧城市项目方案-大数据平台建设技术方案(原件Word)
第1章 总体说明 1.1 建设背景 1.2 建设目标 1.3 项目建设主要内容 1.4 设计原则 第2章 对项目的理解 2.1 现状分析 2.2 业务需求分析 2.3 功能需求分析 第3章 大数据平台建设方案 3.1 大数据平台总体设计 3.2 大数据平台功能设计 3.3 平台应用 第4章 政策标准保障…...
C语言比较两个字符串是否相同
在不使用string.h中的内置函数的情况下 #include <stdio.h> #include <string.h> void main(){char arr1[]"hello world";char arr2[]"hello world";int i,a0;if(strlen(arr1)!strlen(arr2)){print("不相等");return 0;}for(i0;arr…...
丹摩征文活动|FLUX.1图像生成模型:AI工程师的创新实践
文章目录 一、对"FLUX.1"系列模型版本分析 二、AI工程师与FLUX.1系列模型 三、ComfyUI在线部署四、FLUX.1在线部署五、添加工作流呈现效果图展示六、总结 黑森林实验室(Black Forest Labs)推出的FLUX.1图像生成模型,凭借120亿参数的…...
ZABBIX API获取监控服务器OS层信息
Zabbix 是一款强大的开源监控解决方案,能够通过其 API 接口自动化管理和获取监控数据。在这篇文章中,详细讲解如何通过 Zabbix API 批量获取服务器的系统名称、IP 地址及操作系统版本信息,并将数据保存到 CSV 文件中。本文适合对 Python 编程和 Zabbix 监控系统有一定基础的…...
SpringBoot基础系列学习(五):JdbcTemplate 访问数据库
文章目录 一丶介绍二丶引入依赖三丶配置配置文件四丶创建表五丶java代码 一丶介绍 Spring Boot作为Spring的集大成者,自然会将JdbcTemplate集成进去。Spring Boot针对JDBC的使用提供了对应的Starter包:spring-boot-starter-jdbc,它其实就是在…...
stm32G473的flash模式是单bank还是双bank?
今天突然有人stm32G473的flash模式是单bank还是双bank?由于时间太久,我真忘记了。搜搜发现,还真有人和我一样。见下面的链接:https://shequ.stmicroelectronics.cn/forum.php?modviewthread&tid644563 根据STM32G4系列参考手…...
el-switch文字内置
el-switch文字内置 效果 vue <div style"color:#ffffff;font-size:14px;float:left;margin-bottom:5px;margin-right:5px;">自动加载</div> <el-switch v-model"value" active-color"#3E99FB" inactive-color"#DCDFE6"…...
【JavaWeb】Docker项目部署
引言 之前学习了Linux操作系统的常见命令,在Linux上安装软件,以及如何在Linux上部署一个单体项目,大多数同学都会有相同的感受,那就是麻烦。 核心体现在三点: 命令太多了,记不住 软件安装包名字复杂&…...
CVE-2020-17519源码分析与漏洞复现(Flink 任意文件读取)
漏洞概览 漏洞名称:Apache Flink REST API 任意文件读取漏洞CVE编号:CVE-2020-17519CVSS评分:7.5影响版本:Apache Flink 1.11.0、1.11.1、1.11.2修复版本:≥ 1.11.3 或 ≥ 1.12.0漏洞类型:路径遍历&#x…...
Linux 内存管理实战精讲:核心原理与面试常考点全解析
Linux 内存管理实战精讲:核心原理与面试常考点全解析 Linux 内核内存管理是系统设计中最复杂但也最核心的模块之一。它不仅支撑着虚拟内存机制、物理内存分配、进程隔离与资源复用,还直接决定系统运行的性能与稳定性。无论你是嵌入式开发者、内核调试工…...
MySQL 知识小结(一)
一、my.cnf配置详解 我们知道安装MySQL有两种方式来安装咱们的MySQL数据库,分别是二进制安装编译数据库或者使用三方yum来进行安装,第三方yum的安装相对于二进制压缩包的安装更快捷,但是文件存放起来数据比较冗余,用二进制能够更好管理咱们M…...
GitHub 趋势日报 (2025年06月06日)
📊 由 TrendForge 系统生成 | 🌐 https://trendforge.devlive.org/ 🌐 本日报中的项目描述已自动翻译为中文 📈 今日获星趋势图 今日获星趋势图 590 cognee 551 onlook 399 project-based-learning 348 build-your-own-x 320 ne…...
代码规范和架构【立芯理论一】(2025.06.08)
1、代码规范的目标 代码简洁精炼、美观,可持续性好高效率高复用,可移植性好高内聚,低耦合没有冗余规范性,代码有规可循,可以看出自己当时的思考过程特殊排版,特殊语法,特殊指令,必须…...
省略号和可变参数模板
本文主要介绍如何展开可变参数的参数包 1.C语言的va_list展开可变参数 #include <iostream> #include <cstdarg>void printNumbers(int count, ...) {// 声明va_list类型的变量va_list args;// 使用va_start将可变参数写入变量argsva_start(args, count);for (in…...
小木的算法日记-多叉树的递归/层序遍历
🌲 从二叉树到森林:一文彻底搞懂多叉树遍历的艺术 🚀 引言 你好,未来的算法大神! 在数据结构的世界里,“树”无疑是最核心、最迷人的概念之一。我们中的大多数人都是从 二叉树 开始入门的,它…...




















































