html - Firefox 中的 CSS 顶部定位

标签 html css

我在使用谷歌浏览器时设置了这个代码块的样式,正如你在这张图片中看到的那样,它对齐得很好。

see image here

但是用 Firefox 浏览时显示不正确

see image

我做错了什么?

.full-panel select {
  -webkit-appearance:none;
  background-color:#1B6B80;
  background-position:95% 50%;
  background-repeat:no-repeat;
  border:1px solid #1B6B80;
  border-radius:2px;
  color:#FFFFFF;
  display:block;
  font-size:10px;
  height:30px;
  line-height:10px;
  padding-left:5px;
  padding-right:25px;
  position:absolute;
  right:150px;
  top:30px;
  width:150px;
}
<form method="POST" action="/" accept-charset="UTF-8"><input name="_token" type="hidden" value="M7sQaw7MVFV4DQhoyMxdiuJPB7E5KbaWVB5U9lbp">
    <div class="full-panel">
        <input name="quick" value="1" type="hidden">
        <input class="biginput" type="text" name="name" placeholder="Set up your free website">
        <select name="domain_id">
          <option>mysite.com</option>
        </select>
        <input class="bigbutton" type="submit" value="Submit">
    </div>
</form>

最佳答案

当您必须使用绝对位置时,请确保其父容器具有相对位置

.full-panel {
  position:relative;
}

这样你就可以开始计算相对于它的容器而不是相对于主体的像素(顶部:30px)

关于html - Firefox 中的 CSS 顶部定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32030479/

相关文章:

HTML 日期选择器与日期输入重叠

javascript - 将格式不正确的 XML 文档转置为 HTML 无序列表

javascript - html中的表格边框

html - 如何在html中用对 Angular 线划分图像和文本?

javascript - 单击按钮后使用 CSS 和 JS 将彩色图像转换为黑白图像

javascript - Jquery on expand,输入框不在标签旁边

html - 居中对齐表格中的绝对文本

javascript - 在 IE10 中隐藏或更改范围输入的值标签

html - knockout : nest input element in label tag with data-bind properties

html - 如何将页面内容扩展到屏幕底部