Bootstrap 4 HTML中的输入类型文件和不同大小的按钮
我在HTML中使用了Bootstrap 4,并且有一个由输入栏和按钮制成的输入框。
我将按钮的大小设置为“ LG”(大),但我无法将输入条设置为相同的大小。
这是我的代码:
<form>
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input" id="customFileInput" accept=".csv" aria-describedby="customFileInput">
<label class="custom-file-label" for="customFileInput">Select File</label>
</div>
<div class="input-group-append">
<button class="btn btn-success btn-lg" type="button" id="uploadBtn" onclick="OnClickUpload()">Upload</button>
</div>
</div>
</form>
这是结果:
如何将输入栏的大小设置为“ lg”(与按钮相同)?
I'm using Bootstrap 4 in html and I have an input box made of an input bar and a button.
I set the size of the button to "lg" (large) but I can't set the input bar to the same size.
This is my code:
<form>
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input" id="customFileInput" accept=".csv" aria-describedby="customFileInput">
<label class="custom-file-label" for="customFileInput">Select File</label>
</div>
<div class="input-group-append">
<button class="btn btn-success btn-lg" type="button" id="uploadBtn" onclick="OnClickUpload()">Upload</button>
</div>
</div>
</form>
And this is the result:
How can I set the size of the input bar to "lg" (same as button)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要使用
.input-group.input-group-lg
,如文档所示:https://getbootstrap.com/doc.com/docs/docs/4.6/components/4.6/components/input-group/input-group /#sizing
编辑:
在
中。
您将需要在
上覆盖BS样式.custom-file-Label
,如下所示:You need to use
.input-group.input-group-lg
as shown in the docs:https://getbootstrap.com/docs/4.6/components/input-group/#sizing
EDIT:
That will not work with a
.custom-file-input
within the.input-group
.You will need to override the BS styles on
.custom-file-label
as shown below:从按钮的类中删除“ BTN-LG”,仅放置边距。
class =“ BTN BTN-Success M-2”
Remove "btn-lg" from the button's class and put margin only.
class="btn btn-success m-2"
对我来说,这用于高度问题:
For me this worked for height issues: