7.36. Bootstrap5 form floating label

发布时间 :2024-01-16 01:55:16 UTC      

By default, the tag content is generally displayed in the input at the top of the input box:

Image0

Using floating tags, you can use the input insert a label in the input box and click input float them to the top when you enter the boxes

Image1

7.36.1. Bootstrap instance

<div class="form-floating mb-3 mt-3">
  <input type="text" class="form-control" id="email" placeholder="Enter email" name="email">
  <label for="email">Email</label>
</div>

<div class="form-floating mt-3 mb-3">
  <input type="text" class="form-control" id="pwd" placeholder="Enter password" name="pswd">
  <label for="pwd">Password</label>
</div>

Note: <label> the element must be in the <input> element, and each <input> elements are needed placeholder property.

Text box

Text box textarea you can also have a floating effect:

7.36.2. Bootstrap instance

<div class="form-floating">
  <textarea class="form-control" id="comment" name="text" placeholder="Comment goes here"></textarea>
  <label for="comment">Comments</label>
</div>

Selection box

We can use a floating tag on the selection menu, which will always be displayed in the upper-left corner of the selection menu and will not have aclick-and-float effect:

7.36.3. Bootstrap instance

<div class="form-floating">
  <select class="form-select" id="sel1" name="sellist">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
  </select>
  <label for="sel1" class="form-label">Select list (select one):</label>
</div>

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.