html - css 中的比例重叠

标签 html css

我在我的网站上遇到问题我正在尝试将我的底部文本框和提交按钮设置为这样的样式

#chat-box-div-submit{
position:fixed;
bottom:5;
right:5px;
margin:10px;
height:30px;
background:darkcyan;
width:70px;
outline: none;
}
#chat-box-div-txtinpt{
width:65%;
left:305px;
min-width:100px;
position:fixed;
bottom:5;
margin:10px;
outline-color: darkcyan;
}
.submit{
background:darkcyan;
border:0;
border-radius:4px;
}
.big-txtinpt{
height:30px;
background: transparent;
border-radius:4px;
border:2px solid darkcyan;
color:darkcyan;
}

我把它带到了在某些计算机上看起来非常漂亮的地方(提交按钮就在文本框旁边,中间没有像素)但是它会重叠或散布在其他人身上有人可以帮助我吗 here is the site这是一个fiddle

最佳答案

你可以为此使用 flexbox:

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
  background: rgb(28, 28, 29);
  margin: 2em;
}
#chatbox {
  width: 100%;
  display: flex;
  height: 2em;
}
#chatbox input {
  width: 100%;
  height: 100%;
  background: transparent;
  border: 2px solid darkcyan;
}
#chatbox input[type=text] {
  color: darkcyan;
  border-radius: 4px 0 0 4px;
}
#chatbox input[type=submit] {
  width: 70px;
  background: darkcyan;
  border-radius: 0 4px 4px 0;
}
<div id="chatbox">
  <input type="text" />
  <input type="submit" value="Send" />
</div>

关于html - css 中的比例重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40251213/

相关文章:

css - 如何使用 LESS 更有效地使用媒体查询?

html - 在悬停时在下划线和导航项之间添加一个空格

javascript - 捕获太长的表单提交

php - 检索多个复选框并在表格中显示数据库中的其他相关信息

html - Internet Explorer 8 DOCTYPE 被忽略/评论

javascript - 为什么我会收到 ReferenceError : not defined

javascript - 在 javascript 中使用 append child 的树结构无法正常工作

html - 多个背景图像重复

css - 添加/删除行 css

javascript - 如何平滑地从另一个标签页滚动到另一个标签页?