静态QQ登录代码学习

news/2024/10/1 23:22:45

记录学习 @搬砖界泰斗这只小狐狸 的静态QQ登陆页面源码,了解静态登陆页面如何书写&&拓宽自己对css的理解

Q1:用css调节子级元素位置时什么时候调节margin,什么时候调节padding?

A1:margin对外,padding对内

e.g.要实现一个这样的排版

有一个大大盒子fafather,里面其中一个是大盒子father,再有两个小盒子,son-img&&son-p

<!DOCTYPE html>
<html lang="ch">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>演示文案1</title><link rel="stylesheet" href="./登录.css">
</head>
<body><div class="fafather"><div class="father"><div class="son-img">img</div><div class="son-p">p</div></div><div class="other"></div></div>
</body>
</html>
  • 整体位置在页面的左上角距离左边70px
    img
    无脑调节father的margin【调节father在上级fafather里的位置】
*{margin: 0;padding: 0;box-sizing: border-box;
}
body {background-color: aqua;
}
.fafather {float: left;background-color: antiquewhite;width: 100%;height: 100px;
}
.father{margin: 0 70px;float: left;width: 33%;height: 100px;background-color: azure;}
.other{float: right;margin: 0 5px;width: 50%;height: 100px;background-color: black;
}
.son-img{float: left;height: 100px;width: 100px;background-color: rgb(94, 94, 194);}
.son-p{/* float: right; */background-color: rgb(44, 196, 166);height: 100%;/* width: 300px; */
}
  • son-img和son-p之间距离存在距离
    也别调节什么padding margin了,直接用float-left,float-right绝绝子
    img
*{margin: 0;padding: 0;box-sizing: border-box;
}
body {background-color: aqua;
}
.fafather {float: left;background-color: antiquewhite;width: 100%;height: 100px;
}
.father{margin: 0 70px;float: left;width: 33%;height: 100px;background-color: azure;}
.other{float: right;margin: 0 5px;width: 50%;height: 100px;background-color: black;
}
.son-img{float: left;height: 100px;width: 100px;background-color: rgb(94, 94, 194);}
.son-p{float: right;background-color: rgb(44, 196, 166);height: 100%;width: 300px;
}

CNCLD1:基本上跨级用margin,同级用float-X属性

p.s.一次性调节上下左右,之间用空格隔开【上 右 下 左,上 左右 下,上下 左右】
我靠,感觉自己会布局了!
然而并没有,我要有>2个元素水平放怎么办?
还是用flex布局

float用于2个盒子排布,flex更flex哈哈哈

img

<!DOCTYPE html>
<html lang="ch">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>演示文案1</title><link rel="stylesheet" href="./登录.css">
</head>
<body><div class="fafather"><div class="father"><div class="son-img">img</div><div class="son-p1">p</div><div class="son-p2">p</div><div class="son-p3">p</div></div><div class="other"></div><div class="another"></div><div class="others"></div></div>
</body>
</html>
*{margin: 0;padding: 0;box-sizing: border-box;
}
body {background-color: aqua;
}
.fafather {/* float: left; */background-color: antiquewhite;width: 100%;height: 100px;display: flex;flex-direction: row;
}
P{display:block;
}
.father{margin: 0 70px;/* float: left; */width: 33%;/* height: 100px; */background-color: azure;display: flex;flex-direction: row;
}.other{/* float: right; */margin: 0 5px;width: 50%;/* height: 100px; */background-color: black;}
.another{/* float: right; */margin: 0 5px;width: 50%;/* height: 100px; */background-color: black;}
.others{/* float: right; */margin: 0 5px;width: 50%;/* height: 100px; */background-color: black;}
.son-img{
width: 25%;
background-color: rgba(217, 74, 74, 0.576);
}
.son-p1{
width: 25%;
background-color: cadetblue;
}
.son-p2{
width: 25%;
background-color: rgb(18, 223, 230);
}
.son-p3{
width: 25%;
background-color: cadetblue;
}

float就图一乐,还是flexyyds

Q2:怎么调节图片透明度?

A2:

opacity: 0.8;
/* 0[全透明]--1【完全不透明,默认】 */

美中不足

