简体   繁体   English

如何在引导程序中的两个文本框之间留出空间

[英]How to make space between two text boxes in bootstrap

I need small white space between two text boxes.我需要两个文本框之间的小空白。

 <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" /> <div class="row col-lg-12 col-sm-12"> <div class="input-group col-md-8"> <span class="control-label">Product Name*</span> <input type="text" class="form-control" placeholder="Product Name" id="productname" required> </div> <div class="input-group col-md-4" style=> <span class="control-label">Short Name*</span> <input type="text" class="form-control" placeholder="ShortName" id="shortname" required> </div> </div>

Are you want space between the textbox?你想要文本框之间的空间吗? i mean in small device it having in two row .so there is add mt-3 (margin-top) for below margin to each input-group我的意思是在小型设备中它有两行。所以有添加mt-3 (margin-top) 用于每个输入组的下边距

Is this issue?这是问题吗? 在此处输入图片说明

Add mt-3(margin-top) to each input-group and also add a width to span for correct alignment like this span{width:130px;}mt-3(margin-top)到每个input-group ,并添加一个宽度到 span 以正确对齐,例如span{width:130px;}

在此处输入图片说明

 span{ width:130px; }
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <div class="container-fluid"> <div class="row"> <div class="input-group col-12 mt-3"> <span class="control-label d-flex h-100 align-items-center">Product Name* &nbsp;</span> <input type="text" class="form-control" placeholder="Product Name" id="productname" required> </div> <div class="input-group col-12 mt-3" style=> <span class="control-label d-flex h-100 align-items-center">Short Name* &nbsp;</span> <input type="text" class="form-control"placeholder="ShortName" id="shortname" required> </div> </div> </div>

You may use margin or padding class on your span element :您可以在 span 元素上使用边距或填充类:

example例子

 <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" /> <div class="row col-lg-12 col-sm-12"> <div class="input-group col-md-8"> <span class="control-label px-1">Product Name*</span> <input type="text" class="form-control" placeholder="Product Name" id="productname" required> </div> <div class="input-group col-md-4" style=> <span class="control-label px-1">Short Name*</span> <input type="text" class="form-control" placeholder="ShortName" id="shortname" required> </div> </div>

https://getbootstrap.com/docs/4.5/utilities/spacing/ https://getbootstrap.com/docs/4.5/utilities/spacing/

Spacing间距

Bootstrap includes a wide range of shorthand responsive margin and padding utility classes to modify an element's appearance. Bootstrap 包括各种速记响应边距和填充实用程序类来修改元素的外观。

How it works这个怎么运作

Assign responsive-friendly margin or padding values to an element or a subset of its sides with shorthand classes.使用速记类为元素或其边的子集分配响应友好的边距或填充值。 Includes support for individual properties, all properties, and vertical and horizontal properties.包括对单个属性、所有属性以及垂直和水平属性的支持。 Classes are built from a default Sass map ranging from .25rem to 3rem.类是从默认的 Sass 映射构建的,范围从 0.25rem 到 3rem。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM