web方向第一次考核内容

一.考核内容

Web组大一下考核之HTML、CSS
1.为什么要清除浮动(4),清除浮动的方法有哪些?(6)(至少两种)
2.怎么实现左边左边宽度固定右边宽度自适应的布局?(10)
3.讲讲flex:1;(10)
4.怎么实现移动端适配不同设备?(10)
5.制作页面
在这里插入图片描述
6.在这里插入图片描述
7.
在这里插入图片描述

8.在这里插入图片描述

二. 考核后的总结

1.

在网页的布局里,浮动常常使用,当父元素不直接设置高度,需要里面的子元素撑开时,子元素都设置了浮动脱离了标准流,会导致父元素没有高度,使得之后的标准流盒子影响整体的布局。
清除浮动的方法:

  • 最常用的方法是使用伪元素清除浮动,思想就是设置一个正常流的盒子,让该正常流的盒子撑开父盒子,避免之后的正常流盒子影响布局。

clearfix清除浮动

.clearfix:after{content:"";display:“block";height: 0px;clear:both;visibility: hidden;
}
  • 父元素触发 BFC:通过设置 overflow: hidden 或 overflow: auto 让父元素形成 BFC(块级格式化上下文),从而包裹浮动元素。有哪些属性可以激活bfc:浮动元素,定位元素(除了absolute,fixed),display:inline-block,overflow:hidden(只要不是visible)

2.

  • 使用flex布局,假设左右两个盒子排在一行,左边固定,右边的盒子给他添加flex:1属性,实现自适应的效果。
  • 使用overflow:hidden,给右边的盒子添加这一属性,让该盒子自己处于独立的渲染模式下(不设置宽度),左边的盒子设置了固定的宽度。
  • 使用margin-left:左边的盒子宽度,给右盒子添加浮动属性,使他们一行排列,则可以实现右边宽度自适应的效果。
    相应的dom结构
<div class="box1"></div>
<div class="box2"></div>
.box1 {float: left;width: 200px;height: 200px;background-color: pink;}.box2 {margin-left: 200px;height: 200px;background-color: purple;}

3.

flex:1是flex布局中的一个属性设置,如果大容器的每一个盒子都设置了这一个属性,则每一个盒子会平均分配大盒子的剩余宽度。
.container {
display: flex;
}
.item {
/* 所有子元素平分容器宽度 */
flex: 1;
}

4.

  • REM 适配

通过媒体查询动态设置根字体大小(基于设计稿宽度,如 750px),引入flexible.js外部文件,动态处理rem的大小。

  • Flexible 布局 + 媒体查询

使用 Flexbox 实现弹性布局。

针对不同屏幕尺寸设置媒体查询调整样式:

css
@media (max-width: 600px) {
body { font-size: 14px; }
}

  • VW/VH 单位

直接使用视口单位(1vw = 1% 视口宽度,也可以用vmin以视口宽高较小的一个为准)

  • 也可以使用bootstrap框架,栅栏式布局在四种屏幕宽度条件下搭配上媒体查询在屏幕缩放的过程中改变页面布局。

5.

  1. 页面分为头部,内容,尾部,头部和内容都可以使用flex布局,头部设置justify-content:space-between属性占据左右两部分。
  2. 内容可以给中间的盒子设置margin值,给每一个子盒子设置flex:1实现三栏布局。
    在这里插入图片描述

6.

  1. 这个要注意的是设置一个只能显示一个数字大小的外部盒子,套一个大的子盒子,根据子绝父相定位子盒子,设置一个动画改变它的top值。
<div class="box"><div class="contain"><div>0</div><div>1</div><div>2</div><div>3</div><div>4</div><div>5</div><div>6</div><div>7</div><div>8</div><div>9</div></div></div>
* {box-sizing: border-box;}.box {position: relative;display: inline-block;width: 30px;height: 50px;background-color: green;border-radius: 5px;overflow: hidden;}@keyframes move {from {top: 0;}to {top: -460px;}}.contain {position: absolute;top: 0;left: 0;width: 30px;height: 500px;margin: 0 auto;border-radius: 5px;font-size: 16px;text-wrap: wrap;text-align: center;animation: move 4s ease-in-out infinite alternate backwards;}.contain div {width: 100%;height: 50px;line-height: 50px;}.contain div:last-child {width: 100%;height: 25px;}

7.

这里的动画设置分为三部分,也就是三个关键帧,设置scaleY属性实现竖直方向的伸缩。

<div class="radio"><span></span><span></span><span></span><span></span><span></span><span></span><span></span> </div>
.radio {position: absolute;top: 0px;bottom: 0px;left: 0px;right: 0px;margin: auto;width: 175px;height: 100px;}.radio span {display: block;background: orange;width: 7px;height: 100%;border-radius: 14px;margin-right: 5px;float: left;}.radio span:nth-child(1) {animation: load 2.5s 1.4s infinite linear;}.radio span:nth-child(2) {animation: load 2.5s 1.2s infinite linear;}.radio span:nth-child(3) {animation: load 2.5s 1s infinite linear;}.radio span:nth-child(4) {animation: load 2.5s 0.8s infinite linear;}.radio span:nth-child(5) {animation: load 2.5s 0.6s infinite linear;}.radio span:nth-child(6) {animation: load 2.5s 0.4s infinite linear;}.radio span:nth-child(7) {animation: load 2.5s 0.2s infinite linear;}@keyframes load {0% {transform: scaleY(1);}50% {transform: scaleY(0.08);}100% {transform: scaleY(1);}}

8.

爱心怦怦跳

这个爱心的实现中每个线条是依次变长的,因此线条的开始的时间是不同的要设置延迟属性,这个爱心是对称形状的,因此对称线条的动画是相同的,只需要设置5个动画。
这里动画设置的点是关键帧可以简写,确保动画变完之后可以维持一段时间的状态等待之后的线条变化。

