Categories
Canvas Tools Self-Help Tutorials

Use HTML Code to Create Dynamic Pages

Last updated on May 14, 2026

Directions

Note: If you don’t have experience using HTML Code, it is recommended to watch the video for a visual demonstration of the steps covered in this tutorial.

Note: Use the chapters to jump to a specific example/code by clicking Fullscreen and selecting the video panel at the bottom right.

Use the HTML Editor in Canvas Pages

This section goes over how to access and use the HTML editor in Canvas. The sections below feature multiple examples of code that you can copy and paste into the HTML Editor. You may use one of those code blocks, or you can use the sample code at the bottom of this section to test it out.

Accessibility Note: The original background and font colors are accessible in all code examples. However, if you decide to change the colors, it is important to use high contrast colors to ensure it meets accessibility standards. See our tutorial, Use the Canvas Accessibility Checker, for guidance on how you can check that your page is accessible.

  1. Copy the desired code from this tutorial.
    • Click the toggle under the steps for the desired code.
    • Click Copy at the top right of the panel that opens up.
      • This will copy the entire block of code.
  2. Log in to your Canvas Account.
  3. Select the Course you’d like to work in.
  4. Click Modules from the left-hand course navigation menu.
  5. Locate the Page you want to edit.
  6. Click the Title of the page.
  7. Click Edit in the top right corner of the page.
  8. Click the </> button near the bottom right of the Rich Content Editor to open the HTML view.
  9. Paste the desired code into the HTML Editor.
    • Right click your Mouse.
    • Select Paste.
  10. Click the </> button to return to the RCE.
    • Note: See the steps below for the specific HTML code to see how to edit the page/code with your course content.
  11. Click Save on the bottom right. 
<div style="border: 2px solid #ccc; padding: 10px; border-radius: 5px;">
    <h2 style="color: #2c3e50;">Welcome to My Page</h2>
    <p>&nbsp;&nbsp;&nbsp;&nbsp;</p>
    <p>This is a <strong>bold statement</strong> and this is <em>italic text</em>.</p>
    <p>&nbsp;&nbsp;&nbsp;&nbsp;</p>
    <ul style="list-style-type: circle;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <li><a href="https://community.canvaslms.com">Link to Canvas</a></li>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <li>Item Two</li>
        &nbsp;&nbsp;&nbsp;&nbsp;
    </ul>
</div>

Knowledge Check and Student Practice

Knowledge Checks are great ways to build in practice and engagement in a Canvas Course. These knowledge checks are ungraded, and you will not know how a student performed. You can use these to help prompt thinking, allow students to quiz themselves, and to highlight important information that will appear in graded assessments or projects later in the course.

Open Answer Knowledge Check

This knowledge check allows students to think about their answer before checking it. When they click Check Your Answer, a pop-up will appear with the correct answer for the question. 

  1. Click the </> button at the bottom right of the RCE in a Canvas Page.
  2. Copy and paste the HTML Code below into the HTML editor.
  3. Click the </> button to switch back to the RCE.
    • Note: From the RCE view, the correct answers appear on the page underneath the question. Once you save the page, the correct answer will only appear when you click Check Your Answer.
  4. Type the first question where it says, “Question text 1”.
  5. Type the answer where it says, “Answer 1 text”.
    • Note: Do not delete the text, “Check Your Answer #1”. 
  6. Repeat Steps 4-5 for each question.
    • To delete a question, delete all question and answer text for any you do not want. 
  7. Click on the space above or below the knowledge check box to add any additional content to the page.
  8. Click Save at the bottom right.
