美图齐众专注资阳网站设计 资阳网站制作 资阳网站建设
资阳网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

创新互联Bootstrap4教程:Bootstrap4自定义表单

Bootstrap4 自定义表单

Bootstrap4 可以自定义一些表单的样式来替换浏览器默认的样式。

成都创新互联公司服务项目包括巩留网站建设、巩留网站制作、巩留网页制作以及巩留网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,巩留网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到巩留省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

自定义复选框

如果要自定义一个复选框,可以设置

为父元素,类为 .custom-control 和 .custom-checkbox,复选框作为子元素放在该
里头,然后复选框设置为 type="checkbox",类为 .custom-control-input。

复选框的文本使用 label 标签,标签使用 .custom-control-label 类,labelfor 属性值需要匹配复选框的 id。

Bootstrap4 实例

<
form
>

<
div

class
=
"
custom-control custom-checkbox
"
>

<
input

type
=
"
checkbox
"

class
=
"
custom-control-input
"

id
=
"
customCheck
"

name
=
"
example1
"
>

<
label

class
=
"
custom-control-label
"

for
=
"
customCheck
"
>
自定义复选框
label
>

div
>

form
>

尝试一下 »

自定义单选框

如果要自定义一个单选框,可以设置

为父元素,类为 .custom-control 和 .custom-radio,单选框作为子元素放在该
里头,然后单选框设置为 type="radio",类为 .custom-control-input。

单选框的文本使用 label 标签,标签使用 .custom-control-label 类,labelfor 属性值需要匹配单选框的 id

Bootstrap4 实例

<
form
>

<
div

class
=
"
custom-control custom-radio
"
>

<
input

type
=
"
radio
"

class
=
"
custom-control-input
"

id
=
"
customRadio
"

name
=
"
example1
"

value
=
"
customEx
"
>

<
label

class
=
"
custom-control-label
"

for
=
"
customRadio
"
>
自定义单选框
label
>

div
>

form
>

尝试一下 »

自定义控件显示在同一行

我们可以在外部元素上使用 .custom-control-inline 类来包裹自定义表单控件,这样自定义表单控件就能显示在同一行:

Bootstrap4 实例

<
form
>

<
div

class
=
"
custom-control custom-radio custom-control-inline
"
>

<
input

type
=
"
radio
"

class
=
"
custom-control-input
"

id
=
"
customRadio
"

name
=
"
example
"

value
=
"
customEx
"
>

<
label

class
=
"
custom-control-label
"

for
=
"
customRadio
"
>
自定义单选框 1
label
>

div
>

<
div

class
=
"
custom-control custom-radio custom-control-inline
"
>

<
input

type
=
"
radio
"

class
=
"
custom-control-input
"

id
=
"
customRadio2
"

name
=
"
example
"

value
=
"
customEx
"
>

<
label

class
=
"
custom-control-label
"

for
=
"
customRadio2
"
>
自定义单选框 2
label
>

div
>

form
>

尝试一下 »

自定义选择菜单

创建自定义选择菜单可以在 提交需求

    联系我们

    028-86922220
  • 手机:13518219792
  • 地址:成都市太升南路288号锦天国际A幢1002号
  • 24小时服务热线:028-86922220

    网站建设服务

  • 网页设计
  • 网站制作
  • 网站开发

    网站推广服务

  • 营销网站建设
  • 百度快速排名
  • 整站网站推广

    网站运维服务

  • 基础维护
  • 网站改版
  • 网站维护

    FOLLOW US

  • 微信二维码

    微信二维码

Copyright © 2025 资阳站青羊区美图齐众设计工作室(个体工商户) 资阳网站建设公司-选网站建设公司美图齐众!专业的网站制作公司!
All Rights Reserved 版权所有 蜀ICP备2025119604号-1