<div class="rad">爱心怦怦跳</div><div class="contain"><div class="space"></div><div class="space"></div><div class="space"></div><div class="space"></div><div class="space"></div><div class="space"></div><div class="space"></div><div class="space"></div><div class="space"></div></div>
body {height: 100vh;display: flex;justify-content: center;align-items: center;background-color: #000;}.rad {position: absolute;top: 60px;left: 50%;transform: translate(-50%, 0);text-align: center;line-height: 100px;font-weight: 600;font-size: 60px;color: transparent;background-clip: text;background-image: linear-gradient(to right, #ff8177 0%, #ff867a 0%, #ff8c7f 21%, #f99185 52%, #cf556c 78%, #b12a5b 100%);}.contain {position: absolute;top: 300px;display: flex;height: 200px;}.contain .space {flex: 1;margin: 0 12px;width: 20px;height: 20px;border-radius: 10px;}.contain .space:nth-child(1) {background-color: orange;animation: move1 5s infinite 0s linear;}.contain .space:nth-child(2) {background-color: skyblue;animation: move2 5s infinite .2s linear;}.contain .space:nth-child(3) {background-color: #bc3a3a;animation: move3 5s infinite .4s linear;}.contain .space:nth-child(4) {background-color: lightpink;animation: move4 5s infinite .6s linear;}.contain .space:nth-child(5) {background-color: yellow;animation: move5 5s infinite .8s linear;}.contain .space:nth-child(6) {background-color: lightpink;animation: move4 5s infinite 1.0s linear;}.contain .space:nth-child(7) {background-color: #bc3a3a;animation: move3 5s infinite 1.2s linear;}.contain .space:nth-child(8) {background-color: skyblue;animation: move2 5s infinite 1.4s linear;}.contain .space:nth-child(9) {background-color: orange;animation: move1 5s infinite 1.6s linear;}@keyframes move1 {30%,60% {height: 60px;transform: translateY(-30px);}80%,100% {height: 20px;transform: translateY(0);}}@keyframes move2 {30%,60% {height: 125px;transform: translateY(-60px);}80%,100% {height: 20px;transform: translateY(0);}}@keyframes move3 {30%,60% {height: 160px;transform: translateY(-75px);}80%,100% {height: 20px;transform: translateY(0);}}@keyframes move4 {30%,60% {height: 180px;transform: translateY(-60px);}80%,100% {height: 20px;transform: translateY(0);}}@keyframes move5 {30%,60% {height: 200px;transform: translateY(-45px);}80%,100% {height: 20px;transform: translateY(0);}}

相应的渲染效果

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.pswp.cn/news/909405.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

HarmonyOS 5 Cordova有哪些热门插件?

以下是 HarmonyOS 5 环境下 Cordova 的热门插件及核心代码实现&#xff08;综合实际开发场景高频使用&#xff09;&#xff1a; 一、核心工具类插件 1. ‌高性能图片压缩插件‌ ‌功能‌&#xff1a;直接调用鸿蒙 ImageSource API 实现硬件级加速压缩 ‌代码实现‌&#xff…

Cesium圆锥渐变色实现:融合顶点着色器、Canvas动态贴图与静态纹理的多方案整合

在Cesium中渲染圆锥体时&#xff0c;无论采用顶点着色器、Canvas动态贴图还是静态图片贴图&#xff0c;其渐变色均需满足以下条件&#xff1a; 圆形结构&#xff1a;渐变范围限定在圆锥底面的圆形区域内。径向扩散&#xff1a;颜色从圆心向外逐步变化&#xff08;如红→黄→蓝…

周末复习1

质量管理包括质量规划&#xff0c;质量保证&#xff0c;质量控制。质量管理体系要定期执行内部审核和管理评审。二者都属于质量保证过程。 实施质量保证的方法很多&#xff0c;过程分析属于实施质量保证的常用方法。 采购管理过程包括编制采购计划,实施采购,控制采购和结束采购…

英飞凌亮相SEMICON China 2025:以SiC、GaN技术引领低碳化与数字化未来

在刚刚落幕的SEMICON China 2025上&#xff0c;全球半导体行业再度汇聚上海&#xff0c;共同探讨产业未来。本届展会以“跨界全球•心芯相联”为主题&#xff0c;覆盖芯片设计、制造、封测、设备及材料等全产业链&#xff0c;充分展现了半导体技术的最新突破与创新趋势。 作为…

工业路由器赋能仓库消防预警,智慧消防物联网解决方案

在现代物流与仓储行业蓬勃发展的当下&#xff0c;仓库的规模与存储密度不断攀升&#xff0c;消防预警的重要性愈发凸显。传统消防系统在应对复杂仓库环境时&#xff0c;预警滞后、设备联动不畅、数据管理困难等弊端逐渐暴露。为了有效解决这些问题&#xff0c;工业路由器作为物…

【开发常用命令】:服务器与本地之间的数据传输

服务器与本地之间的数据传输 本地给服务器上传数据 scp /path/to/local_file usernameremotehost:/path/to/remote_directory例如 scp test.txt root192.168.1.xxx:/test # test.txt 需要上传到服务器的文件&#xff0c;如果非当前路径&#xff0c;使用文件的相对路径或绝对…

springboot + nacos + k8s 优雅停机

1 概念 优雅停机是什么&#xff1f;网上说的优雅下线、无损下线&#xff0c;都是一个意思。 优雅停机&#xff0c;通常是指在设备、系统或应用程序中止运作前&#xff0c;先执行一定的流程或动作&#xff0c;以确保数据的安全、预防错误并保证系统的整体稳定。 一般来说&…

Python 标准库之 math 模块

1. 前言 math 模块中包含了各种浮点运算函数&#xff0c;包括&#xff1a; 函数功能floor向下取整ceil向上取整pow指数运算fabs绝对值sqrt开平方modf拆分小数和整数fsum计算列表中所有元素的累加和copysign复制符号pi圆周率e自然对数 2. math.floor(n) 函数 math.floor(n) 的…

6.14星期六休息一天

Hey guys, Today’s Saturday, and I didn’t have to go to work, so I let myself sleep in a bit — didn’t get up until 8 a.m. My cousin invited me over to his place. He lives in a nearby city, about 80 kilometers away. But honestly, after a long week, I …

event.target 详解:理解事件目标对象

event.target 详解&#xff1a;理解事件目标对象 在 JavaScript 事件处理中&#xff0c;event.target 是一个关键属性&#xff0c;它表示最初触发事件的 DOM 元素。下面我将通过一个可视化示例详细解释其工作原理和使用场景。 <!DOCTYPE html> <html lang"zh-C…

Flutter 小技巧之:实现 iOS 26 的 “液态玻璃”

随着 iOS 26 发布&#xff0c;「液态玻璃」无疑是热度最高的标签&#xff0c;不仅仅是因为设计风格大变&#xff0c;更是因为 iOS 26 beta1 的各种 bug 带来的毛坯感让 iOS 26 冲上热搜&#xff0c;比如通知中心和控制中心看起来就像是一个半成品&#xff1a; 当然&#xff0c;…

Android工程中FTP加密传输与非加密传输的深度解析

详细的FTP传输实现方案&#xff0c;包括完整代码、安全实践、性能优化和实际应用场景分析。 一、FTP传输类型对比表&#xff08;增强版&#xff09; 特性非加密FTPFTPS (FTP over SSL/TLS)SFTP (SSH File Transfer Protocol)协议基础FTP (RFC 959)FTP SSL/TLS (RFC 4217)SSH…

C# 枚 举(枚举)

枚举 枚举是由程序员定义的类型&#xff0c;与类或结构一样。 与结构一样&#xff0c;枚举是值类型&#xff1a;因此直接存储它们的数据&#xff0c;而不是分开存储成引用和数据。枚举只有一种类型的成员&#xff1a;命名的整数值常量。 下面的代码展示了一个示例&#xff0c…

一文详解前缀和:从一维到二维的高效算法应用

文章目录 一、一维前缀和​1. 基本概念​2. C 代码实现​3. 应用场景​ 二、二维前缀和1. 基本概念​2. C 代码实现​3. 应用场景​ 三、总结​ 在算法竞赛和日常的数据处理工作中&#xff0c;前缀和是一种极其重要的预处理技术。它能够在常数时间内回答多次区间查询&#xff0…

windows 开发

文章目录 环境搭建数据库关键修改说明&#xff1a;在代码中使用该连接字符串&#xff1a;注意事项&#xff1a;实际使用 都说几天创造一个奇迹&#xff0c;现在是真的这样了&#xff0c;Just do it! 环境搭建 数据库 需要下载这个SQL Server数据库&#xff0c;然后每次Visua…

免费OCPP协议测试工具

免费OCPP 1.6J协议测试工具&#xff0c;简单实用。除加密功能外&#xff08;后续版本支持&#xff09;&#xff0c;支持所有消息调试。 后续将添加2.01和和2.1协议支持. 欢迎使用 Charge-Test

高等数学基础(行列式和矩阵的秩)

行列式主要用于判断矩阵是否可逆及计算特征方程 初见行列式 行列式起源于线性方程组求解 { a 11 x 1 a 12 x 2 b 1 a 21 x 1 a 22 x 2 b 2 \begin{cases} a_{11}x_1 a_{12}x_2 b_1 \\ a_{21}x_1 a_{22}x_2 b_2 \end{cases} {a11​x1​a12​x2​b1​a21​x1​a22​x2…

开心灿烂go开发面试题

1.给你单链表的头节点 head &#xff0c;请你反转链表&#xff0c;并返回反转后的链表。 示例1: 输入&#xff1a;head [1,2,3,4,5] 输出&#xff1a;[5,4,3,2,1] package main import “fmt” type ListNode struct { Val int Next *ListNode } func main() { l1 : &…

【Flutter】程序报错导致的灰屏总结

【Flutter】程序报错导致的灰屏总结 一、前言 在 Flutter 中&#xff0c;出现“灰屏”&#xff08;grey screen&#xff09;通常意味着 应用发生了未捕获的错误&#xff0c;导致框架无法正确构建 UI。 这也是在面试过程中常常问到的。 二、错误分类 常见的会导致灰屏的错误…

基于物联网设计的智慧家庭健康医疗系统

1. 项目开发背景 随着物联网&#xff08;IoT&#xff09;技术的发展&#xff0c;智能家居系统逐渐融入到我们的日常生活中&#xff0c;成为提高生活质量、增强家庭安全、提升健康管理的重要工具。特别是在健康医疗领域&#xff0c;借助物联网技术&#xff0c;智能家居不仅能够…