<p>&nbsp;</p>
<hr />
<div style="margin: 50px; border: 5px solid #00447c; padding: 15px; width: 65%;">
    <h2>Knowledge Check</h2>
    <p>Test yourself! Try to answer the questions below without scrolling back up the page. To see if your answer is correct, click on the button below each question.</p>
    <ol>
        <li>
            <p>Question text 1</p>
            <div id="dialog_for_link1" class="enhanceable_content dialog" title="Answer">
                <p>Answer 1 text</p>
            </div>
            <p><a id="link1" class="Button" href="#dialog_for_link1">Check Your Answer #1</a></p>
        </li>
        <li>
            <p>Question text 2</p>
            <div id="dialog_for_link2" class="enhanceable_content dialog" title="Answer">
                <p>Answer 2 text</p>
            </div>
            <p><a id="link2" class="Button" href="#dialog_for_link2">Check Your Answer #2</a></p>
        </li>
        <li>
            <p>Question 3 text</p>
            <div id="dialog_for_link3" class="enhanceable_content dialog" title="Answer">
                <p>Answer 3 text</p>
            </div>
            <p><a id="link3" class="Button" href="#dialog_for_link3">Check Your Answer #3</a></p>
        </li>
        <li>
            <p>Question text 4</p>
            <div id="dialog_for_link4" class="enhanceable_content dialog" title="Answer">
                <p>Answer 4 text</p>
            </div>
            <p><a id="link4" class="Button" href="#dialog_for_link4">Check Your Answer #4</a></p>
        </li>
        <li>
            <p>Question text 5</p>
            <div id="dialog_for_link5" class="enhanceable_content dialog" title="Answer">
                <p>Answer 5 text</p>
            </div>
            <p><a id="link5" class="Button" href="#dialog_for_link5">Check Your Answer #5</a></p>
        </li>
        <li>
            <p>Question text 6</p>
            <div id="dialog_for_link6" class="enhanceable_content dialog" title="Answer">
                <p>Answer 6 text</p>
            </div>
            <p><a id="link6" class="Button" href="#dialog_for_link6">Check Your Answer #6</a></p>
        </li>
        <li>
            <p>Question text 7</p>
            <div id="dialog_for_link7" class="enhanceable_content dialog" title="Answer">
                <p>Answer text 7</p>
            </div>
            <p><a id="link7" class="Button" href="#dialog_for_link7">Check Your Answer #7</a></p>
        </li>
    </ol>
</div>
<p>&nbsp;</p>

Multiple Choice Knowledge Check

When students click an answer choice in this knowledge check, a pop-up will appear stating whether it’s correct or incorrect. You can add feedback for each answer.

  1. Click the </> button at the bottom right of the RCE in a Canvas Page.
  2. Copy and paste the HTML Code below into the HTML editor.
  3. Click the </> button to switch back to the RCE.
    • Note: From the RCE view, the feedback for each answer choice appears below all the answer choices for a question. Once you save the page, the feedback will only appear when you click the matching answer choice.
  4. Type Question 1 where it says, “Type your question here”.
  5. Type each answer choice where it says, “Type answer choice [letter] here”.
  6. Type your feedback for each answer choice below all answers, where it says, “Type feedback for answer [letter] here.
    • Your feedback should indicate if the answer choice is correct or incorrect and explain why.
  7. Repeat Steps 4-6 for each question.
    • To delete a question, delete all question, answer, and feedback text in the RCE for any questions you do not want. 
  8. Click on the space above or below the knowledge check box to add any additional content to the page.
  9. Click Save at the bottom right.
<p>&nbsp;</p>
<hr />
<div style="margin: 50px; border: 5px solid #00447c; padding: 15px; width: 65%;">
    <h2>Multiple Choice Knowledge Check</h2>
    <p>Test yourself! Try to answer the questions below without scrolling back up the page. Click on an answer choice to check to check your answer. Keep trying until you get the correct answer!</p>
    <p><strong>Question 1:</strong> Type your question here.</p>
    <div style="max-width: 320px;"><a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q1_a">A: Type answer choice A here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q1_b">B: Type answer choice B here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q1_c">C: Type answer choice C here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; text-align: left; white-space: normal;" href="#q1_d">D: Type answer choice D here</a></div>
    <div id="q1_a" class="enhanceable_content dialog" title="Answer A">
        <p>Type feedback for answer A here. Indicate if this answer is correct or incorrect and explain why.</p>
    </div>
    <div id="q1_b" class="enhanceable_content dialog" title="Answer B">
        <p>Type feedback for answer B here.</p>
    </div>
    <div id="q1_c" class="enhanceable_content dialog" title="Answer C">
        <p>Type feedback for answer C here.</p>
    </div>
    <div id="q1_d" class="enhanceable_content dialog" title="Answer D">
        <p>Type feedback for answer D here.</p>
    </div>
    <hr />
    <p><strong>Question 2:</strong> Type your question here.</p>
    <div style="max-width: 320px;"><a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q2_a">A: Type answer choice A here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q2_b">B: Type answer choice B here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q2_c">C: Type answer choice C here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; text-align: left; white-space: normal;" href="#q2_d">D: Type answer choice D here</a></div>
    <div id="q2_a" class="enhanceable_content dialog" title="Answer A">
        <p>Type feedback for answer A here.</p>
    </div>
    <div id="q2_b" class="enhanceable_content dialog" title="Answer B">
        <p>Type feedback for answer B here.</p>
    </div>
    <div id="q2_c" class="enhanceable_content dialog" title="Answer C">
        <p>Type feedback for answer C here.</p>
    </div>
    <div id="q2_d" class="enhanceable_content dialog" title="Answer D">
        <p>Type feedback for answer D here.</p>
    </div>
    <hr />
    <p><strong>Question 3:</strong> Type your question here.</p>
    <div style="max-width: 320px;"><a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q3_a">A: Type answer choice A here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q3_b">B: Type answer choice B here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q3_c">C: Type answer choice C here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; text-align: left; white-space: normal;" href="#q3_d">D: Type answer choice D here</a></div>
    <div id="q3_a" class="enhanceable_content dialog" title="Answer A">
        <p>Type feedback for answer A here.</p>
    </div>
    <div id="q3_b" class="enhanceable_content dialog" title="Answer B">
        <p>Type feedback for answer B here.</p>
    </div>
    <div id="q3_c" class="enhanceable_content dialog" title="Answer C">
        <p>Type feedback for answer C here.</p>
    </div>
    <div id="q3_d" class="enhanceable_content dialog" title="Answer D">
        <p>Type feedback for answer D here.</p>
    </div>
    <hr />
    <p><strong>Question 4:</strong> Type your question here.</p>
    <div style="max-width: 320px;"><a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q4_a">A: Type answer choice A here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q4_b">B: Type answer choice B here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; margin-bottom: 0.4rem; text-align: left; white-space: normal;" href="#q4_c">C: Type answer choice C here</a> <a class="btn btn-small" style="display: block; width: 100%; padding: 10px 12px; text-align: left; white-space: normal;" href="#q4_d">D: Type answer choice D here</a></div>
    <div id="q4_a" class="enhanceable_content dialog" title="Answer A">
        <p>Type feedback for answer A here.</p>
    </div>
    <div id="q4_b" class="enhanceable_content dialog" title="Answer B">
        <p>Type feedback for answer B here.</p>
    </div>
    <div id="q4_c" class="enhanceable_content dialog" title="Answer C">
        <p>Type feedback for answer C here.</p>
    </div>
    <div id="q4_d" class="enhanceable_content dialog" title="Answer D">
        <p>Type feedback for answer D here.</p>
    </div>
    <p>&nbsp;</p>
