Foundation 輸入框 尺寸


使用網格的欄位來設定輸入框的大小,如 .large-6, .medium-6, 等。

更多網格系統知識,可以點選 網格系統 教學。

實例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>

<body>

<form>
<div class="row">
  <h2>使用网格设置输入框大小</h2>
  <div class="large-10 medium-7 columns">
    <label>large-10 medium-7 (100% on small)
      <input type="text" placeholder="Name">
    </label>
  </div>
</div>

<div class="row">
  <div class="small-5 columns">
    <label>small-5
      <input type="text" placeholder="Name">
    </label>
  </div>
</div>

<div class="row">
  <div class="medium-3 columns">
    <label>medium-3 (100% on small)
      <input type="text" placeholder="Name">
    </label>
  </div>
</div>

<div class="row">
  <div class="medium-4 columns">
    <label>medium-4 (100% on small, stacked)
      <input type="text" placeholder="Name">
    </label>
  </div>

  <div class="medium-4 columns">
    <label>medium-4 (100% on small, stacked)
      <input type="text" placeholder="Name">
    </label>
  </div>

  <div class="medium-4 columns">
    <label>medium-4 (100% on small, stacked)
      <input type="text" placeholder="Name">
    </label>
  </div>
</div>
</form>

</body>
</html>

運行實例»

點擊"運行實例" 按鈕查看線上實例


相等大小列

以下示範了相等大小列的實例:

#實例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>

<body>

<form>
  <div class="row">
    <h2>三个相等宽度的输入框</h2>
    <div class="medium-4 columns">
      <label>medium-4 (100% on small, stacked)
        <input type="text" placeholder="Name">
      </label>
    </div>

    <div class="medium-4 columns">
      <label>medium-4 (100% on small, stacked)
        <input type="text" placeholder="Name">
      </label>
    </div>

    <div class="medium-4 columns">
      <label>medium-4 (100% on small, stacked)
        <input type="text" placeholder="Name">
      </label>
    </div>
  </div>
</form>

</body>
</html>

運行實例»

點擊"運行實例" 按鈕查看線上實例


#內嵌標籤

#如果你希望你的標籤內容顯示在左邊(不是上邊),可以將標籤元素label 放在輸入框左邊的不同的列上,並使用.inline 類別來設定垂直居中:

實例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>

<body>

<form>
  <div class="row">
    <h2>内联标签 Label</h2>
    <p><strong>提示:</strong> 如果你需要标签显示在左边,可以移除 .right 类。</p>
    <div class="small-8">
      <div class="row">
        <div class="small-3 columns">
          <label for="name" class="inline right">Name</label>
        </div>
        <div class="small-9 columns">
          <input type="text" id="name" placeholder="First Name..">
        </div>
      </div>
    </div>
  </div>
</form>

</body>
</html>

運行實例»

點擊"運行實例"按鈕查看線上實例


前置和後置標籤

你可以在<div class="row collapse"> 中加入前置和後置標籤,元素為: <element class= "postfix"><element class="prefix">。可以使用網格系統來設定前置和後置標籤的大小:

#實例

#
<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>

<body>

<form>
  <div class="row">
    <h2>前置后置标签</h2>
    <div class="large-6 columns">
      <div class="row collapse prefix-radius">
        <div class="small-3 columns">
          <span class="prefix">前置</span>
        </div>
        <div class="small-9 columns">
          <input type="text" placeholder="Value">
        </div>
      </div>
    </div>
    <div class="large-6 columns">
      <div class="row collapse postfix-radius">
        <div class="small-9 columns">
          <input type="text" placeholder="Value">
        </div>
        <div class="small-3 columns">
          <span class="postfix">后置</span>
        </div>
      </div>
    </div>
  </div>
</form>

</body>
</html>

運行實例»

點擊"運行實例" 按鈕查看線上實例

前置和後置標籤按鈕#可以使用<a> 元素新增

. button
類別來設定前置和後置按鈕:

實例

#
<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>

<body>

<form>
  <div class="row">
    <h2>前置/后置按钮</h2>
    <div class="large-12 columns">
      <div class="row collapse">
        <div class="small-10 columns">
          <input type="text" placeholder="搜索">
        </div>
        <div class="small-2 columns">
          <a href="#" class="button postfix">提交</a>
        </div>
      </div>
    </div>
  </div>
</form>

</body>
</html>

運行實例»

##點擊"運行實例" 按鈕查看線上實例

前置和後置標籤圓角按鈕

#實例
<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>

<body>

<form>
  <div class="row">
    <h2>前置和后置标签</h2>
    <p>圆角前置和后置标签:</p>
    <div class="large-6 columns">
      <div class="row collapse prefix-radius">
        <div class="small-3 columns">
          <span class="prefix">Prefix</span>
        </div>
        <div class="small-9 columns">
          <input type="text" placeholder="Value">
        </div>
      </div>
    </div>
    <div class="large-6 columns">
      <div class="row collapse postfix-radius">
        <div class="small-9 columns">
          <input type="text" placeholder="Value">
        </div>
        <div class="small-3 columns">
          <span class="postfix">Postfix</span>
        </div>
      </div>
    </div>
  </div>
  <div class="row">
    <p>圆形前置和后置标签按钮:</p>
    <div class="large-6 columns">
      <div class="row collapse prefix-round">
        <div class="small-3 columns">
          <a href="#" class="button prefix">Go</a>
        </div>
        <div class="small-9 columns">
          <input type="text" placeholder="Value">
        </div>
      </div>
    </div>
    <div class="large-6 columns">
      <div class="row collapse postfix-round">
        <div class="small-9 columns">
          <input type="text" placeholder="Value">
        </div>
        <div class="small-3 columns">
          <a href="#" class="button postfix">Go</a>
        </div>
      </div>
    </div>
  </div>
</form>

</body>
</html>

運行實例»

點擊"運行實例" 按鈕查看線上實例
###