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

css蓝桥杯--电影院排座位

目录

  • 一、介绍
  • 二、准备
  • 三、⽬标
  • 四、代码
  • 五、知识点
  • 六、完成


一、介绍

随着⼈们⽣活⽔平的⽇益提升,电影院成为了越来越多的⼈休闲娱乐,周末放松的好去处。各个城市的电影院数量也随着市场的需求逐年攀升。近⽇,⼜有⼀个电影院正在做着开张前期的准备,⼩蓝作为设计⼯程师,需要对电影院的座位进⾏布局设计。
本题需要在已提供的基础项⽬中,使⽤ CSS 完成⻚⾯中电影院座位布局。

二、准备

开始答题前,需要先打开本题的项⽬代码⽂件夹⽬录结构如下:

├── css
│ └── style.css
└── index.html

其中:

  • index.html 是主⻚⾯。
  • css/style.css 是需要补充样式的⽂件。

在浏览器中预览 index.html ,显示如下所示:
在这里插入图片描述

三、⽬标

请在 css/style.css ⽂件中的 TODO 下补全样式代码,最终达到预期布局效果,需要注意:

  1. 座位区域和荧幕间隔 50px。
  2. 座位区域每⼀⾏包含 8 个座位。
  3. 第 2 列和第 6 列旁边都是⾛廊,需要和下⼀列间隔 30px,其他列都只需要间隔 10px。

完成后的效果如下:

在这里插入图片描述

四、代码

index.html

<!DOCTYPE html>
<html lang="zh-CN"><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>电影院排座位</title><link rel="stylesheet" href="./css/style.css" /></head><body><div class="container"><!-- 荧幕区域 --><div class="screen">阿凡达2</div><!-- 座位区域 --><div class="seat-area"><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div><div class="seat"></div></div></div></body>
</html>

css/style.css

* {box-sizing: border-box;
}body {background-color: #242333;color: #fff;display: flex;flex-direction: column;align-items: center;justify-content: center;height: 100vh;margin: 0;
}.container {perspective: 1000px;width: 470px;
}.screen {background-color: #fff;height: 70px;width: 100%;transform: rotateX(-45deg);box-shadow: 0 3px 10px rgba(255, 255, 255, 0.7);color: #242333;text-align: center;line-height: 70px;font-size: 30px;
}.seat {background-color: #444451;height: 40px;width: 45px;border-top-left-radius: 10px;border-top-right-radius: 10px;
}/* TODO:待补充代码 */

五、知识点

使用:nth-child(an)时,n虽然可以是等于0,1,2,3… 但是nth-child没有0号元素 只有1号元素,故an的实际值为 a 2a 3a 而不是0 a 2a 3a

六、完成

/* 作为区域和屏幕间隔50px  */
.screen{margin-bottom: 50px;
}/* 将座位变为flex布局且换行 */
.seat-area{display: flex;flex-wrap: wrap;
}
/* 让每个座位距离右边10px */
.seat{margin-right: 10px;/* 下面这一行代码题目没要求写 但是如果写了感觉更符合效果图 */margin-bottom:10px  
}
/* 让第二列和第六列距离右边30px  ---》会覆盖10px */
.seat:nth-child(8n+2),
.seat:nth-child(8n+6){margin-right: 30px;
}
/* 让最后一列距离右边为0 */
.seat:nth-child(8n){margin-right: 0px;
}
http://www.lryc.cn/news/92232.html

相关文章:

  • c++学习——多态
  • Java SPI机制及原理详解
  • 不压缩打包layui
  • 过去、现在及未来
  • leetcode701. 二叉搜索树中的插入操作(java)
  • Docker的容器管理操作
  • 计算机组成原理——中央处理器
  • tidb变更大小写敏感问题的总结
  • 法规标准-UN R158标准解读
  • 160个CrackMe之002
  • 3. 响应状态码及Response对象的status_code属性
  • MIME 类型列表 03
  • SpringBoot项目登录并接入MFA二次认证
  • 算法与数据结构(三)
  • 亚马逊云科技出海日,让数字经济出海扩展到更多行业和领域
  • Pb协议的接口测试
  • 2. 分布式文件系统 HDFS
  • 借助金融科技差异化发展,不一样的“破茧”手法
  • typescript中type、interface的区别
  • Ingress详解
  • 【递归算法的Java实现及其应用】
  • 2023年度第四届全国大学生算法设计与编程挑战赛(春季赛)
  • 如何用PHP获取各大电商平台的数据
  • 一站式完成车牌识别任务:从模型优化到端侧部署
  • Linux4.8Nginx Rewrite
  • DHT11温湿度传感器
  • RestTemplate超简单上手
  • 监控系统设计原则及实现目标
  • VulnHub项目:MONEYHEIST: CATCH US IF YOU CAN
  • 对象存储OSS简介,一分钟了解对象存储OSS