日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Bootstrap4教程:Bootstrap4輸入框組

Bootstrap4 輸入框組

我們可以使用 .input-group 類來向表單輸入框中添加更多的樣式,如圖標(biāo)、文本或者按鈕。

使用 .input-group-prepend 類可以在輸入框的的前面添加文本信息, .input-group-append 類添加在輸入框的后面。

最后,我們還需要使用 .input-group-text 類來設(shè)置文本的樣式。

Bootstrap4 實(shí)例

<
form
>

<
div

class
=
"
input-group mb-3
"
>

<
div

class
=
"
input-group-prepend
"
>

<
span

class
=
"
input-group-text
"
>
@
span
>

div
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
Username
"
>

div
>

<
div

class
=
"
input-group mb-3
"
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
Your Email
"
>

<
div

class
=
"
input-group-append
"
>

<
span

class
=
"
input-group-text
"
>
@XWCX.NET
span
>

div
>

div
>

form
>

嘗試一下 ?

輸入框大小

使用 .input-group-sm 類來設(shè)置小的輸入框, .input-group-lg 類設(shè)置大的輸入框:

Bootstrap4 實(shí)例

<
form
>

<
div

class
=
"
input-group mb-3 input-group-sm
"
>

<
div

class
=
"
input-group-prepend
"
>

<
span

class
=
"
input-group-text
"
>
Small
span
>

div
>

<
input

type
=
"
text
"

class
=
"
form-control
"
>

div
>

form
>

<
form
>

<
div

class
=
"
input-group mb-3
"
>

<
div

class
=
"
input-group-prepend
"
>

<
span

class
=
"
input-group-text
"
>
Default
span
>

div
>

<
input

type
=
"
text
"

class
=
"
form-control
"
>

div
>

form
>

<
form
>

<
div

class
=
"
input-group mb-3 input-group-lg
"
>

<
div

class
=
"
input-group-prepend
"
>

<
span

class
=
"
input-group-text
"
>
Large
span
>

div
>

<
input

type
=
"
text
"

class
=
"
form-control
"
>

div
>

form
>

嘗試一下 ?

多個輸入框和文本

Bootstrap4 實(shí)例



<
form
>

<
div

class
=
"
input-group mb-3
"
>

<
div

class
=
"
input-group-prepend
"
>

<
span

class
=
"
input-group-text
"
>
Person
span
>

div
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
First Name
"
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
Last Name
"
>

div
>

form
>



<
form
>

<
div

class
=
"
input-group mb-3
"
>

<
div

class
=
"
input-group-prepend
"
>

<
span

class
=
"
input-group-text
"
>
One
span
>

<
span

class
=
"
input-group-text
"
>
Two
span
>

<
span

class
=
"
input-group-text
"
>
Three
span
>

div
>

<
input

type
=
"
text
"

class
=
"
form-control
"
>

div
>

form
>

嘗試一下 ?

復(fù)選框與單選框

文本信息可以使用復(fù)選框與單選框替代:

Bootstrap4 實(shí)例

<
div

class
=
"
input-group mb-3
"
>

<
div

class
=
"
input-group-prepend
"
>

<
div

class
=
"
input-group-text
"
>

<
input

type
=
"
checkbox
"
>

div
>

div
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
RUNOOB
"
>

div
>

<
div

class
=
"
input-group mb-3
"
>

<
div

class
=
"
input-group-prepend
"
>

<
div

class
=
"
input-group-text
"
>

<
input

type
=
"
radio
"
>

div
>

div
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
GOOGLE
"
>

div
>

嘗試一下 ?

輸入框添加按鈕組

Bootstrap4 實(shí)例

<
div

class
=
"
input-group mb-3
"
>

<
div

class
=
"
input-group-prepend
"
>

<
button

class
=
"
btn btn-outline-secondary
"

type
=
"
button
"
>
Basic Button
button
>

div
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
Some text
"
>

div
>

<
div

class
=
"
input-group mb-3
"
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
Search
"
>

<
div

class
=
"
input-group-append
"
>

<
button

class
=
"
btn btn-success
"

type
=
"
submit
"
>
Go
button
>

div
>

div
>

<
div

class
=
"
input-group mb-3
"
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
Something clever..
"
>

<
div

class
=
"
input-group-append
"
>

<
button

class
=
"
btn btn-primary
"

type
=
"
button
"
>
OK
button
>

<
button

class
=
"
btn btn-danger
"

type
=
"
button
"
>
Cancel
button
>

div
>

div
>

嘗試一下 ?

設(shè)置下拉菜單

輸入框中添加下拉菜單不需要使用 .dropdown 類。

Bootstrap4 實(shí)例

<
div

class
=
"
input-group mt-3 mb-3
"
>

<
div

class
=
"
input-group-prepend
"
>

<
button

type
=
"
button
"

class
=
"
btn btn-outline-secondary dropdown-toggle
"

data-toggle
=
"
dropdown
"
>
選擇網(wǎng)站
button
>

<
div

class
=
"
dropdown-menu
"
>

<
a

class
=
"
dropdown-item
"

href
=
"
https://www.google.com
"
>
GOOGLE
a
>

<
a

class
=
"
dropdown-item
"

href
=
"
https://www.XWCX.NET
"
>
RUNOOB
a
>

<
a

class
=
"
dropdown-item
"

href
=
"
https://www.taobao.com
"
>
TAOBAO
a
>

div
>

div
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
網(wǎng)站地址
"
>

div
>

嘗試一下 ?

輸入框組標(biāo)簽

在輸入框組通過在輸入框組外圍的 label 來設(shè)置標(biāo)簽,標(biāo)簽的 for 屬性需要與輸入框組的 id 對應(yīng),點(diǎn)擊標(biāo)簽后可以聚焦輸入框:

Bootstrap4 實(shí)例

<
label

for
=
"
demo
"
>
Write your email here:
label
>

<
div

class
=
"
input-group mb-3
"
>

<
input

type
=
"
text
"

class
=
"
form-control
"

placeholder
=
"
Email
"

id
=
"
demo
"

name
=
"
email
"
>

<
div

class
=
"
input-group-append
"
>

<
span

class
=
"
input-group-text
"
>
@XWCX.NET
span
>

div
>

div
>

嘗試一下 ?


網(wǎng)站題目:創(chuàng)新互聯(lián)Bootstrap4教程:Bootstrap4輸入框組
本文路徑:http://www.dlmjj.cn/article/cdeogie.html