Foundation 文字


Foundation 預設設定

Foundation 使用瀏覽器預設字體大小 (font-size:100%)。對於大多數桌面瀏覽器來說,字體預設為 16px。對於大多數行動裝置瀏覽器來說,字體預設為 12px。預設的字體為 "Helvetica Neue", line-height 預設為 1.5

以上預設的設定都是針對 <body> 元素。


Foundation 文字排列設計

本章節我們將討論 Foundation 的文字排列設計。

以下實例的真實樣式請透過點擊"嘗試"按鈕查看。


<h1> - <h6>

Foundation 渲染的HTML 標題(<h1><h6> ;) 如下所示:

實例

<!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>

<div style="padding:20px;">
  <h2>标题</h2>
  <p>标题不同元素字体大小不一样。以下字体默认加粗,不同设备尺寸显示的字体也是不一样的,你可以通过重置浏览器窗口大小查看效果。</p>
  <h1>h1 标题 (<strong>2.125rem</strong> - 2.75rem)</h1>
  <h2>h2 标题 (<strong>1.6875rem</strong> - 2.3125rem)</h2>
  <h3>h3 标题 (<strong>1.375rem</strong> - 1.6875rem)</h3>
  <h4>h4 标题 (<strong>1.125rem</strong> - 1.4375rem)</h4>
  <h5>h5 标题 (1.125rem)</h5>
  <h6>h6 标题 (1rem)</h6>
</div>

</body>
</html>

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

提示: 如果需要建立一個淺色的標題,可以在元素上新增.subheader 類別:

實例

<!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>

<div style="padding:20px;">
<h2>副标题</h2>
<p> .subheader 类让标题的文本颜色变浅。</p>
<h1 class="subheader">h1.subheader</h1>
<h2 class="subheader">h2.subheader</h2>
<h3 class="subheader">h3.subheader</h3>
<h4 class="subheader">h4.subheader</h4>
<h5 class="subheader">h5.subheader</h5>
<h6 class="subheader">h6.subheader</h6>
</div>

</body>
</html>

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


<small>

在Foundation 中, HTML

<small> 元素用於建立一個淺色的副標題:

實例

<!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>

<div style="padding:20px;">
  <h2>Small</h2>
  <p>small 元素用于创建一个浅色的副标题。</p>
  <h1>h1 heading <small>secondary text</small></h1>
  <h2>h2 heading <small>secondary text</small></h2>
  <h3>h3 heading <small>secondary text</small></h3>
  <h4>h4 heading <small>secondary text</small></h4>
  <h5>h5 heading <small>secondary text</small></h5>
  <h6>h6 heading <small>secondary text</small></h6>
</div>

</body>
</html>

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

<a>

#實例

<!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>

<div style="padding:20px;">
  <h2>链接</h2>    
  <p>Foundation 的 <a href="#">链接样式</a>。</p>
</div>

</body>
</html>

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

<abbr>

Foundation

<abbr>

元素的樣式如下所示:##實例

<!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>

<div style="padding:20px;">
  <h2>Abbreviations</h2>
  <p>abbr 元素用于标签指示简称或缩写。</p>
  <p>The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.</p>
</div>

</body>
</html>

運行實例»

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

#<blockquote>

Foundation

< ;blockquote>

元素的樣式如下所示:

實例

#
<!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>

<div style="padding:20px;">
  <h2>引用</h2>
  <p>blockquote 元素用于定义块引用。</p>
  <blockquote>
    <p> php中文网</p>
    <cite>php中文网</cite>
  </blockquote>
</div>

</body>
</html>

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

<dl>

Foundation
<dl>
元素的樣式如下所示:

實例

<!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>

<div style="padding:20px;">
  <h2>描述列表</h2>    
  <p>dl 元素用于定义一个描述性列表:</p>
  <dl>
    <dt>Coffee</dt>
    <dd>- black hot drink</dd>
    <dt>Milk</dt>
    <dd>- white cold drink</dd>
  </dl>
</div>
       
</body>
</html>


運行實例»

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


#<code>

#Foundation <code> 元素的樣式如下所示:

實例

#
<!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>

<div style="padding:20px;">
  <h2>Code 片段</h2>
  <p>代码片段展示可以使用 code 元素:</p>
  <p>以下 HTML 元素: <code>span</code>, <code>section</code>, 和 <code>div</code> 是文档的一部分。</p>
</div>
  
</body>
</html>

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


<kbd>

Foundation

<kbd> 元素的樣式如下所示:

實例

<!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>

<div style="padding:20px;">
  <h2>键盘输入</h2>
  <p>使用 kbd 元素来接收键盘的输入指令:</p>
  <p>按下 <kbd>ctrl + p</kbd> 键打开打印窗口。</p>
</div>

</body>
</html>

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


<hr>

Foundation

<hr> 元素的樣式如下圖:

##實例

<!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>

<div style="padding:20px;">
  <h2>水平线</h2>
  <p>Foundation 中 hr 元素是灰色的。</p>
  <hr>
</div>

</body>
</html>

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

#