html - 如何在div中将垂直对齐设置为响应中心
问题描述
我如何在 .prev 和 .next 中垂直居中 .arrow 并响应 .mySlides 的高度,因为它会根据内容而变化。我试过调整位置、顶部、变换、顶部边距、线高,但无法得到我想要的结果。这是完整的代码:https ://jsfiddle.net/t8ap0gvz/4/
.prev {
grid-area: 1 / 1 / 4 / 1;
color: white;
font-weight: bold;
font-size: 40px;
opacity: 0.5;
background: yellow;
border-radius: 15px 0 0 15px;
border: 1px solid red;
left: 10%;
position:relatve
}
.next {
grid-area: 4 / 4 / 1 / 3;
color: white;
font-weight: bold;
font-size: 40px;
opacity: 0.5;
background: yellow;
border-radius: 0 15px 15px 0;
border: 1px solid red;
position:relatve
}
.arrow {
transform: translateY(-50%);
}
解决方案
推荐阅读
- javascript - 尝试通过 Javascript 验证表单,但代码无法正常工作
- django - 如何使用 django 和 jquery 为所有帖子创建一个赞按钮?
- c# - 即使屏幕不活动,如何在睡眠模式下运行循环方法?
- python - 如何在特定列中找到最大值并在我的数据框的另一列中返回相应的值?
- node.js - Express 中间件未按正确顺序执行
- processing - 处理 - 如何加载 .txt 文件并绘制 2d 形状?
- ios - ios NSLayoutConstraint activate 不会立即在 UICollectionViewCell 内应用
- c++ - 快速傅立叶变换:即使标头和 .cpp 文件匹配,也使用模板派生类“未定义引用”错误
- python - 如何处理字典列表中的特定值
- woocommerce - 存档页面的页面描述仅显示在第一页