css - 你如何阻止我的 :after 元素扩展屏幕?
问题描述
所以我试图在我的网页上设计一个英雄背景,它有三个相邻的倾斜颜色。但是,我遇到了这个问题,页面被水平扩展并在底部添加了一个滚动条。这是我的代码:
.container-slant {
overflow: hidden;
width: 100%;
background-color: rgb(246, 234, 212);
min-height: 100vh;
}
.container-slant:before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 20%;
transform: skew(-10deg);
background: #fcb525;
transform-origin: top;
}
.container-slant:after {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 20%;
transform: skew(-10deg);
background: #f9ad87;
transform-origin: bottom;
}
解决方案
推荐阅读
- android - 在 Canvas Android 上绘制 MapView
- javascript - 使用 useCallback 钩子的正确方法是什么?
- ssl - 错误代码:SEC_ERROR_BAD_SIGNATURE 在 Tomcat 上安装了 SSL 证书
- c# - 如何为 C# 项目生成 .tlh 文件
- php - 如果条件适用,Haversine 公式 PHP 将添加到第二个表中
- android - Seekbar - 在拇指上方对齐值标签
- javascript - 计划的 Cloud Function 内的 HTTP POST 请求不起作用
- json - 为什么我无法使用 SQL 访问 JSON 的子节点?
- r - 简单的 R Shiny App 选择具有特定单词的文档
- python - 带有对象子参数的函数的类型提示不接受子类