Scope Attribute - Wine Schedule Exercise

I’ve just finished the Wine Schedule exercise in the HTML course, and I noticed that we didn’t need to use the scope attribute on the headings.

Based on the previous lessons, I would have assumed that the code would be written like this:

<thead>
        <tr>
          <th colspan="2">
            <h1>Wine Festival Schedule</h1>
          </th>
        </tr>
        <tr>
          <th scope="col">
            <h2>Time</h2>
          </th>
          <th scope="col">
            <h2>Event</h2>
          </th>
        </tr>
      </thead>

Is it omitted because the Time and Event headings are not right at the top, or is this attribute optional?

Cheers,

G

Hi there, and welcome to the forums!

scope as an attribute is completely optional. If you notice from the previous exercises, you didn’t actually change anything visually by giving it the scope, you still had to style it completely in the CSS file, and there was nothing in the CSS to specify the scope this was for. scope is actually almost exclusively there for screen readers and accessibility reasons. It lets the screen reader know which order to read the table contents for it to make the most sense and convey correctly the information to someone that is visually impaired.

Therefore it was not necessary to include it for any visually practical reason in this exercise, however it is good practise to include to make your websites as inclusive and accessible as possible.

1 Like

Hi, Adam

Thanks for this, it was a super clear explanation and helped a lot.

Appreciate you taking the time to help me out, mate.

Cheers.