menu MDUI Documentation
color_lens
view_carousel
JavaScript Plug-in
keyboard_arrow_down
local_mall
Resources
keyboard_arrow_down

typesetting

Typesetting

Here are some basic typographic styles:

Example
Display 4
Display 3
Display 2
Display 1
Headline
Title
Subheading
Body 2
Body 1
Caption
<div class="mdui-typo-display-4">Display 4</div>
<div class="mdui-typo-display-3">Display 3</div>
<div class="mdui-typo-display-2">Display 2</div>
<div class="mdui-typo-display-1">Display 1</div>
<div class="mdui-typo-headline">Headline</div>
<div class="mdui-typo-title">Title</div>
<div class="mdui-typo-subheading">Subheading</div>
<div class="mdui-typo-body-2">Body 2</div>
<div class="mdui-typo-body-1">Body 1</div>
<div class="mdui-typo-caption">Caption</div>

Add after the above style class name -opacity You can make these styles have proper opacity:

Example
Display 4
Display 3
Display 2
Display 1
Headline
Title
Subheading
Body 2
Body 1
Caption
<div class="mdui-typo-display-4-opacity">Display 4</div>
<div class="mdui-typo-display-3-opacity">Display 3</div>
<div class="mdui-typo-display-2-opacity">Display 2</div>
<div class="mdui-typo-display-1-opacity">Display 1</div>
<div class="mdui-typo-headline-opacity">Headline</div>
<div class="mdui-typo-title-opacity">Title</div>
<div class="mdui-typo-subheading-opacity">Subheading</div>
<div class="mdui-typo-body-2-opacity">Body 2</div>
<div class="mdui-typo-body-1-opacity">Body 1</div>
<div class="mdui-typo-caption-opacity">Caption</div>

Content layout

In addition to using Normalize.css and setting the font and color of the body element, MDUI does not directly modify the style of other HTML elements.

To make the elements have a typographically optimized style, you need to add a class to the parent element of these elements .mdui-typo

title

Example

h1 title heading

h2 title heading

h3 title heading

h4 title heading

h5 title heading
h6 title heading
<div class="mdui-typo">
  <h1>h1 title heading</h1>
  <h2>h2 title heading</h2>
  <h3>h3 title heading</h3>
  <h4>h4 title heading</h4>
  <h5>h5 title heading</h5>
  <h6>h6 title heading</h6>
</div>

You can also include in the title small Tags to mark subtitles.

Example

h1 title heading subtitle Secondary text

h2 title heading subtitle Secondary text

h3 title heading subtitle Secondary text

h4 title heading subtitle Secondary text

h5 title heading subtitle Secondary text
h6 title heading subtitle Secondary text
<div class="mdui-typo">
  <h1>h1 title heading <small>subtitle Secondary text</small></h1>
  <h2>h2 title heading <small>subtitle Secondary text</small></h2>
  <h3>h3 title heading <small>subtitle Secondary text</small></h3>
  <h4>h4 title heading <small>subtitle Secondary text</small></h4>
  <h5>h5 title heading <small>subtitle Secondary text</small></h5>
  <h6>h6 title heading <small>subtitle Secondary text</small></h6>
</div>

Inline text style

Example

This is a link

Use the mark tag toHighlight text

This line of text is considered deleted text.

This line of text is the element that was inserted forcefully.

This line of text is underlined.

The font of this line of text has been reduced.

This line of text is bolded.

This text is in italics.

Responsive design abbreviation RWD

This line of text contains inline code <code>

Press down Esc You can close the dialog

y = mx + b

<div class="mdui-typo">
  <p><a href="#">This is a link</a></p>
  <p>Use the mark tag to<mark>Highlight text</mark></p>
  <p><del>This line of text is considered deleted text.</del></p>
  <p><ins>This line of text is the element that was inserted forcefully.</ins></p>
  <p><u>This line of text is underlined.</u></p>
  <p><small>The font of this line of text has been reduced.</small></p>
  <p><strong>This line of text is bolded.</strong></p>
  <p><em>This text is in italics.</em></p>
  <p>Responsive design abbreviation <abbr title="Responsive web design">RWD</abbr></p>
  <p>This line of text contains inline code <code>&lt;code&gt;</code></p>
  <p>按下 <kbd>Esc</kbd> You can close the dialog</p>
  <p><var>y</var> = <var>m</var><var>x</var> + <var>b</var></p>
</div>

Horizontal dividing line

Example

<div class="mdui-typo">
  <hr/>
</div>

Quote

Example

No matter where you go, you should remember that the past is false. Memories are an endless road. All the past springs no longer exist. Even the toughest and frantic love in the final analysis is just a fleeting moment. The fleeting reality.

Marquez ——"One Hundred Years of Solitude"
<div class="mdui-typo">
  <blockquote>
    <p>No matter where you go, you should remember that the past is false. Memories are an endless road. All the past springs no longer exist. Even the toughest and frantic love in the final analysis is just a fleeting moment. The fleeting reality.</p>
    <footer>Marquez ——"A Hundred Years of Solitude"</footer>
  </blockquote>
</div>

Code block

Example
window.addEventListener('load', function() {
  FastClick.attach(document.body);
}, false);
<div class="mdui-typo">
  <pre>window.addEventListener('load', function() {
  FastClick.attach(document.body);
}, false);</pre>
</div>

Unordered list

Example
  • entry #1
  • entry #2
    • entry #1
    • entry #2
      • entry #1
      • entry #2
  • entry #3
  • entry #4