</div>
<p>&nbsp;</p>

Layout and Content Design

You can use HTML code to create different visual effects to make a page more engaging, visually organized, or to highlight important information.

This code will add an editable banner you could use to introduce a module or highlight important information on your page.

  1. Click the </> button at the bottom right of the RCE in a Canvas Page.
  2. Copy and paste the HTML Code below into the HTML editor.
    1. To change the background color, replace the hex code at the top of the code next to background-color with the hex code for the new color.
  3. Click the </> button to switch back to the RCE.
  4. Edit text to match your course.
    1. You can click directly on the banner to edit the text.
  5. To change the image:
    1. Click the Image/figure.
    2. Click Backspace on your keyboard to delete the image.
    3. Click the Image Icon on the RCE toolbar.
    4. Select Upload Image.
    5. Click Upload Image in the middle of the page.
    6. Select the image from your computer.
    7. Click Open.
    8. Type Alt Text for the image in the text box or mark the image as decorative.
    9. Click Submit.
  6. Click on the space below the banner to add any additional content to the page
  7. Click Save on the bottom right.
<div style="display: flex; align-items: center; justify-content: space-between; background-color: #f4f4f4; padding: 20px; border-radius: 10px;">
    <div style="flex: 1; text-align: center;"><img style="width: 100%; max-width: 300px; height: auto; border-radius: 8px;" src="https://picsum.photos/1210/500" alt="Banner Image" /></div>
    <div style="flex: 2; padding: 10px;">
        <h2 style="margin: 0;">Module Name<br /><span style="margin: 5px 0 0; font-size: 0.6em;">Description of Page</span></h2>
    </div>
    <p>&nbsp;</p>
</div>
<p>&nbsp;</p>

Figures with Captions

When adding figures/images into the RCE, Canvas does not have a function that allows you to automatically format for adding captions. You can create this formatting through HTML, which will align the caption to the size of the image. Remember that captions are not the same as alt text, and you will still need to add alt text to your image to make it accessible.

  1. Click the </> button at the bottom right of the RCE in a Canvas Page.
  2. Copy and paste the HTML Code below into the HTML editor.
  3. Click the </> button to switch back to the RCE.
  4. To change the image:
    • Click the Image/figure.
    • Click Backspace on your keyboard to delete the image.
    • Click the Image Icon on the RCE toolbar.
    • Select Upload Image.
    • Click Upload Image in the middle of the page.
    • Select the image from your computer.
    • Click Open.
    • Type Alt Text for the image in the text box.
    • Click Submit.
  5. Edit caption text.
  6. Click on the space above or below the figure/caption to add any additional content to the page
  7. Click Save on the bottom right.
<p>&nbsp;</p>
<h4>Example 1</h4>
<figure><img role="presentation" src="https://picsum.photos/650/315/" alt="" width="619" height="300" />
    <figcaption><strong>Figure 1:</strong> Write your caption here.<br />| <strong>Source:</strong> Site where you got your image/figure from.</figcaption>
