加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
lyear_forms_elements.html 37.18 KB
一键复制 编辑 原始数据 按行查看 历史
笔下光年 提交于 2020-09-17 15:28 . 修改id值
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>表单 - 光年(Light Year Admin V4)后台管理系统模板</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V4是一个后台管理系统的HTML模板,基于Bootstrap v4.4.1。">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid p-t-15">
<div class="row">
<div class="col-lg-6">
<div class="card">
<header class="card-header"><div class="card-title">基本样式</div></header>
<div class="card-body">
<form class="form-horizontal" action="#" method="post" enctype="multipart/form-data" onsubmit="return false;">
<div class="form-group">
<label for="exampleFormControlInput1">邮箱地址</label>
<input type="email" class="form-control" id="exampleFormControlInput1" placeholder="请输入邮箱地址">
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">下拉选择</label>
<select class="form-control" id="exampleFormControlSelect1">
<option>侦骑四出</option>
<option>追踪神秘客</option>
<option>突遭暗算</option>
<option>冒险探桃源</option>
<option>一场豪赌</option>
</select>
</div>
<div class="form-group">
<label for="exampleFormControlSelect2">多选示例</label>
<select multiple class="form-control" id="exampleFormControlSelect2">
<option>神秘地穴</option>
<option>前因后果</option>
<option>美人青睐</option>
<option>几乎见龙王</option>
<option>惊散野鸳鸯</option>
</select>
</div>
<div class="form-group">
<label for="exampleFormControlTextarea1">文本域</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3" placeholder="内容"></textarea>
</div>
<div class="form-group">
<label for="exampleFormControlFile1">上传控件</label>
<input type="file" class="form-control-file" id="exampleFormControlFile1">
</div>
<div class="form-group">
<label for="readOnlyExample">只读</label>
<input class="form-control" id="readOnlyExample" type="text" placeholder="此处为只读输入框..." readonly>
</div>
<div class="form-group">
<label for="staticEmail">只读纯文本</label>
<input class="form-control-plaintext" id="staticEmail" type="text" placeholder="此处为只读输入框..." readonly value="email@example.com">
</div>
<div class="form-group">
<label for="formControlRange">范围输入</label>
<input type="range" class="form-control-range" id="formControlRange" />
</div>
<div class="form-group">
<h6>多选框</h6>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
<label class="form-check-label" for="defaultCheck1">
篮球
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck2" disabled>
<label class="form-check-label" for="defaultCheck2">
足球
</label>
</div>
</div>
<div class="form-group">
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1">
<label class="form-check-label" for="inlineCheckbox1">1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2">
<label class="form-check-label" for="inlineCheckbox2">2</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3" disabled>
<label class="form-check-label" for="inlineCheckbox3">3 (禁用)</label>
</div>
</div>
<div class="form-group">
<h6>单选框</h6>
<div class="form-check">
<input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios1" value="option1" checked>
<label class="form-check-label" for="exampleRadios1">
排球
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios2" value="option2">
<label class="form-check-label" for="exampleRadios2">
乒乓球
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios3" value="option3" disabled>
<label class="form-check-label" for="exampleRadios3">
棒球
</label>
</div>
</div>
<div class="form-group">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1">
<label class="form-check-label" for="inlineRadio1">1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2">
<label class="form-check-label" for="inlineRadio2">2</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3" disabled>
<label class="form-check-label" for="inlineRadio3">3 (禁用)</label>
</div>
</div>
<div class="form-group">
<h6>不使用 <code>label</code> 标签</h6>
<div class="form-check">
<input class="form-check-input position-static" type="checkbox" id="blankCheckbox" value="option1" aria-label="...">
</div>
<div class="form-check">
<input class="form-check-input position-static" type="radio" name="blankRadio" id="blankRadio1" value="option1" aria-label="...">
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-header"><div class="card-title">垂直排列表单</div></div>
<div class="card-body">
<form>
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label">邮箱</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="inputEmail3">
</div>
</div>
<div class="form-group row">
<label for="inputPassword3" class="col-sm-2 col-form-label">密码</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="inputPassword3">
</div>
</div>
<fieldset class="form-group">
<div class="row">
<legend class="col-form-label col-sm-2 pt-0">单选框</legend>
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked>
<label class="form-check-label" for="gridRadios1">
第一个选项
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="gridRadios" id="gridRadios2" value="option2">
<label class="form-check-label" for="gridRadios2">
第二个选项
</label>
</div>
<div class="form-check disabled">
<input class="form-check-input" type="radio" name="gridRadios" id="gridRadios3" value="option3" disabled>
<label class="form-check-label" for="gridRadios3">
第三个选项
</label>
</div>
</div>
</div>
</fieldset>
<div class="form-group row">
<div class="col-sm-2">复选框</div>
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="gridCheck1">
<label class="form-check-label" for="gridCheck1">
选项一
</label>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-10">
<button type="submit" class="btn btn-primary">Sign in</button>
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-header"><div class="card-title">网格系统使用</div></div>
<div class="card-body">
<form>
<div class="form-row">
<div class="col-7">
<input type="text" class="form-control" placeholder="城市">
</div>
<div class="col">
<input type="text" class="form-control" placeholder="状态">
</div>
<div class="col">
<input type="text" class="form-control" placeholder="邮编">
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-header"><div class="card-title">内联表单</div></div>
<div class="card-body">
<form class="form-inline">
<label class="sr-only" for="inlineFormInputName2"></label>
<input type="text" class="form-control mb-2 mr-sm-2" id="inlineFormInputName2" placeholder="黄">
<label class="sr-only" for="inlineFormInputGroupUsername2"></label>
<div class="input-group mb-2 mr-sm-2">
<div class="input-group-prepend">
<div class="input-group-text">@</div>
</div>
<input type="text" class="form-control" id="inlineFormInputGroupUsername2" placeholder="名">
</div>
<div class="form-check mb-2 mr-sm-2">
<input class="form-check-input" type="checkbox" id="inlineFormCheck">
<label class="form-check-label" for="inlineFormCheck">
记住我
</label>
</div>
<button type="submit" class="btn btn-primary mb-2">提交</button>
</form>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="card">
<div class="card-header"><div class="card-title">表单组</div></div>
<div class="card-body">
<form>
<div class="form-group">
<label for="formGroupExampleInput">邮箱</label>
<input type="text" class="form-control" id="formGroupExampleInput" placeholder="请输入邮箱">
</div>
<div class="form-group">
<label for="formGroupExampleInput2">密码</label>
<input type="text" class="form-control" id="formGroupExampleInput2" placeholder="请输入密码">
</div>
<div class="form-group">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">7天自动登录</label>
</div>
</div>
<button type="submit" class="btn btn-primary">登录</button>
</form>
</div>
</div>
<div class="card">
<div class="card-header"><div class="card-title">表单栅格排列</div></div>
<div class="card-body">
<form>
<div class="row">
<div class="col">
<input type="text" class="form-control" placeholder="请输入邮箱">
</div>
<div class="col">
<input type="text" class="form-control" placeholder="请输入密码">
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-header"><div class="card-title">表格式排列</div></div>
<div class="card-body">
<p>你可以使用 <code>.form-row</code> 来取代 <code>.row</code> (它们二者很多时候可以互换使用),因为 <code>.form-row</code> 提供更小的沟槽缝隙。</p>
<form>
<div class="form-row">
<div class="col">
<input type="text" class="form-control" placeholder="请输入邮箱">
</div>
<div class="col">
<input type="text" class="form-control" placeholder="请输入密码">
</div>
</div>
</form>
<p class="mt-3">还可以使用栅格系统建立更复杂的布局。</p>
<form>
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputEmail4">邮箱</label>
<input type="email" class="form-control" id="inputEmail4" placeholder="请输入邮箱">
</div>
<div class="form-group col-md-6">
<label for="inputPassword4">密码</label>
<input type="password" class="form-control" id="inputPassword4" placeholder="请输入密码">
</div>
</div>
<div class="form-group">
<label for="inputAddress">常住地址</label>
<input type="text" class="form-control" id="inputAddress" placeholder="您的详细地址">
</div>
<div class="form-group">
<label for="inputAddress2">籍贯</label>
<input type="text" class="form-control" id="inputAddress2" placeholder="籍贯">
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputCity">城市</label>
<input type="text" class="form-control" id="inputCity" placeholder="城市">
</div>
<div class="form-group col-md-4">
<label for="inputState">状态</label>
<select id="inputState" class="form-control">
<option selected>请选择...</option>
<option>...</option>
</select>
</div>
<div class="form-group col-md-2">
<label for="inputZip">邮编</label>
<input type="text" class="form-control" id="inputZip" placeholder="邮编">
</div>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="gridCheck">
<label class="form-check-label" for="gridCheck">
记住
</label>
</div>
</div>
<button type="submit" class="btn btn-primary">立即注册</button>
</form>
</div>
</div>
<div class="card">
<div class="card-header"><div class="card-title">大小尺寸</div></div>
<div class="card-body">
<form>
<div class="form-group row">
<label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">偏小的输入框</label>
<div class="col-sm-10">
<input type="email" class="form-control form-control-sm" id="colFormLabelSm" placeholder="col-form-label-sm">
</div>
</div>
<div class="form-group row">
<label for="colFormLabel" class="col-sm-2 col-form-label">正常输入框</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="colFormLabel" placeholder="col-form-label">
</div>
</div>
<div class="form-group row">
<label for="colFormLabelLg" class="col-sm-2 col-form-label col-form-label-lg">大输入框</label>
<div class="col-sm-10">
<input type="email" class="form-control form-control-lg" id="colFormLabelLg" placeholder="col-form-label-lg">
</div>
</div>
<div class="form-group">
<select class="form-control form-control-lg">
<option>大的下拉</option>
</select>
</div>
<div class="form-group">
<select class="form-control">
<option>正常的下拉</option>
</select>
</div>
<div class="form-group">
<select class="form-control form-control-sm">
<option>较小的下拉</option>
</select>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-header"><div class="card-title">自动调整大小</div></div>
<div class="card-body">
<form>
<div class="form-row align-items-center">
<div class="col-auto">
<label class="sr-only" for="inlineFormInput">名称</label>
<input type="text" class="form-control mb-2" id="inlineFormInput" placeholder="郭靖">
</div>
<div class="col-auto">
<label class="sr-only" for="inlineFormInputGroup">姓名</label>
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">@</div>
</div>
<input type="text" class="form-control" id="inlineFormInputGroup" placeholder="黄蓉">
</div>
</div>
<div class="col-auto">
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" id="autoSizingCheck">
<label class="form-check-label" for="autoSizingCheck">
记住我
</label>
</div>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-primary mb-2">提交</button>
</div>
</div>
</form>
<form>
<div class="form-row align-items-center">
<div class="col-sm-3 my-1">
<label class="sr-only" for="inlineFormInputName">名称</label>
<input type="text" class="form-control" id="inlineFormInputName" placeholder="郭靖">
</div>
<div class="col-sm-3 my-1">
<label class="sr-only" for="inlineFormInputGroupUsername">姓名</label>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">@</div>
</div>
<input type="text" class="form-control" id="inlineFormInputGroupUsername" placeholder="黄蓉">
</div>
</div>
<div class="col-auto my-1">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="autoSizingCheck2">
<label class="form-check-label" for="autoSizingCheck2">
记住我
</label>
</div>
</div>
<div class="col-auto my-1">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
<p class="mt-3">当然也支持自定义表单控件。</p>
<form>
<div class="form-row align-items-center">
<div class="col-auto my-1">
<label class="mr-sm-2 sr-only" for="inlineFormCustomSelect">Preference</label>
<select class="custom-select mr-sm-2" id="inlineFormCustomSelect">
<option selected>请选择...</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
</div>
<div class="col-auto my-1">
<div class="custom-control custom-checkbox mr-sm-2">
<input type="checkbox" class="custom-control-input" id="customControlAutosizing">
<label class="custom-control-label" for="customControlAutosizing">记住我的偏好</label>
</div>
</div>
<div class="col-auto my-1">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-12">
<div class="card">
<div class="card-header"><div class="card-title">提示文本</div></div>
<div class="card-body">
<div class="form-group">
<label for="inputPassword5">密码</label>
<input type="password" id="inputPassword5" class="form-control" aria-describedby="passwordHelpBlock">
<small id="passwordHelpBlock" class="form-text text-muted">
密码长度必须为8-20个字符,包含字母和数字,并且不能包含空格、特殊字符或表情符号。
</small>
</div>
<p>内联文本可以使用任何典型的内联HTML元素(无论是 <code>&lt;small&gt;</code><code>&lt;span&gt;</code> 或其他元素)。</p>
<form class="form-inline">
<div class="form-group">
<label for="inputPassword6">密码</label>
<input type="password" id="inputPassword6" class="form-control mx-sm-3" aria-describedby="passwordHelpInline">
<small id="passwordHelpInline" class="text-muted">
必须是8-20个字符长度。
</small>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-12">
<div class="card">
<div class="card-header"><div class="card-title">禁用表单</div></div>
<div class="card-body">
<p><code>disabled</code> 属性添加到 <code>&lt;fieldset&gt;</code> 以禁用其中的所有控件。</p>
<form>
<fieldset disabled>
<div class="form-group">
<label for="disabledTextInput">禁用的输入框</label>
<input type="text" id="disabledTextInput" class="form-control" placeholder="禁用的输入框">
</div>
<div class="form-group">
<label for="disabledSelect">禁用的下拉</label>
<select id="disabledSelect" class="form-control">
<option>禁用的下拉</option>
</select>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="disabledFieldsetCheck">
<label class="form-check-label" for="disabledFieldsetCheck">
不能选择
</label>
</div>
</div>
<button type="submit" class="btn btn-primary">提交</button>
</fieldset>
</form>
</div>
</div>
</div>
</div>
<div class="lyear-divider">表单验证</div>
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header"><div class="card-title">自定义样式</div></div>
<div class="card-body">
<form class="needs-validation" novalidate>
<div class="form-row">
<div class="col-md-4 mb-3">
<label for="validationCustom01">姓氏</label>
<input type="text" class="form-control" id="validationCustom01" value="黄" required>
<div class="valid-feedback">
看起来不错!
</div>
</div>
<div class="col-md-4 mb-3">
<label for="validationCustom02"></label>
<input type="text" class="form-control" id="validationCustom02" value="药师" required>
<div class="valid-feedback">
看起来不错!
</div>
</div>
<div class="col-md-4 mb-3">
<label for="validationCustomUsername">昵称</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="inputGroupPrepend">@</span>
</div>
<input type="text" class="form-control" id="validationCustomUsername" aria-describedby="inputGroupPrepend" required>
<div class="invalid-feedback">
请输入您的昵称。
</div>
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-6 mb-3">
<label for="validationCustom03">城市</label>
<input type="text" class="form-control" id="validationCustom03" required>
<div class="invalid-feedback">
请提供有效城市。
</div>
</div>
<div class="col-md-3 mb-3">
<label for="validationCustom04">状态</label>
<select class="custom-select" id="validationCustom04" required>
<option selected disabled value="">请选择...</option>
<option>...</option>
</select>
<div class="invalid-feedback">
请选择有效状态。
</div>
</div>
<div class="col-md-3 mb-3">
<label for="validationCustom05">邮编</label>
<input type="text" class="form-control" id="validationCustom05" required>
<div class="invalid-feedback">
请输入正确的邮编
</div>
</div>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="invalidCheck" required>
<label class="form-check-label" for="invalidCheck">
同意条款和条件
</label>
<div class="invalid-feedback">
你必须在提交之前同意。
</div>
</div>
</div>
<button class="btn btn-primary" type="submit">提交表单</button>
</form>
<script>
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
'use strict';
window.addEventListener('load', function() {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
</script>
</div>
</div>
</div>
<div class="col-lg-12">
<div class="card">
<div class="card-header"><div class="card-title">浏览器默认验证</div></div>
<div class="card-body">
<form>
<div class="form-row">
<div class="col-md-4 mb-3">
<label for="validationDefault01">姓氏</label>
<input type="text" class="form-control" id="validationDefault01" value="黄" required>
</div>
<div class="col-md-4 mb-3">
<label for="validationDefault02"></label>
<input type="text" class="form-control" id="validationDefault02" value="药师" required>
</div>
<div class="col-md-4 mb-3">
<label for="validationDefaultUsername">昵称</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="inputGroupPrepend2">@</span>
</div>
<input type="text" class="form-control" id="validationDefaultUsername" aria-describedby="inputGroupPrepend2" required>
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-6 mb-3">
<label for="validationDefault03">城市</label>
<input type="text" class="form-control" id="validationDefault03" required>
</div>
<div class="col-md-3 mb-3">
<label for="validationDefault04">状态</label>
<select class="custom-select" id="validationDefault04" required>
<option selected disabled value="">请选择...</option>
<option>...</option>
</select>
</div>
<div class="col-md-3 mb-3">
<label for="validationDefault05">邮编</label>
<input type="text" class="form-control" id="validationDefault05" required>
</div>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="invalidCheck2" required>
<label class="form-check-label" for="invalidCheck2">
同意条款和条件
</label>
</div>
</div>
<button class="btn btn-primary" type="submit">提交表单</button>
</form>
</div>
</div>
</div>
<div class="col-lg-12">
<div class="card">
<div class="card-header"><div class="card-title">支持的元素</div></div>
<div class="card-body">
<p>验证样式可用于以下表单控件和组件:</p>
<ul>
<li><code>.form-control</code><code>&lt;input&gt;</code>s 和 <code>&lt;textarea&gt;</code>s (在输入组中最多包含一个 <code>.form-control</code>)</li>
<li><code>.form-control</code> 或者 <code>.custom-select</code><code>&lt;select&gt;</code>s</li>
<li><code>.form-check</code>s</li>
<li><code>.custom-checkbox</code>s 和 <code>.custom-radio</code>s</li>
<li><code>.custom-file</code></li>
</ul>
<form class="was-validated">
<div class="mb-3">
<label for="validationTextarea">文本域</label>
<textarea class="form-control is-invalid" id="validationTextarea" placeholder="必需填写的文本区域" required></textarea>
<div class="invalid-feedback">
请在文本区域中输入消息。
</div>
</div>
<div class="custom-control custom-checkbox mb-3">
<input type="checkbox" class="custom-control-input" id="customControlValidation1" required>
<label class="custom-control-label" for="customControlValidation1">同意条款</label>
<div class="invalid-feedback">请阅读并勾选同意条款</div>
</div>
<div class="custom-control custom-radio">
<input type="radio" class="custom-control-input" id="customControlValidation2" name="radio-stacked" required>
<label class="custom-control-label" for="customControlValidation2">篮球</label>
</div>
<div class="custom-control custom-radio mb-3">
<input type="radio" class="custom-control-input" id="customControlValidation3" name="radio-stacked" required>
<label class="custom-control-label" for="customControlValidation3">足球</label>
<div class="invalid-feedback">选择你喜欢的一项运动</div>
</div>
<div class="form-group">
<select class="custom-select" required>
<option value="">打开此选择菜单</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<div class="invalid-feedback">请选择一项</div>
</div>
<div class="custom-file">
<input type="file" class="custom-file-input" id="validatedCustomFile" required>
<label class="custom-file-label" for="validatedCustomFile">选择文件...</label>
<div class="invalid-feedback">选择您要上传的文件</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-12">
<div class="card">
<div class="card-header"><div class="card-title">工具提示</div></div>
<div class="card-body">
<form class="needs-validation" novalidate>
<div class="form-row">
<div class="col-md-4 mb-3">
<label for="validationTooltip01">姓氏</label>
<input type="text" class="form-control" id="validationTooltip01" value="黄" required>
<div class="valid-tooltip">
看起来不错!
</div>
</div>
<div class="col-md-4 mb-3">
<label for="validationTooltip02"></label>
<input type="text" class="form-control" id="validationTooltip02" value="药师" required>
<div class="valid-tooltip">
看起来不错!
</div>
</div>
<div class="col-md-4 mb-3">
<label for="validationTooltipUsername">昵称</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="validationTooltipUsernamePrepend">@</span>
</div>
<input type="text" class="form-control" id="validationTooltipUsername" aria-describedby="validationTooltipUsernamePrepend" required>
<div class="invalid-tooltip">
请输入您的昵称。
</div>
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-6 mb-3">
<label for="validationTooltip03">城市</label>
<input type="text" class="form-control" id="validationTooltip03" required>
<div class="invalid-tooltip">
请提供有效城市。
</div>
</div>
<div class="col-md-3 mb-3">
<label for="validationTooltip04">状态</label>
<select class="custom-select" id="validationTooltip04" required>
<option selected disabled value="">请选择...</option>
<option>...</option>
</select>
<div class="invalid-tooltip">
请选择有效状态。
</div>
</div>
<div class="col-md-3 mb-3">
<label for="validationTooltip05">邮编</label>
<input type="text" class="form-control" id="validationTooltip05" required>
<div class="invalid-tooltip">
请输入正确的邮编
</div>
</div>
</div>
<button class="btn btn-primary" type="submit">提交表单</button>
</form>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化