html form-inline,Can't build a html/css inline form

本文介绍如何通过调整CSS样式实现响应式表单布局,包括去除特定代码、使用flex布局来确保输入框和按钮在同一行显示,并通过设置外边距来增加元素间的间距。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

So here we go to achieve this, you have to remove this piece of code from your styles:

.form-inline {

flex-direction: column;

}

Why though?

Because flex-direction: column; will make every one of your div children as an independent row, and whole of them as a column. Like the one, you achieved earlier.

Then the next step to achieve and inline form inputs and buttons here is to move your button tag out of the independent division with the same class and wrap all of them into a single div just like this:

Subscribe

The final cut

At the end all of your code will be something like the below snippet:

h2 {

font-size: 24px;

font-weight: 700;

margin-bottom: 25px;

line-height: 1.5;

padding-top: 0;

margin-top: 0;

color: inherit;

}

.form-inline {

display: flex;

justify-content: center;

align-items: center;

}

.newsletter-subscribe .intro {

font-size: 16px;

max-width: 500px;

margin: 0 auto 25px;

}

.newsletter-subscribe .intro p {

margin-bottom: 35px;

}

.newsletter-subscribe .newsletter-subscribe form .form-control {

background: #eff1f4;

border: none;

border-radius: 3px;

box-shadow: none;

outline: 0;

color: inherit;

text-indent: 9px;

height: 45px;

margin-right: 10px;

min-width: 250px;

}

newsletter
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值