</figure>
<p>&nbsp;</p>

Rounded Content Box

Content boxes can be used to highlight important information and make your page more visually appealing. 

  1. Click the </> button at the bottom right of the RCE in a Canvas Page.
  2. Copy and paste the HTML Code below into the HTML editor.
    • To change the background color, replace the hex code at the top of the code next to “background-color” with the hex code for the new color.
  3. Click the </> button to switch back to the RCE.
  4. Edit the heading text to reflect the content in the box.
  5. Edit the text in the box.
  6. Click on the space above or below the content box to add any additional content to the page
  7. Click Save on the bottom right.
<p>&nbsp;</p>
<hr />
<div style="width: 80%; margin: auto; background-color: #dcdcdc; color: #000000; border-radius: 8px; padding: 20px;">
    <h2>Heading 2</h2>
    <p><span style="color: #000000;">Write your text in this box.&nbsp;</span></p>
</div>
<hr />
<p>&nbsp;</p>

Toggle for More Text

This toggle allows you to show/hide text. You can use this for long descriptions of images, optional examples or explanations, or to reduce clutter on long pages.

  1. Click the </> button at the bottom right of the RCE in a Canvas Page.
  2. Copy and paste the HTML Code below into the HTML editor.
  3. Click the </> button to switch back to the RCE.
    • Note: From the RCE view, the full text appears below the title. Once you save the page, the text will only appear if you click the toggle.
  4. Type the Title for the content that will be revealed where it says, “Title Goes Here”.
  5. Type the text that will be revealed where it says, “Text goes here”.
  6. Click on the space above or below the toggle to add any additional content to the page
  7. Click Save on the bottom right.
<p>&nbsp;</p>
<details>
    <summary>Title Goes Here (What content will appear when students click the toggle?)</summary>
    <p>Text goes here. This toggler can be expanded using keyboard navigation! (Try tabbing to the title then hitting the enter key.)</p>
</details>
<p>&nbsp;</p>

Navigation Buttons

Navigation buttons are easy ways to direct students to specific pages, assignments, or other content within your Canvas Course. These can be especially helpful to put on your Homepage to lead students to where they need to go to start the course, or for certain assignments or resources you want them to have easy access to.

For guidance on how to edit your homepage, see our spotlight, Create a Dynamic Home Page.

  1. Click the </> button at the bottom right of the RCE in a Canvas Page.
  2. Copy and paste the HTML Code below into the HTML editor.
    • To change the background color, replace the hex code at the top of the code next to “background-color” with the hex code for the new color.
  3. Click the </> button to switch back to the RCE.
  4. Click Button 1.
  5. Select Link Options.
  6. Enter the Title for the button (where it will direct students to) in the text box under Text.
    • To change the color of the font, highlight the text, click the A from the toolbar, and select the new color.
  7. To change the link to direct students to a specific location in your course:
    • Open a new tab in your browser.
      • Do not close the tab with the page you’re editing.
    • Open your Canvas Account in the new tab.
    • Select the Same Course you are editing the page in.
    • Locate the item you want the button to direct students to.
    • Copy the URL at the top of your browser.
      • For New Quizzes, Click Preview from the Build page in the quiz before copying the URL.
    • Click the tab with the page you are editing.
    • Delete the current link in the Link Options Panel.
    • Paste the URL you copied under Link.
    • Click Done.
  8. RepeatSteps 4-7 for each button.
    • To delete a button, highlight the button’s text, and press backspace on you keyboard.
  9. Click on the space above or below the navigation buttons to add any additional content to the page
  10. Click Save on the bottom right.
<h2>Navigation Buttons</h2>

<p style="text-align: center;">
  <a class="Button" style="background-color: #1e73be; color: #ffffff; margin: 20px 25px 25px 0px;" href="https://msudenver.instructure.com/LINK">Button 1</a>

  <a class="Button" style="background-color: #1e73be; color: #ffffff; margin: 20px 25px 25px 0px;" href="https://msudenver.instructure.com/LINK">Button 2</a>

  <a class="Button" style="background-color: #1e73be; color: #ffffff; margin: 20px 25px 25px 0px;" href="https://msudenver.instructure.com/LINK">Button 3</a>

  <a class="Button" style="background-color: #1e73be; color: #ffffff; margin: 20px 25px 25px 0px;" href="https://msudenver.instructure.com/LINK">Button 4</a>
</p>

<hr />

Have questions?

Need additional support on this or other teaching and learning topics? Please visit us fordrop-in support (10am-3pm, M-F) or try one of our self-help tutorials

Ready to take your teaching to the next level? Opt into our Connections with CTLD newsletter!