表单Form
支持元素:<input>、<select>、<textarea>、<label>
<input>元素支持类型:radio、checkbox、file、text、password、email、url、number、tel、search、range、date、month、week、time、datetime、datetime-local
类名 | 设定值(表单元素的宽度比例) | 权重 | 小屏幕 (0-750px) | 中等屏幕 (0-1200px) | 大屏幕 (>1200px) |
---|---|---|---|---|---|
空值 | None | None | 默认为inline-block | 默认为inline-block | 默认为inline-block |
.ratio | 60、70、80、90、100 | 默认 | 保持设定值 | 保持设定值 | 保持设定值 |
.ratio-m | 100 | 高于.ratio | 触发设定值 | 触发设定值 | 不触发 |
.ratio-s | 100 | 高于.ratio及.ratio-m | 触发设定值 | 不触发 | 不触发 |
<form>
<ul class="form">
<li>
<span>Username</span>
<div><input type="text"></div>
</li>
<li>
<span>Password</span>
<div><input type="text"></div>
</li>
</ul>
</form>
<form>
<ul class="form">
<li>
<span>Login</span>
<div><input type="text" placeholder="Username"></div>
</li>
<li>
<div><input type="text" placeholder="Password"></div>
</li>
<li>
<div><label><input type="checkbox">Remember me</label></div>
</li>
<li>
<div><button type="submit" class="btn xs">Submit</button></div>
</li>
</ul>
</form>
组合Group
<form>
<ul class="form ratio100">
<li>
<span>First Name</span>
<div><input type="text"></div>
</li>
<li>
<span>Last Name</span>
<div><input type="text"></div>
</li>
<li>
<span>City</span>
<div>
<select class="line">
<option>class="line"</option>
<option value="text1">text1</option>
<option value="text2">text2</option>
<option value="text3">text3</option>
</select>
</div>
</li>
<li>
<span>Address</span>
<div>
<select>
<option>State</option>
<option value="text1">text1</option>
<option value="text2">text2</option>
<option value="text3">text3</option>
</select>
<select>
<option>Country</option>
<option value="text1">text1</option>
<option value="text2">text2</option>
<option value="text3">text3</option>
</select>
</div>
</li>
<li>
<span>Range</span>
<div><input type="range"></div>
</li>
<li>
<span>Date</span>
<div><input type="date"></div>
</li>
<li>
<span>Profile Images</span>
<div><input type="file"></div>
</li>
<li>
<span>Personal Info</span>
<div><textarea></textarea></div>
</li>
<li>
<span>Shipping</span>
<div>
<label><input name="z1" type="radio" checked>Standard</label>
<label><input name="z1" type="radio">Premium</label>
</div>
</li>
<li>
<span>Shipping</span>
<div>
<label class="line"><input name="z2" type="checkbox" checked>class="line"</label>
<label class="line"><input name="z2" type="checkbox">class="line"</label>
</div>
</li>
<li>
<div class="tc"><button type="button" class="btn">Submit</button></div>
</li>
</ul>
</form>
比例Ratio
通过预定义的class="ratio60~100"快速调整表单元素在主体空间的占比
添加class="ratio100"使表单元素占比100%
<form>
<ul class="form ratio100">
<li>
<span>E-mail</span>
<div><input type="text"></div>
</li>
<li>
<span>Password</span>
<div><input type="text"></div>
</li>
<li>
<div><label><input type="checkbox">Remember me</label></div>
</li>
<li>
<div><button type="button" class="btn">Submit</button></div>
</li>
</ul>
</form>
添加class="ratio90"使表单元素占比90%
<form>
<ul class="form ratio90">
...
</ul>
</form>
添加class="ratio80"使表单元素占比80%
<form>
<ul class="form ratio80">
...
</ul>
</form>
添加class="ratio70"使表单元素占比70%
<form>
<ul class="form ratio70">
...
</ul>
</form>
添加class="ratio60"使表单元素占比60%
<form>
<ul class="form ratio60">
...
</ul>
</form>
响应式排列Responsive Layout
通过预定义的class="ratio60~100"、class="ratio-m100"、class="ratio-s100"来对中、小屏幕作排列调整例:添加class="ratio80 ratio-s100",即表单元素默认为80%宽度占比,视窗像素小于750px则转换为100%宽度占比
<form>
<ul class="form ratio80 ratio-s100">
<li>
<span>E-mail</span>
<div><input type="text"></div>
</li>
<li>
<span>Password</span>
<div><input type="text"></div>
</li>
<li>
<div><label><input type="checkbox">Remember me</label></div>
</li>
<li>
<div><button type="button" class="btn">Submit</button></div>
</li>
</ul>
</form>
向右对齐Align Right
添加class="tr"使文本向右对齐
<form>
<ul class="form ratio60 tr">
...
</ul>
</form>
纯文本Text
为<div>元素添加class="text"
<form>
<ul class="form ratio80 ratio-s100">
<li>
<span>E-mail</span>
<div class="text">diquick@qq.com</div>
</li>
<li>
<span>Password</span>
<div><input type="text"></div>
</li>
</ul>
</form>
图标元素Text
为<div>元素添加class="icon",并在input元素前添加图标元素
<form>
<ul class="form ratio80 ratio-s100">
<li>
<span>E-mail</span>
<div class="icon"><i class="flaticon-email89"></i><input type="text"></div>
</li>
<li>
<span>Password</span>
<div class="icon"><i class="flaticon-locked44"></i><input type="text"></div>
</li>
</ul>
</form>
Input
<form>
<ul class="form ratio80 ratio-s100">
<li>
<span>Not border</span>
<div><input type="text" class="notborder" placeholder="Not border"></div>
</li>
<li>
<span><p>Note</span>
<div>
<input type="text">
<p>We just need a little more info to create your account</p>
</div>
</li>
<li>
<span>Active</span>
<div><input type="text" class="active"></div>
</li>
<li>
<span>Disabled</span>
<div><input type="text" disabled></div>
</li>
<li>
<span>checkbox,radio</span>
<div>
<label><input type="checkbox"><i class="flaticon-design25 mr3"></i>Icon</label>
<label class="disabled"><input type="checkbox" disabled>Disabled</label>
</div>
</li>
<li>
<div>
<label class="line"><input type="radio" name="z3">line</label>
<label class="line"><input type="radio" name="z3">line</label>
</div>
</li>
<li>
<div>
<label class="line">
<input type="checkbox">Note
<p>By signing in you agree to the terms of the User Agreement and Privacy Policy.</p>
</label>
</div>
</li>
</ul>
</form>
Select
<form>
<ul class="form ratio80 ratio-s100">
<li>
<span>Note</span>
<div>
<select>
<option>Note</option>
<option value="text1">text1</option>
<option value="text2">text2</option>
<option value="text3">text3</option>
</select>
<p>We just need a little more info to create your account</p>
</div>
</li>
<li>
<span>Line</span>
<div>
<select class="line">
<option>class="line"</option>
<option value="text1">text1</option>
<option value="text2">text2</option>
<option value="text3">text3</option>
</select>
</div>
</li>
<li>
<span>Multiple</span>
<div>
<select class="line" multiple>
<option>class="line"</option>
<option value="text1">text1</option>
<option value="text2">text2</option>
<option value="text3">text3</option>
</select>
</div>
</li>
<li>
<span>Active and Disabled</span>
<div>
<select class="active">
<option>Active</option>
<option value="text1">text1</option>
<option value="text2">text2</option>
<option value="text3">text3</option>
</select>
<select disabled>
<option>Disabled</option>
<option value="text1">text1</option>
<option value="text2">text2</option>
<option value="text3">text3</option>
</select>
</div>
</li>
</ul>
</form>
Textarea
<form>
<ul class="form ratio80 ratio-s100">
<li>
<span>Note</span>
<div><textarea></textarea><p>We just need a little more info to create your account</p></div>
</li>
<li>
<span>Active</span>
<div><textarea class="active"></textarea></div>
</li>
<li>
<span>Disabled</span>
<div><textarea disabled></textarea></div>
</li>
</ul>
</form>
自定义风格Custom Style
可以使用自定义风格工具快速创建CSS
<form>
<ul class="form ratio80 ratio-s100 mystyle">
...
</ul>
</form>
当前内容版权归 diquick.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 diquick.com .