少有人走的路

勇哥的工业自动化技术网站

前端框架Foundation6.8.1的演示(六)Forms



(1)文本输入

textdatedatetimedatetime-localemailmonthnumberpasswordsearchteltimeurl,  week

    <form>
        <div class="grid-container">
            <div class="grid-x grid-padding-x">
                <div class="medium-6 cell">
                    <label>
                        Input Password
                        <input type="password" placeholder=".medium-6.cell">
                    </label>
                </div>
                <div class="medium-6 cell">
                    <label>
                        Input Date
                        <input type="date" placeholder=".medium-6.cell">
                    </label>
                </div>
                <div class="medium-6 cell">
                    <label>
                        Input Email
                        <input type="email" placeholder="xxx@">
                    </label>
                </div>
            </div>
        </div>
    </form>

image.png

(2)数值输入

<label>
  How many puppies?
  <input type="number" value="100">
</label>

image.png


(3)可以手动大小的文本区域

<label>
  What books did you read over summer break?
  <textarea placeholder="None"></textarea>
</label>

image.png

(4)选择菜单,相当于C#桌面程序的Combox控件

<label>Select Menu
  <select>
    <option value="husker">Husker</option>
    <option value="starbuck">Starbuck</option>
    <option value="hotdog">Hot Dog</option>
    <option value="apollo">Apollo</option>
  </select>
</label>

image.png

如果改为<select multiple> 则相当于C#的ListBox控件

image.png


(5)检查框与radio按钮

<div class="grid-x grid-padding-x">
  <fieldset class="large-5 cell">
    <legend>Choose Your Favorite</legend>
    <input type="radio" name="pokemon" value="Red" id="pokemonRed" required><label for="pokemonRed">Red</label>
    <input type="radio" name="pokemon" value="Blue" id="pokemonBlue"><label for="pokemonBlue">Blue</label>
    <input type="radio" name="pokemon" value="Yellow" id="pokemonYellow"><label for="pokemonYellow">Yellow</label>
  </fieldset>
  <fieldset class="large-7 cell">
    <legend>Check these out</legend>
    <input id="checkbox1" type="checkbox"><label for="checkbox1">Checkbox 1</label>
    <input id="checkbox2" type="checkbox"><label for="checkbox2">Checkbox 2</label>
    <input id="checkbox3" type="checkbox"><label for="checkbox3">Checkbox 3</label>
  </fieldset>
</div>

image.png


(6)类似C#的groupbox

<fieldset class="fieldset">
  <legend>Check these out</legend>
  <input id="checkbox12" type="checkbox"><label for="checkbox12">Checkbox 1</label>
  <input id="checkbox22" type="checkbox"><label for="checkbox22">Checkbox 2</label>
  <input id="checkbox32" type="checkbox"><label for="checkbox32">Checkbox 3</label>
</fieldset>

image.png

(7)帮助文本

<label>Password
  <input type="password" aria-describedby="passwordHelpText">
</label>
<p class="help-text" id="passwordHelpText">Your password must have at least 10 characters, a number, and an Emoji.</p>

image.png

(8)类似C#中 lable+一个textbox

有时,您需要一个在输入左侧带有标签的表单。小菜一碟!

可以将标签放在输入左侧的其他单元格或列中。

然后使用类.text right或.foat right(或添加text-align:right)重新对齐标签。

    <form>
        <div class="grid-x grid-padding-x">
            <div class="small-3 cell">
                <label for="right-label" class="text-right">用户名:</label>
            </div>
            <div class="small-9 cell">
                <input type="text" id="right-label" placeholder="输入用户名">
            </div>
        </div>
    </form>

image.png

加一个.middle可以居中对齐:

    <form>
        <div class="grid-x grid-padding-x">
            <div class="small-3 cell">
                <label for="right-label" class="text-right middle">用户名:</label>
            </div>
            <div class="small-9 cell">
                <input type="text" id="right-label" placeholder="输入用户名">
            </div>
        </div>
    </form>

image.png



(9)内联Lable和按钮

<div class="input-group">
  <span class="input-group-label">$</span>
  <input class="input-group-field" type="number">
  <div class="input-group-button">
    <input type="submit" class="button" value="Submit">
  </div>
</div>

image.png


(10)上传文件

<label for="exampleFileUpload" class="button">Upload File</label>
<input type="file" id="exampleFileUpload" class="show-for-sr">

image.png

点击后打开

image.png


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

«    2025年12月    »
1234567
891011121314
15161718192021
22232425262728
293031
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
文章归档
网站收藏
友情链接

Powered By Z-BlogPHP 1.7.3

Copyright www.skcircle.com Rights Reserved.

鄂ICP备18008319号


站长QQ:496103864 微信:abc496103864