联系表单提交按钮定位

Contact Form submit button positioning

这是我的网站:

http://cvkj.agencialosnavegantes.cl/

我在页面底部有一个联系表单,我想将提交按钮放在文本框旁边,但我很费力。

这是我的首字母css:

#enviarbajo {
    background:url(http://cvkj.agencialosnavegantes.cl/wp-content/uploads/2017/08/paper-plane-2.png) no-repeat;
    background-color: #564585;
    width:40px; 
    height:40px; 
    padding:0px 0 4px 0; 
    border:none; text-indent: -1000em; cursor:pointer;
    border-radius: 0;
    margin: 5%;
    position: relative;
    left: 35%;
   
}

举报post 周五 01:00 下午发布 你好

这是我的网站:

http://cvkj.agencialosnavegantes.cl/

我在页面底部有一个联系表单,我想将提交按钮放在文本框旁边,但我很费力。

这是我的首字母css:

enviarbajo {

background:url(http://cvkj.agencialosnavegantes.cl/wp-content/uploads/2017/08/paper-plane-2.png) no-repeat;
background-color: #564585;
width:40px; 
height:40px; 
padding:0px 0 4px 0; 
border:none; text-indent: -1000em; cursor:pointer;
border-radius: 0;
margin: 5%;
position: relative;
left: 35%;

} 然后我尝试使用媒体查询定位按钮,但我无法将按钮放在我想要的位置

@media (max-width: 768px){
   #enviarbajo {
    position: relative;
    right: 100px;
    }
}

下面的其他媒体查询:

@media only screen and (max-width: 500px) {
    #enviarbajo {
    position: relative;
    right: 50px;
    }

有没有更有效的方法?

当您使用固定宽度的按钮时,有 2 个不错的选择,而不是使用宽度为 75% 和 25% 的 divs。 在这两种解决方案中,都使用 40px 作为按钮宽度。

第一个解决方案

第一个 div 使用计算宽度:calc(100% - 40px)

#footer-widgets form.wpcf7-form div:nth-child(2){
  width: calc(100% - 40px);
}
#footer-widgets form.wpcf7-form div:nth-child(2) > span{
  margin: 0;
}
#footer-widgets form.wpcf7-form div:nth-child(2) input{
  width: 100%;
}

#footer-widgets form.wpcf7-form div:nth-child(3){
  width: 40px;
}

第二种解决方案

使用按钮的填充 (40px) 和绝对定位

#footer-widgets form.wpcf7-form {
  position: relative;
}
#footer-widgets form.wpcf7-form div:nth-child(2){
  width: 100%;
  padding-right: 40px;
}
#footer-widgets form.wpcf7-form div:nth-child(2) > span{
  margin: 0;
}
#footer-widgets form.wpcf7-form div:nth-child(2) input{
  width: 100%;
}

#footer-widgets form.wpcf7-form div:nth-child(3){
  width: 40px;
  position: absolute;
  top:0;
  right: 0;
}

这是对这个问题的明确回答,由 Lukasz Mazan 提供

#footer-widgets form.wpcf7-form div:nth-child(2){
  width: calc(100% - 40px);
}
#footer-widgets form.wpcf7-form div:nth-child(2) > span{
  margin: 0;
}
#footer-widgets form.wpcf7-form div:nth-child(2) input{
  width: 100%;
}

#footer-widgets form.wpcf7-form div:nth-child(3){
  width: 40px;
}

有了这个,您可以在每个屏幕尺寸的电子邮件框旁边都有提交按钮。

问题已解决。