Types of alerts and their html code
-
Important information
Important information
[text here]
NLSinfo-adding-alerts
<div class="usa-alert usa-alert--info"> <div class="usa-alert__body"> <h2 class="usa-alert__heading"> Important information </h2> <p> [text here] </p> </div> </div> -
Created variables
Created variables
[text here]
<div class="usa-alert usa-alert--vars"> <div class="usa-alert__body"> <h2 class="usa-alert__heading"> Created variables </h2> <p> [text here] </p> </div> </div> -
Slim version without a heading / title
[text here]
<div class="usa-alert usa-alert--info usa-alert--slim"> <div class="usa-alert__body"> <p> [text here] </p> </div> </div>
How to add an alert box
- Copy the HTML code for the alert box you want to use.
- Navigate to the page where you'd like to add the alert and click Edit.
- (Optional, but recommended) Add temporary placeholder text, such as [HERE], where you want the alert box to appear in your page's body copy.
- Open the HTML/code view by clicking Source in the editor toolbar.
- If you added placeholder text, use your browser's Find function (Ctrl+F) to locate [HERE] in the source code.
- Replace the placeholder text with the alert box HTML code. If you did not use a placeholder, paste the HTML code directly in the appropriate location.
- Click Source again to return to the normal editor view.
- Update the alert message.
- Save your changes, and review to confirm the alert box appears as expected.
Do's and Don'ts
- Don't add a heading to the slim alert, use the "Important information" version.
- Don't remove "Important information" from the heading, but do add more context if necessary.
- Example: Important information: How to download a tagset
- Don't remove or change the "Created variables" heading. Do add context to the list of Question names / Variable titles within this type of alert.
- Do change the heading level to fit within your page structure.
- For instance, the first two alert styles (above) have <h2> tags for heading level 2. If the alert would fall lower in an outline structure, change the <h2>...</h2> tags to <h3>...</h3> and so on.
- Headings for page content can use levels 2-6 with level 1 <h1> being reserved for the page title.
- Note: Make the heading tag change in the code view by clicking Source. Do not change the heading level by using the drop-down menu in the editor tools because it will strip out some of the style code used to format the alert.
- If you're not sure what level to use, keep <h2>...</h2>.
- For instance, the first two alert styles (above) have <h2> tags for heading level 2. If the alert would fall lower in an outline structure, change the <h2>...</h2> tags to <h3>...</h3> and so on.