Skip to content

Commit adf16da

Browse files
committed
toasts.md: Remove useless divs.
Instead pass the class to the example include.
1 parent 2bfe581 commit adf16da

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

site/docs/4.2/components/toasts.md

+7-21
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ To encourage extensible and predictable toasts, we recommend a header and body.
2525

2626
Toasts are as flexible as you need and have very little required markup. At a minimum, we require a single element to contain your "toasted" content and strongly encourage a dismiss button.
2727

28-
<div class="bg-light">
2928
{% capture example %}
3029
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
3130
<div class="toast-header">
@@ -41,14 +40,12 @@ Toasts are as flexible as you need and have very little required markup. At a mi
4140
</div>
4241
</div>
4342
{% endcapture %}
44-
{% include example.html content=example %}
45-
</div>
43+
{% include example.html content=example class="bg-light" %}
4644

4745
### Translucent
4846

4947
Toasts are slightly translucent, too, so they blend over whatever they might appear over. For browsers that support the `backdrop-filter` CSS property, we'll also attempt to blur the elements under a toast.
5048

51-
<div class="bg-dark">
5249
{% capture example %}
5350
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
5451
<div class="toast-header">
@@ -64,14 +61,12 @@ Toasts are slightly translucent, too, so they blend over whatever they might app
6461
</div>
6562
</div>
6663
{% endcapture %}
67-
{% include example.html content=example %}
68-
</div>
64+
{% include example.html content=example class="bg-dark" %}
6965

7066
### Stacking
7167

7268
When you have multiple toasts, we default to vertically stacking them in a readable manner.
7369

74-
<div class="bg-light">
7570
{% capture example %}
7671
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
7772
<div class="toast-header">
@@ -101,14 +96,12 @@ When you have multiple toasts, we default to vertically stacking them in a reada
10196
</div>
10297
</div>
10398
{% endcapture %}
104-
{% include example.html content=example %}
105-
</div>
99+
{% include example.html content=example class="bg-light" %}
106100

107101
## Placement
108102

109103
Place toasts with custom CSS as you need them. The top right is often used for notifications, as is the top middle. If you're only ever going to show one toast at a time, put the positioning styles right on the `.toast`.
110104

111-
<div class="bg-dark">
112105
{% capture example %}
113106
<div aria-live="polite" aria-atomic="true" style="position: relative; min-height: 200px;">
114107
<div class="toast" style="position: absolute; top: 0; right: 0;">
@@ -126,12 +119,10 @@ Place toasts with custom CSS as you need them. The top right is often used for n
126119
</div>
127120
</div>
128121
{% endcapture %}
129-
{% include example.html content=example %}
130-
</div>
122+
{% include example.html content=example class="bg-dark" %}
131123

132124
For systems that generate more notifications, consider using a wrapping element so they can easily stack.
133125

134-
<div class="bg-dark">
135126
{% capture example %}
136127
<div aria-live="polite" aria-atomic="true" style="position: relative; min-height: 200px;">
137128
<!-- Position it -->
@@ -168,12 +159,10 @@ For systems that generate more notifications, consider using a wrapping element
168159
</div>
169160
</div>
170161
{% endcapture %}
171-
{% include example.html content=example %}
172-
</div>
162+
{% include example.html content=example class="bg-dark" %}
173163

174164
You can also get fancy with flexbox utilities to align toasts horizontally and/or vertically.
175165

176-
<div class="bg-dark">
177166
{% capture example %}
178167
<!-- Flexbox container for aligning the toasts -->
179168
<div aria-live="polite" aria-atomic="true" class="d-flex justify-content-center align-items-center" style="min-height: 200px;">
@@ -194,8 +183,7 @@ You can also get fancy with flexbox utilities to align toasts horizontally and/o
194183
</div>
195184
</div>
196185
{% endcapture %}
197-
{% include example.html content=example %}
198-
</div>
186+
{% include example.html content=example class="bg-dark" %}
199187

200188
## Accessibility
201189

@@ -215,7 +203,6 @@ As the content you're displaying changes, be sure to update the [`delay` timeout
215203

216204
When using `autohide: false`, you must add a close button to allow users to dismiss the toast.
217205

218-
<div class="bg-light">
219206
{% capture example %}
220207
<div role="alert" aria-live="assertive" aria-atomic="true" class="toast" data-autohide="false">
221208
<div class="toast-header">
@@ -231,8 +218,7 @@ When using `autohide: false`, you must add a close button to allow users to dism
231218
</div>
232219
</div>
233220
{% endcapture %}
234-
{% include example.html content=example %}
235-
</div>
221+
{% include example.html content=example class="bg-light" %}
236222

237223
## JavaScript behavior
238224

0 commit comments

Comments
 (0)