<div class="mdui-typo">
  <ul>
    <li>entry #1</li>
    <li>entry #2
      <ul>
        <li>entry #1</li>
        <li>entry #2
          <ul>
            <li>entry #1</li>
            <li>entry #2</li>
          </ul>
        </li>
      </ul>
    </li>
    <li>entry #3</li>
    <li>entry #4</li>
  </ul>
</div>

Ordered list

Example
  1. entry #1
  2. entry #2
    1. entry #1
    2. entry #2
      1. entry #1
      2. entry #2
  3. entry #3
  4. entry #4
<div class="mdui-typo">
  <ol>
    <li>entry #1</li>
    <li>entry #2
      <ol>
        <li>entry #1</li>
        <li>entry #2
          <ol>
            <li>entry #1</li>
            <li>entry #2</li>
          </ol>
        </li>
      </ol>
    </li>
    <li>entry #3</li>
    <li>entry #4</li>
  </ol>
</div>

Article layout example

Add to the parent container of the article content .mdui-typo Class, you can add a predetermined style to the entire article.

中文文章排版实例:论语学而篇第一

作者:孔子

本篇引语

《学而》是《论语》第一篇的篇名。《论语》中各篇一般都是以第一章的前二三个字作为该篇的篇名。《学而》一篇包括16章,内容涉及诸多方面。其中重点是「吾日三省吾身」;「节用而爱人,使民以时」;「礼之用,和为贵」以及仁、孝、信等道德范畴。

原文

子曰:「学而时习之,不亦说乎?有朋自远方来,不亦乐乎?人不知,而不愠,不亦君子乎?」

译文

孔子说:「学了又时常温习和练习,不是很愉快吗?有志同道合的人从远方来,不是很令人高兴的吗?人家不了解我,我也不怨恨、恼怒,不也是一个有德的君子吗?」

评析

宋代著名学者朱熹对此章评价极高,说它是「入道之门,积德之基」。本章这三句话是人们非常熟悉的。历来的解释都是:学了以后,又时常温习和练习,不也高兴吗等等。三句话,一句一个意思,前后句子也没有什么连贯性。但也有人认为这样解释不符合原义,指出这里的「学」不是指学习,而是指学说或主张;「时」不能解为时常,而是时代或社会的意思,「习」不是温习,而是使用,引申为采用。而且,这三句话不是孤立的,而是前后相互连贯的。这三句的意思是:自己的学说,要是被社会采用了,那就太高兴了;退一步说,要是没有被社会所采用,可是很多朋友赞同的学说,纷纷到我这里来讨论问题,我也感到快乐;再退一步说,即使社会不采用,人们也不理解我,我也不怨恨,这样做,不也就是君子吗?(见《齐鲁学刊》1986年第6期文)这种解释可以自圆其说,而且也有一定的道理,供读者在理解本章内容时参考。

此外,在对「人不知,而不愠」一句的解释中,也有人认为,「人不知」的后面没有宾语,人家不知道什么呢?当时因为孔子有说话的特定环境,他不需要说出知道什么,别人就可以理解了,却给后人留下一个谜。有人说,这一句是接上一句说的,从远方来的朋友向我求教,我告诉他,他还不懂,我却不怨恨。这样,「人不知」就是「人家不知道我所讲述的」了。这样的解释似乎有些牵强。

总之,本章提出以学习为乐事,做到人不知而不愠,反映出孔子学而不厌、诲人不倦、注重修养、严格要求自己的主张。这些思想主张在《论语》书中多处可见,有助于对第一章内容的深入了解。

Examples of English Article Typesetting

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

The standard Lorem Ipsum passage, used since the 1500s

"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC

"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"

List style in action

  • If you wish to succeed, you should use persistence as your good friend, experience as your reference, prudence as your brother and hope as your sentry.

    If you want to succeed, you should use perseverance as your good friend, experience as your reference, prudence as your brother, and hope as your sentry.

  • Sometimes one pays most for the things one gets for nothing.

    Sometimes a person pays the highest price for what one gets for nothing.

  • Only those who have the patience to do simple things perfectly ever acquire the skill to do difficult things easily.

    Only those who have the patience to complete simple tasks satisfactorily can accomplish difficult tasks easily.

You may want to create a perfect <hr /> line, despite the fact that there will never have one


La Racheforcauld said: "Few things are impossible in themselves; and it is often for want of will, rather than of means, that man fails to succeed". You just need to follow the browser's behavior, and set a right margin to it。it will works nice as the demo you're watching now. The following code is the best way to render typo in Chinese:

List of CSS class names

Class name effect
.mdui-typo-display-4 Display 4 style
.mdui-typo-display-3 Display 3 style
.mdui-typo-display-2 Display 2 style
.mdui-typo-display-1 Display 1 style
.mdui-typo-headline Headline style
.mdui-typo-title Title style
.mdui-typo-subheading Subheading style
.mdui-typo-body-2 Body 2 style
.mdui-typo-body-1 Body 1 style
.mdui-typo-caption Caption style
.mdui-typo-display-4-opacity With opacity Display 4 style
.mdui-typo-display-3-opacity With opacity Display 3 style
.mdui-typo-display-2-opacity With opacity Display 2 style
.mdui-typo-display-1-opacity With opacity Display 1 style
.mdui-typo-headline-opacity With opacity Headline style
.mdui-typo-title-opacity With opacity Title style
.mdui-typo-subheading-opacity With opacity Subheading style
.mdui-typo-body-2-opacity With opacity Body 2 style
.mdui-typo-body-1-opacity With opacity Body 1 style
.mdui-typo-caption-opacity With opacity Caption style
.mdui-typo Assign a typographic style to the elements within the element
Set document theme

Theme color

Main color

Accent color