1 | The cf-typography component includes multiple patterns for headings,
|
2 | links, lists, and other advanced typographic treatments.
|
3 |
|
4 | The [`cf-core`](../core) component is a dependency of this component
|
5 | and has more basic typography patterns.
|
6 |
|
7 |
|
8 | > NOTE: If you use `cf-typography.less` directly,
|
9 | be sure to run the file through
|
10 | [Autoprefixer](https://github.com/postcss/autoprefixer),
|
11 | or your compiled Capital Framework CSS will
|
12 | not work perfectly in older browsers.
|
13 |
|
14 | ## Table of contents
|
15 |
|
16 | - [Variables](#variables)
|
17 | - [Color variables](#color-variables)
|
18 | - [Headings](#headings)
|
19 | - [Heading with icon](#heading-with-icon)
|
20 | - [Headers](#headers)
|
21 | - [Slug header](#slug-header)
|
22 | - [Meta header](#meta-header)
|
23 | - [Link patterns](#link-patterns)
|
24 | - [Links with icons](#links-with-icons)
|
25 | - [Jump link](#jump-link)
|
26 | - [Block link](#block-link)
|
27 | - [Lists](#lists)
|
28 | - [Unstyled list modifier](#unstyled-list-modifier)
|
29 | - [Spaced list modifier](#spaced-list-modifier)
|
30 | - [Horizontal list modifier](#horizontal-list-modifier)
|
31 | - [Link list modifier](#link-list-modifier)
|
32 | - [Miscellaneous text](#miscellaneous-text)
|
33 | - [Micro copy](#micro-copy)
|
34 | - [Date](#date)
|
35 | - [Pull quote](#pull-quote)
|
36 |
|
37 |
|
38 | ## Variables
|
39 |
|
40 | Theme variables for setting the color and sizes. Overwrite them in your own
|
41 | project by duplicating the variable `@key: value`.
|
42 |
|
43 | ### Font variables
|
44 |
|
45 | ```
|
46 | @webfont-regular: 'AvenirNextLTW01-Regular';
|
47 | @webfont-italic: 'AvenirNextLTW01-Italic';
|
48 | @webfont-medium: 'AvenirNextLTW01-Medium';
|
49 | @webfont-demi: 'AvenirNextLTW01-Demi';
|
50 | ```
|
51 |
|
52 | ### Color variables
|
53 |
|
54 | Color variables referenced in comments are from [cf-core cf-brand-colors.less](https://github.com/cfpb/capital-framework/blob/master/src/cf-core/src/cf-brand-colors.less).
|
55 |
|
56 | ```
|
57 | // Running text elements
|
58 |
|
59 | // .a-micro-copy
|
60 | @micro-copy: @black;
|
61 |
|
62 | // .a-date
|
63 | @date: @gray;
|
64 |
|
65 | // .m-pull-quote
|
66 | @pull-quote_body: @black;
|
67 | @pull-quote_citation: @gray;
|
68 |
|
69 | // Headings
|
70 |
|
71 | // .a-heading__icon
|
72 | @heading__icon: @black;
|
73 | @heading__icon__hover: @link-text-hover;
|
74 |
|
75 | // Headers
|
76 |
|
77 | // .m-slug-header
|
78 | @slug-header_border__thin: @gray-10;
|
79 | @slug-header_border__thick: @green;
|
80 |
|
81 | // .m-meta-header
|
82 | @meta-header_border: @gray-40;
|
83 |
|
84 | // Links
|
85 |
|
86 | // .a-link__jump
|
87 | @jump-link_bg: @gray-10;
|
88 | @jump-link_border: @gray-40;
|
89 | ```
|
90 |
|
91 |
|
92 | ### Heading with icon
|
93 |
|
94 | The heading with icon is typically used for listing categories in a meta
|
95 | header. Since categories can be repetitive, we suggest placing a label with
|
96 | `.u-visually-hidden` prior to the headings to add more context for screen
|
97 | readers (see Meta Header below).
|
98 |
|
99 | <a href="#" class="a-heading a-heading__icon">
|
100 | <span class="cf-icon cf-icon-dialogue"></span>
|
101 | Consumer finance
|
102 | </a>
|
103 |
|
104 | ```
|
105 | <a href="#" class="a-heading a-heading__icon">
|
106 | <span class="cf-icon cf-icon-dialogue"></span>
|
107 | Consumer finance
|
108 | </a>
|
109 | ```
|
110 |
|
111 |
|
112 | ## Headers
|
113 |
|
114 | ### Slug header
|
115 |
|
116 | <header class="m-slug-header">
|
117 | <h2 class="a-heading">
|
118 | Blog summary
|
119 | </h2>
|
120 | </header>
|
121 |
|
122 | ```
|
123 | <header class="m-slug-header">
|
124 | <h2 class="a-heading">
|
125 | Blog summary
|
126 | </h2>
|
127 | </header>
|
128 | ```
|
129 |
|
130 | ### Meta header
|
131 |
|
132 | Note that the example shows `.m-meta-header_left` using the `.a-heading__icon`
|
133 | pattern and `.m-meta-header_right` using the `.a-date` pattern but you could use
|
134 | other patterns in place of them. Or you can even swap them so that date is
|
135 | attached to `.m-meta-header_left` and `.a-heading.a-heading__icon` is attached to
|
136 | `.m-meta-header_right`.
|
137 |
|
138 | #### Default meta header
|
139 |
|
140 | <header class="m-meta-header">
|
141 | <div class="m-meta-header_right">
|
142 | <span class="a-date">
|
143 | Nov 4, 2013
|
144 | </span>
|
145 | </div>
|
146 | <div class="m-meta-header_left">
|
147 | <span class="u-visually-hidden">Categories: </span>
|
148 | <a href="#" class="a-heading a-heading__icon">
|
149 | <span class="cf-icon cf-icon-credit-card"></span>
|
150 | Consumer finance
|
151 | </a>
|
152 | |
|
153 | <a href="#" class="a-heading a-heading__icon">
|
154 | <span class="cf-icon cf-icon-credit-card"></span>
|
155 | Consumer finance
|
156 | </a>
|
157 | </div>
|
158 | </header>
|
159 |
|
160 |
|
161 | ## Link patterns
|
162 |
|
163 | ### Links with icons
|
164 |
|
165 | - Styles to enable adding an icon to a link and preventing the link's underline
|
166 | from extending under the icon.
|
167 | - For the underlined icon prevention to work, you must wrap the link text with
|
168 | a `span.icon-link_text`. There can be no whitespace between the text and the
|
169 | opening and closing `span` tags.
|
170 |
|
171 | #### Default pattern
|
172 |
|
173 | - The modifier names match the cf-icon names of commonly-used icons.
|
174 | - Icons appear to the right of a link, by default.
|
175 |
|
176 | <p>
|
177 | For more information, email
|
178 | <a class="a-link
|
179 | a-link__icon
|
180 | cf-icon
|
181 | cf-icon__after
|
182 | cf-icon-mail"
|
183 | href="#">
|
184 | <span class="a-link_text">john.smith@cfpb.gov</span>
|
185 | </a>.
|
186 | Alternatively, you can
|
187 | <a class="a-link
|
188 | a-link__icon
|
189 | cf-icon
|
190 | cf-icon__after
|
191 | cf-icon-download"
|
192 | href="#">
|
193 | <span class="a-link_text">download the info sheet</span>
|
194 | </a>.
|
195 | Oh, you might also want to visit this
|
196 | <a class="a-link
|
197 | a-link__icon
|
198 | cf-icon
|
199 | cf-icon__after
|
200 | cf-icon-external-link"
|
201 | href="#">
|
202 | <span class="a-link_text">other organization's website</span>
|
203 | </a> for further details.
|
204 | </p>
|
205 |
|
206 |
|
207 | ```
|
208 | <p>
|
209 | For more information, email
|
210 | <a class="a-link
|
211 | a-link__icon
|
212 | cf-icon
|
213 | cf-icon__after
|
214 | cf-icon-mail"
|
215 | href="#">
|
216 | <span class="a-link_text">john.smith@cfpb.gov</span>
|
217 | </a>.
|
218 | Alternatively, you can
|
219 | <a class="a-link
|
220 | a-link__icon
|
221 | cf-icon
|
222 | cf-icon__after
|
223 | cf-icon-download"
|
224 | href="#">
|
225 | <span class="a-link_text">download the info sheet</span>
|
226 | </a>.
|
227 | Oh, you might also want to visit this
|
228 | <a class="a-link
|
229 | a-link__icon
|
230 | cf-icon
|
231 | cf-icon__after
|
232 | cf-icon-external-link"
|
233 | href="#">
|
234 | <span class="a-link_text">other organization's website</span>
|
235 | </a> for further details.
|
236 | </p>
|
237 | ```
|
238 |
|
239 | #### Links with icons on the left
|
240 |
|
241 | - Simply add the `.icon-link__before` modifier to place the icon before the
|
242 | link text.
|
243 | - You can omit the `span.icon-link_text` wrapper if you do not need an
|
244 | underline on a particular link.
|
245 |
|
246 | <a class="a-link a-link__icon
|
247 | cf-icon
|
248 | cf-icon__before
|
249 | cf-icon-mail"
|
250 | href="#">
|
251 | <span class="a-link_text">john.smith@cfpb.gov</span>
|
252 | </a><br>
|
253 | <a class="a-link
|
254 | a-link__icon
|
255 | cf-icon
|
256 | cf-icon__before
|
257 | cf-icon-phone"
|
258 | href="#">
|
259 | <span class="a-link_text">(123) 456-7890</span>
|
260 | </a>
|
261 |
|
262 | ```
|
263 | <a class="a-link a-link__icon
|
264 | cf-icon
|
265 | cf-icon__before
|
266 | cf-icon-mail"
|
267 | href="#">
|
268 | <span class="a-link_text">john.smith@cfpb.gov</span>
|
269 | </a><br>
|
270 | <a class="a-link
|
271 | a-link__icon
|
272 | cf-icon
|
273 | cf-icon__before
|
274 | cf-icon-phone"
|
275 | href="#">
|
276 | <span class="a-link_text">(123) 456-7890</span>
|
277 | </a>
|
278 | ```
|
279 |
|
280 | #### Non-wrapping icon links
|
281 |
|
282 | - Warning: Icons added to inline links can sometimes break onto the next line.
|
283 | If you want to prevent this, you can add the `__no-wrap` modifier to
|
284 | `.icon-link`.
|
285 |
|
286 |
|
287 | For more information, email
|
288 | <a class="a-link
|
289 | a-link__icon
|
290 | a-link__no-wrap
|
291 | cf-icon
|
292 | cf-icon__after
|
293 | cf-icon-mail"
|
294 | href="#">
|
295 | <span class="a-link_text">john.smith@cfpb.gov</span>
|
296 | </a>.
|
297 |
|
298 | ```
|
299 |
|
300 | For more information, email
|
301 | <a class="a-link
|
302 | a-link__icon
|
303 | a-link__no-wrap
|
304 | cf-icon
|
305 | cf-icon__after
|
306 | cf-icon-mail"
|
307 | href="#">
|
308 | <span class="a-link_text">john.smith@cfpb.gov</span>
|
309 | </a>.
|
310 | ```
|
311 |
|
312 | ### Jump link
|
313 |
|
314 | <a class="a-link
|
315 | a-link__jump
|
316 | cf-icon
|
317 | cf-icon__after
|
318 | cf-icon-right"
|
319 | href="#">
|
320 | <span class="a-link_text">Default jump link</span>
|
321 | </a>
|
322 |
|
323 | ```
|
324 | <a class="a-link
|
325 | a-link__jump
|
326 | cf-icon
|
327 | cf-icon__after
|
328 | cf-icon-right"
|
329 | href="#">
|
330 | <span class="a-link_text">Default jump link</span>
|
331 | </a>
|
332 | ```
|
333 |
|
334 | #### Jump link with large link modifier
|
335 |
|
336 | The large jump link has an `18px` `font-size`, compared to the default of `16px`.
|
337 |
|
338 | <a class="a-link
|
339 | a-link__jump
|
340 | a-link__large
|
341 | cf-icon
|
342 | cf-icon__after
|
343 | cf-icon-right"
|
344 | href="#">
|
345 | <span class="a-link_text">Large jump link</span>
|
346 | </a>
|
347 |
|
348 | ```
|
349 | <a class="a-link
|
350 | a-link__jump
|
351 | a-link__large
|
352 | cf-icon
|
353 | cf-icon__after
|
354 | cf-icon-right"
|
355 | href="#">
|
356 | <span class="a-link_text">Large jump link</span>
|
357 | </a>
|
358 | ```
|
359 |
|
360 | #### Jump link with before link modifier
|
361 |
|
362 | Jump links can also have icons before the text, like icon links.
|
363 |
|
364 | <a class="a-link
|
365 | a-link__jump
|
366 | cf-icon
|
367 | cf-icon__before
|
368 | cf-icon-left"
|
369 | href="#">
|
370 | <span class="a-link_text">Jump link with icon on left</span>
|
371 | </a>
|
372 |
|
373 | ```
|
374 | <a class="a-link
|
375 | a-link__jump
|
376 | cf-icon
|
377 | cf-icon__before
|
378 | cf-icon-left"
|
379 | href="#">
|
380 | <span class="a-link_text">Jump link with icon on left</span>
|
381 | </a>
|
382 | ```
|
383 |
|
384 | #### Jump link with bg link modifier (only visible on small screens)
|
385 |
|
386 | <a class="a-link
|
387 | a-link__jump
|
388 | a-link__bg
|
389 | cf-icon
|
390 | cf-icon__after
|
391 | cf-icon-right"
|
392 | href="#">
|
393 | <span class="a-link_text">Jump link with grey background and
|
394 | solid borders on small screens</span>
|
395 | </a>
|
396 |
|
397 | ```
|
398 | <a class="a-link
|
399 | a-link__jump
|
400 | a-link__bg
|
401 | cf-icon
|
402 | cf-icon__after
|
403 | cf-icon-right"
|
404 | href="#">
|
405 | <span class="a-link_text">Jump link with grey background and
|
406 | solid borders on small screens</span>
|
407 | </a>
|
408 | ```
|
409 |
|
410 | ### Block link
|
411 |
|
412 | The block link class converts a standard inline link to a block-level element
|
413 | with `padding`, `background`, and `border`.
|
414 |
|
415 | It is primarily used within a max-width `@bp-xs-max` media query
|
416 | (see `.link__jump` and `.list__links`).
|
417 |
|
418 | <a class="a-link__block" href="#">
|
419 | Default block link
|
420 | </a>
|
421 |
|
422 | ```
|
423 | <a class="a-link__block" href="#">
|
424 | Default block link
|
425 | </a>
|
426 | ```
|
427 |
|
428 |
|
429 | ## Lists
|
430 |
|
431 | ### Unstyled list modifier
|
432 |
|
433 | Unstyled list removes bullets and other styling from a list.
|
434 |
|
435 | <ul class="m-list m-list__unstyled">
|
436 | <li class="m-list_item">List item 1</li>
|
437 | <li class="m-list_item">List item 2</li>
|
438 | <li class="m-list_item">List item 3</li>
|
439 | </ul>
|
440 |
|
441 | ```
|
442 | <ul class="m-list m-list__unstyled">
|
443 | <li class="m-list_item">List item 1</li>
|
444 | <li class="m-list_item">List item 2</li>
|
445 | <li class="m-list_item">List item 3</li>
|
446 | </ul>
|
447 | ```
|
448 |
|
449 | ### Spaced list modifier
|
450 |
|
451 | Spaced list adds extra padding to every element in a list.
|
452 |
|
453 | #### Default spaced list
|
454 |
|
455 | <ul class="m-list m-list__spaced">
|
456 | <li class="m-list_item">List item 1</li>
|
457 | <li class="m-list_item">List item 2</li>
|
458 | <li class="m-list_item">List item 3</li>
|
459 | </ul>
|
460 |
|
461 | ```
|
462 | <ul class="m-list m-list__spaced">
|
463 | <li class="m-list_item">List item 1</li>
|
464 | <li class="m-list_item">List item 2</li>
|
465 | <li class="m-list_item">List item 3</li>
|
466 | </ul>
|
467 | ```
|
468 |
|
469 | #### Nested list example
|
470 |
|
471 | <ul class="m-list m-list__spaced">
|
472 | <li class="m-list_item">List item 1</li>
|
473 | <li class="m-list_item">
|
474 | List item 2
|
475 | <ul class="m-list m-list__spaced">
|
476 | <li class="m-list_item">List item 2a</li>
|
477 | <li class="m-list_item">List item 2b</li>
|
478 | <li class="m-list_item">List item 2c</li>
|
479 | </ul>
|
480 | </li>
|
481 | <li class="m-list_item">List item 3</li>
|
482 | </ul>
|
483 |
|
484 | ```
|
485 | <ul class="m-list m-list__spaced">
|
486 | <li class="m-list_item">List item 1</li>
|
487 | <li class="m-list_item">
|
488 | List item 2
|
489 | <ul class="m-list m-list__spaced">
|
490 | <li class="m-list_item">List item 2a</li>
|
491 | <li class="m-list_item">List item 2b</li>
|
492 | <li class="m-list_item">List item 2c</li>
|
493 | </ul>
|
494 | </li>
|
495 | <li class="m-list_item">List item 3</li>
|
496 | </ul>
|
497 | ```
|
498 |
|
499 | ### Horizontal list modifier
|
500 |
|
501 | A modifier for the list to make it show items horizontally.
|
502 |
|
503 | <ul class="m-list m-list__horizontal">
|
504 | <li class="m-list_item">List item 1</li>
|
505 | <li class="m-list_item">List item 2</li>
|
506 | <li class="m-list_item">List item 3</li>
|
507 | </ul>
|
508 |
|
509 | ```
|
510 | <ul class="m-list m-list__horizontal">
|
511 | <li class="m-list_item">List item 1</li>
|
512 | <li class="m-list_item">List item 2</li>
|
513 | <li class="m-list_item">List item 3</li>
|
514 | </ul>
|
515 | ```
|
516 |
|
517 | ### Link list modifier
|
518 |
|
519 | The link list modifier is intended to be used for lists where each item is a
|
520 | link. It converts to a finger-friendly link with a large tap area on smaller
|
521 | screens.
|
522 |
|
523 | <ul class="m-list m-list__links">
|
524 | <li class="m-list_item">
|
525 | <a class="m-list_link" href="#">List item 1</a>
|
526 | </li>
|
527 | <li class="m-list_item">
|
528 | <a class="m-list_link" href="#">List item 2</a>
|
529 | </li>
|
530 | <li class="m-list_item">
|
531 | <a class="m-list_link" href="#">List item 3</a>
|
532 | </li>
|
533 | </ul>
|
534 |
|
535 | ```
|
536 | <ul class="m-list m-list__links">
|
537 | <li class="m-list_item">
|
538 | <a class="m-list_link" href="#">List item 1</a>
|
539 | </li>
|
540 | <li class="m-list_item">
|
541 | <a class="m-list_link" href="#">List item 2</a>
|
542 | </li>
|
543 | <li class="m-list_item">
|
544 | <a class="m-list_link" href="#">List item 3</a>
|
545 | </li>
|
546 | </ul>
|
547 | ```
|
548 |
|
549 | ## Miscellaneous Text
|
550 |
|
551 | ### Micro copy
|
552 |
|
553 | The `.a-micro-copy` class is good for highlighting small pieces of text,
|
554 | typically legal copy.
|
555 |
|
556 | <p class="a-micro-copy">
|
557 | Lorem ipsum dolor sit amet
|
558 | </p>
|
559 |
|
560 | ```
|
561 | <p class="a-micro-copy">
|
562 | Lorem ipsum dolor sit amet
|
563 | </p>
|
564 | ```
|
565 |
|
566 | ### Date
|
567 |
|
568 | <span class="a-date">
|
569 | Nov 4, 2013
|
570 | </span>
|
571 |
|
572 | ```
|
573 | <span class="a-date">
|
574 | Nov 4, 2013
|
575 | </span>
|
576 | ```
|
577 |
|
578 | ### Pull quote
|
579 |
|
580 | Use a pull quote to highlight excerpts from the current work.
|
581 | This is not to be confused with `blockquote` which quotes from an external
|
582 | work. Since a pull quote is an excerpt and repeats content from the article
|
583 | you should use the `aside` element.
|
584 |
|
585 | #### Default pull quote
|
586 |
|
587 | <aside class="m-pull-quote">
|
588 | <p class="m-pull-quote_body">
|
589 | Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
590 | Cum corrupti tempora nam nihil qui mollitia consectetur
|
591 | corporis nemo culpa dolorum!
|
592 | </p>
|
593 | <footer>
|
594 | <cite class="m-pull-quote_citation">
|
595 | Author Name
|
596 | </cite>
|
597 | </footer>
|
598 | </aside>
|
599 |
|
600 |
|
601 | ```
|
602 | <aside class="m-pull-quote">
|
603 | <p class="m-pull-quote_body">
|
604 | Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
605 | Cum corrupti tempora nam nihil qui mollitia consectetur
|
606 | corporis nemo culpa dolorum!
|
607 | </p>
|
608 | <footer>
|
609 | <cite class="m-pull-quote_citation">
|
610 | Author Name
|
611 | </cite>
|
612 | </footer>
|
613 | </aside>
|
614 | ```
|
615 |
|
616 | #### Large pull quote
|
617 |
|
618 | <aside class="m-pull-quote m-pull-quote__large">
|
619 | <div class="m-pull-quote_body">
|
620 | Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
621 | Cum corrupti tempora nam nihil qui mollitia consectetur
|
622 | corporis nemo culpa dolorum!
|
623 | </div>
|
624 | <footer>
|
625 | <cite class="m-pull-quote_citation">
|
626 | Author Name
|
627 | </cite>
|
628 | </footer>
|
629 | </aside>
|
630 |
|
631 | ```
|
632 | <aside class="m-pull-quote m-pull-quote__large">
|
633 | <div class="m-pull-quote_body">
|
634 | Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
635 | Cum corrupti tempora nam nihil qui mollitia consectetur
|
636 | corporis nemo culpa dolorum!
|
637 | </div>
|
638 | <footer>
|
639 | <cite class="m-pull-quote_citation">
|
640 | Author Name
|
641 | </cite>
|
642 | </footer>
|
643 | </aside>
|
644 | ```
|