因为文字和图片在同一个层级(即它们的父元素没有设置背景)。当你调节图片的透明度时,文字会受到影响,因为它们都是在同一个上下文中绘制的。

improvement

  • 使用绝对定位:将文字放在图片上方,确保它们在不同的层级。
    牺牲图片里有文字效果
  • 使用背景图:将图片设置为元素的背景,而不是作为 标签,这样你可以独立控制透明度
    图片有盒子大小要求
.container {background-image: url('image.jpg');background-size: cover;opacity: 0.5; /* 背景透明 */color: black; /* 文字不透明 */
}
  • 使用伪元素:使用 ::before 或 ::after 伪元素为容器添加背景图片。
    然并卵,没人鸟我,先搁置

Q3:怎么使得图片和文字一行对齐?

A3:使用vertical-align: baseline;

我觉得我可以搞一个登陆页面了好好好,开做!
[今天晚了,先去构思,明天再实现哈哈哈]

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈,一经查实,立即删除!

相关文章

帝国CMS后台登陆时错误_enewsloginfail

当你在迁移帝国CMS网站后,遇到后台登录时出现“Table phome.***_enewsloginfail doesnt exist”的错误时,通常是因为数据库没有正确恢复。以下是详细的解决步骤: 1. 检查数据库恢复情况登录数据库管理工具:使用 phpMyAdmin 或其他数据库管理工具登录到数据库。检查数据库表…

解决 DedeCMS 报错“Please set ‘request_order’”的问题

如果你使用的是虚拟主机,无法直接修改 php.ini 文件,可以通过修改 DedeCMS 的代码来解决这个问题。找到 common.inc.php 文件:打开织梦CMS安装目录下的 include/common.inc.php 文件。修改代码:使用文本编辑器打开 common.inc.php 文件。找到第 34 行:phpif (strtoupper(i…

织梦错误Please set ‘request_order’

当你在使用 DedeCMS 并遇到错误提示“DedeCMS Error: (PHP 5.3 and above) Please set ‘request_order’ ini value to include C,G and P (recommended: ‘CGP’) in php.ini, more…”时,可以通过以下两种方法来解决这个问题: 方法 1:修改 php.ini 文件找到 php.ini 文件…

PbootCMS管理员密码忘记怎么办?pboot重置密码

1. PbootCMS 后台访问地址和初始密码后台访问地址:plaintexthttp://www.domain.com/admin.php将 www.domain.com 替换为你的实际域名。初始账号和密码:账号:admin 初始密码:1234562. 快速部署到本地或服务器 本地部署使用 PHPStudy:安装 PHPStudy 并按照官方文档搭建环境。…

织梦CMS后台登录验证码如何取消?

如果你想取消织梦CMS后台登录时的验证码,可以通过以下步骤进行操作: 1. 下载并编辑 inc_safe_config.php 文件下载文件:使用 FTP 客户端连接到服务器。 导航到网站根目录下的 DATA 文件夹。 找到 safe/inc_safe_config.php 文件并下载到本地。编辑文件:使用文本编辑器(如 …

执行SQL发生错误!错误:disk I/O error

当 PbootCMS 网站程序提示“执行 SQL 发生错误!错误:disk I/O error”时,通常是由于磁盘 I/O 错误导致的。这可能是由于磁盘空间不足或其他磁盘问题引起的。以下是一些详细的排查和解决步骤: 1. 检查磁盘空间登录服务器:使用 SSH 登录到服务器。检查磁盘空间:运行 df -h …

PbootCMS缓存runtime能删除吗?空间满了怎么办?

PbootCMS 缓存文件夹 runtime 的处理方法 1. runtime 文件夹可以删除吗?可以删除:runtime 文件夹中的缓存文件是可以随意删除的,不会影响网站的功能。 建议定期清理:定期清理缓存文件有助于释放空间,提高系统性能。2. 删除方法后台清理:登录 PbootCMS 后台。 点击右上角的…

flink 1.18.1编译问题处理

编译命令: mvn clean install -DskipTests -Dspotless.check.skip=true -Drat.skip=true -P release flink-runtime-web 编译报错 无法下载node、npm 问题: [ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.11.0:install-node-and-npm (install…