HTML Academy
The del and ins tags, which are used to highlight changes
Text markup19/21
Back to the list of tasks
  • 1. Let’s start the diary
  • 2. The ul tag, which is used to indicate an unordered list
  • 3. The ol tag, which is used to provide an ordered list
  • 4. The start and reversed attributes
  • 5. Nested lists
  • 6. The dl, dt and dd tags as well as description list
  • 7. The pre tag, which is used to designate preformatted text
  • 8. HTML entities
  • 9. The tag code, or code snippet
  • 10. Combining pre and code tags
  • 11. The tag q, which is used to format inline quotes
  • 12. The blockquote tag, which is used for calling out quotes
  • 13. The br tag, which is used to create a line break
  • 14. The sub and sup tags, which are used to indicate subscript and superscript
  • 15. The time tag, which is used to specify the date and time
  • 16. The em and i tags, which are used to attract the user’s attention
  • 17. The strong and b tags, which are used to strengthen or highlight text
  • 18. The del and ins tags, which are used to highlight changes
  • 19. The div and span tags, style containers
  • 20. Summary of “Text markup”
  • 21. Test: Marking up an article
Summary of “Text markup”
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

The div and span tags, style containers

You have already learned quite a few new tags, and each one has its own meaning. But sometimes you just want to elegantly highlight a short piece of text or a few paragraphs without imparting any additional significance to them. For example, to highlight what you believe are the most dangerous “diseases” that web designers are susceptible to by applying a crimson background.

But since calling out text in this way does not give it any meaning, we don’t want to enclose this text using a “semantic” tag and therefore imply a meaning that it doesn’t have.

But there are also two special tags that do not have any “meaning”. These are the <div> (which is short for “division”) and <span> tags. These are “clean” elements that are great for visually grouping together other items. It is recommended that you only use these tags if you cannot find any suitable semantic tags.

The <div> and <span> tags have no default appearance, and they are almost always used together with the class attribute, which allows you to easily add your own styles to them.

The <div> tag is typically used to group major elements, such as multiple paragraphs, or as a container for creating page layouts. By contrast, <span> is used for highlighting small text elements: parts of words or individual words or phrases consisting of several words:

<article>
  <div class="highlight">
    <p>We are two nicely highlighted paragraphs.</p>
    <p>We have a yellow background!</p>
  </div>
  <p>Text containing <span>a highlighted phrase</span>.</p>
</article>

In this assignment, we will use the <div> tag as a wrapper for items in the definition list. In this case, the list items that are not enclosed in a <div> should not be enclosed in the the <dl> tag. We either enclose all of the elements, or we leave all of the <dt> and <dd> tags without wrappers.

After completing this step, you can download the intermediate version of our Website of a beginning web designer at this link.

We have prepared styles for highlighting text and blocks. Pay attention to the style.css tab.

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>The website of a beginning coder</title> <link rel="stylesheet" href="style.css"> </head> <body> <header> <p>Blog</p> <nav> Return to home </nav> </header> <main> <article> <h1>Day Four. How I almost got sick</h1> <p>Today I found out that it can be dangerous to be a coder. When you are just starting out, you are still inexperienced and can easily get infected by some sort of disease. Here are just some of the dangers that may be lying in wait for you:</p> <dl> <dt>Divatosis</dt> <dd>Acute fear of semantics</dd> <dt>Tablephobia</dt> <dd>Avoidance of tables</dd> <dd>A desire to format tables using divs</dd> <dt>Classitis</dt> <dd>The tendency to assign classes to every tag</dd> </dl> </article> <aside> Your ad could go here </aside> </main> <footer> Website footer </footer> </body> </html>
CSS
body { padding: 0 30px; font-size: 14px; line-height: 22px; font-family: "Georgia", serif; color: #222222; } h1 { font-size: 20px; line-height: normal; } nav { color: #888888; } aside { margin: 20px 0; color: #c4c4c4; } .danger-text { color: #ff4400; } .danger-block { padding: 5px 10px; background-color: #ffd0bf; } .no-danger-block { padding: 5px 10px; background-color: #c6f5f0; }

What didn’t you like in this task?

Thanks! We’ll fix everything at once!

The code has changed, click “Refresh” or turn autorun on.

You’ve gone to a different page

Click inside the mini-browser to shift the focus onto this window.

100%
Goalscompleted
0
    1. Let’s enclose the word dangerous in the paragraph in <span> with the attribute class="danger-text".
    2. Let’s enclose all of the terms and their descriptions with the exception of the last one (“Classitis”) in <div> with the attribute class="danger-block".
    3. Let’s enclose the last term (Classitis) <div> with the attribute class="no-danger-block".

    Cookies ∙ Privacy ∙ License Agreement ∙ About ∙ Contacts ∙ © HTML Academy OÜ, 2019−2025

    VISAMastercard

    Log in

    or

    Forgot your password?

    Sign up

    Sign up

    or
    Log in

    Restore access

    Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.

    Forgot to connect your email to the profile? Email us and we’ll help.