html - 将按钮放在父 div 的右下角,而不是页面
问题描述
我不知道如何在父 div 的右下角放置一个按钮。我找到的解决方案适用于页面的角落,这不是我需要的。你能帮忙吗?
.tile {
background-color: grey;
width: 200px;
height: 200px;
}
.my_img {
position: absolute;
right: 0;
bottom: 0;
}
<div class="tile">
<p>some text</p>
<button class="my_img">My Button</button>
</div>
解决方案
只需设置position:relative
为类图块
.tile {
background-color: grey;
width: 200px;
height: 200px;
position:relative;
}
.my_img {
position: absolute;
right: 0;
bottom: 0;
}
<div class="tile">
<p>some text</p>
<button class="my_img">My Button</button>
</div>
推荐阅读
- reactjs - React - 相当于 Angular 模板引用变量?
- elasticsearch - 具有 1000 多个字段的 Elasticsearch 映射
- spring - 容器中的 Spring EurekaClient 无法注册到 localhost 上的 EurekaServer 或 docker 容器中的 EurekaServer
- ruby-on-rails - 为 rails api 放置 css 样式表
- shipping - Magento 产品特定运费税
- html - Angular 4 - 指令中的事件侦听器不起作用
- html - HTML5 iframe 不会显示 url 源图像
- javascript - 为什么解析这些代码点会导致多个字符
- azure - 在动态创建的 Web 应用服务中添加自定义域
- gdb - 如果我只有一个共享库,如何在核心转储中获取符号?