目录

文字对齐(Text Alignment)

描述 (Description)

可以通过添加.text-left, .text-right, .text-center.textjustify类来对齐元素的文本。 通过在文本对齐类的前面放置断点,将使对齐仅应用于该屏幕大小或更大的屏幕大小。 例如, .medium-textcenter将在最小屏幕上将文本对齐到左侧,但在屏幕大小为中等和更大时更改为中心。

例子 (Example)

以下示例演示了在Foundation中使用text alignment

<html>
   <head>
      <title>Text Alignment</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/css/foundation.css">
   </head>
   <body>
      <p class = "text-left">Foundation is one of the advanced front-end framework
         for designing beautiful responsive websites. It works on all types of
         devices and provides you with HTML, CSS and JavaScript plugins.
      </p>
      <p class = "text-right">Foundation is one of the advanced front-end
         framework for designing beautiful responsive websites. It works on all
         types of devices and provides you with HTML, CSS and JavaScript plugins.
      </p>
      <p class = "text-center">Foundation is one of the advanced front-end
         framework for designing beautiful responsive websites. It works on all
         types of devices and provides you with HTML, CSS and JavaScript plugins.
      </p>
      <p class = "text-justify">Foundation is one of the advanced front-end
         framework for designing beautiful responsive websites. It works on all
         types of devices and provides you with HTML, CSS and JavaScript plugins.
      </p>
      <p class = "medium-text-center">Foundation is one of the advanced front-end 
         framework for designing beautiful responsive websites. It works on all
         types of devices and provides you with HTML, CSS and JavaScript plugins.
      </p>
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/foundation.min.js"></script>
      <script>
         $(document).ready(function() {
            $(document).foundation();
         })
      </script>
   </body>
</html>

输出 (Output)

让我们执行以下步骤,看看上面给出的代码是如何工作的 -

  • 保存上面给出的html代码typography_text_alignment.html文件。

  • 在浏览器中打开此HTML文件,输出显示如下。

新页面打开
↑回到顶部↑
WIKI教程 @2018