html - 悬停时展开向下按钮
问题描述
我有简单的扩展按钮。它向上扩展,但我希望它向下扩展。我正在尝试对位置做一些事情,但是如果没有 js 和动画,我无法做到。
.outer-bottomleft {
position: absolute;
bottom: 20%;
left: 2%;
display: flex;
color: black;
flex-direction: row;
}
.outer-bottomleft .bottomleft {
display: none;
}
.outer-bottomleft:hover .bottomleft {
display: flex;
}
.outer-bottomleft:hover .hide-button {
display: none;
}
.shop-button-left {
width: 50%;
}
.shop-button-right {
width: 50%;
}
<div class ="outer-bottomleft"> <span class ="hide-button btn-shop">SHOP
</span>
<div class="bottomleft"> <div class = "shop-button-left">
NEW FLAVOR:
SHOP
</div>
<div class = "shop-button-right">
<a href="#">
Test
</a>
</div>
</div>
</div>
解决方案
按照您的设置方式,您.outer-bottomleft
将永远20%
远离bottom
.
一个临时的解决方案是给予.hide-button.btn-shop
和财产.bottomleft
position: absolute
.outer-bottomleft {
position: absolute;
bottom: 20%;
left: 2%;
display: flex;
color: black;
flex-direction: row;
}
.outer-bottomleft .bottomleft {
display: none;
}
.outer-bottomleft:hover .bottomleft {
display: flex;
}
.outer-bottomleft:hover .hide-button {
display: none;
}
.shop-button-left {
width: 50%;
}
.shop-button-right {
width: 50%;
}
.hide-button.btn-shop,
.bottomleft {
position: absolute;
}
<div class="outer-bottomleft"> <span class="hide-button btn-shop">SHOP
</span>
<div class="bottomleft">
<div class="shop-button-left">
NEW FLAVOR: SHOP
</div>
<div class="shop-button-right">
<a href="#">
Test
</a>
</div>
</div>
</div>
推荐阅读
- java - 如何在测试代码中测试 Hibernate 对象相等性?
- verilog - 即使语法看起来正确,简单的代码也会产生错误(ISE VERILOG)
- java - 当我尝试在 Eclipse 控制台上打印 Hello World 时,什么都没有打印
- google-apps-script - IMPORTHTML 一段时间后返回 N/A,有解决方法吗?
- c++ - C++20 概念之谜 boolean-testable
- python-3.x - 将一系列熊猫数据框合并为单个数据框
- c# - 如何让玩家在统一 2d 中停止无限跳跃
- python-3.x - Visual Studio 代码调试
- django - 保存前检查重复对象
- promise - Figma Plugin - 帮助以编程方式创建文本样式