html - 输入内的按钮 (HTML/CSS)
问题描述
我希望我的按钮位于文本输入中。像这样:
这是我的代码:
input {
background: #8196aa;
border: 0;
border-radius: 10px;
color: white;
padding: 20px;
&:focus {
outline: none;
}
&::placeholder {
color: white;
}
}
button {
background: #16bdae;
border: 0;
border-radius: 7px;
color: white;
padding: 15px;
}
<div class="pt-site-footer__submit">
<input type="email" placeholder="Your e-mailadress">
<button>LOGIN</button>
</div>
我希望有人对此有答案。(Stack Overflow 上的其他答案对我没有帮助)
解决方案
* {
box-sizing: border-box;
}
input {
background: #8196aa;
border: 0;
border-radius: 10px;
color: white;
padding: 20px;
width: 100%;
}
input:focus {
outline: none;
}
input::placeholder {
color: white;
}
button {
background: #16bdae;
border: 0;
border-radius: 7px;
color: white;
padding: 15px;
position: absolute;
right: 5px;
top: 5px;
}
.pt-site-footer__submit {
position: relative;
display: inline-block;
width: 50%;
}
<div class="pt-site-footer__submit">
<input type="email" placeholder="Your e-mailadress" />
<button>LOGIN</button>
</div>
推荐阅读
- file - FBX - 在 FBX 文件中,我应该使用哪些数据来构建模型的骨架并为其设置动画?
- php - 为什么带有 mysqli 的 PHP 7.4 只能在根目录中运行?
- php - 带有 wordpress 简码属性的正则表达式
- c# - 使用 c# 从 cmd 运行多个命令
- javascript - 使用 Django 表单的 pk/id 更新 Bootstrap 模态体
- javascript - 你如何每隔一定时间不断刷新一个反应组件
- objective-c - 为什么在为我编写的程序执行 AppleScript 时出现错误 -1708?
- python - 将 parquet 转换后的数据帧写入 adls 区域 1
- quarkus - 在 Apple Silicon 上编译 quarkus 原生镜像的问题
- javascript - 如何在鼠标悬停时更改按钮上的文本?