Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
---
2
layout: docs
3
title: Text
4
description: Documentation and examples for common text utilities to control alignment, wrapping, weight, and more.
5
group: utilities
6
toc: true
7
---
8
 
9
## Text alignment
10
 
11
Easily realign text to components with text alignment classes.
12
 
13
{{< example >}}
14
<p class="text-justify">Some placeholder text to demonstrate justified text alignment. Will you do the same for me? It's time to face the music I'm no longer your muse. Heard it's beautiful, be the judge and my girls gonna take a vote. I can feel a phoenix inside of me. Heaven is jealous of our love, angels are crying from up above. Yeah, you take me to utopia.</p>
15
{{< /example >}}
16
 
17
For left, right, and center alignment, responsive classes are available that use the same viewport width breakpoints as the grid system.
18
 
19
{{< example >}}
20
<p class="text-left">Left aligned text on all viewport sizes.</p>
21
<p class="text-center">Center aligned text on all viewport sizes.</p>
22
<p class="text-right">Right aligned text on all viewport sizes.</p>
23
 
24
<p class="text-sm-left">Left aligned text on viewports sized SM (small) or wider.</p>
25
<p class="text-md-left">Left aligned text on viewports sized MD (medium) or wider.</p>
26
<p class="text-lg-left">Left aligned text on viewports sized LG (large) or wider.</p>
27
<p class="text-xl-left">Left aligned text on viewports sized XL (extra-large) or wider.</p>
28
{{< /example >}}
29
 
30
## Text wrapping and overflow
31
 
32
Wrap text with a `.text-wrap` class.
33
 
34
{{< example >}}
35
<div class="badge badge-primary text-wrap" style="width: 6rem;">
36
  This text should wrap.
37
</div>
38
{{< /example >}}
39
 
40
Prevent text from wrapping with a `.text-nowrap` class.
41
 
42
{{< example >}}
43
<div class="text-nowrap bd-highlight" style="width: 8rem;">
44
  This text should overflow the parent.
45
</div>
46
{{< /example >}}
47
 
48
For longer content, you can add a `.text-truncate` class to truncate the text with an ellipsis. **Requires `display: inline-block` or `display: block`.**
49
 
50
{{< example >}}
51
<!-- Block level -->
52
<div class="row">
53
  <div class="col-2 text-truncate">
54
    Praeterea iter est quasdam res quas ex communi.
55
  </div>
56
</div>
57
 
58
<!-- Inline level -->
59
<span class="d-inline-block text-truncate" style="max-width: 150px;">
60
  Praeterea iter est quasdam res quas ex communi.
61
</span>
62
{{< /example >}}
63
 
64
## Word break
65
 
66
Prevent long strings of text from breaking your components' layout by using `.text-break` to set `word-wrap: break-word` and `word-break: break-word`. We use `word-wrap` instead of the more common `overflow-wrap` for wider browser support, and add the deprecated `word-break: break-word` to avoid issues with flex containers.
67
 
68
{{< example >}}
69
<p class="text-break">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm</p>
70
{{< /example >}}
71
 
72
## Text transform
73
 
74
Transform text in components with text capitalization classes.
75
 
76
{{< example >}}
77
<p class="text-lowercase">Lowercased text.</p>
78
<p class="text-uppercase">Uppercased text.</p>
79
<p class="text-capitalize">CapiTaliZed text.</p>
80
{{< /example >}}
81
 
82
Note how `.text-capitalize` only changes the first letter of each word, leaving the case of any other letters unaffected.
83
 
84
## Font weight and italics
85
 
86
Quickly change the weight (boldness) of text or italicize text.
87
 
88
{{< example >}}
89
<p class="font-weight-bold">Bold text.</p>
90
<p class="font-weight-bolder">Bolder weight text (relative to the parent element).</p>
91
<p class="font-weight-normal">Normal weight text.</p>
92
<p class="font-weight-light">Light weight text.</p>
93
<p class="font-weight-lighter">Lighter weight text (relative to the parent element).</p>
94
<p class="font-italic">Italic text.</p>
95
{{< /example >}}
96
 
97
## Monospace
98
 
99
Change a selection to our monospace font stack with `.text-monospace`.
100
 
101
{{< example >}}
102
<p class="text-monospace">This is in monospace</p>
103
{{< /example >}}
104
 
105
## Reset color
106
 
107
Reset a text or link's color with `.text-reset`, so that it inherits the color from its parent.
108
 
109
{{< example >}}
110
<p class="text-muted">
111
  Muted text with a <a href="#" class="text-reset">reset link</a>.
112
</p>
113
{{< /example >}}
114
 
115
## Text decoration
116
 
117
Remove a text decoration with a `.text-decoration-none` class.
118
 
119
{{< example >}}
120
<a href="#" class="text-decoration-none">Non-underlined link</a>
121
{{< /example >}}