I'm having trouble making an HTML Table and using the "rowspan" attribute: PLEASE HELP

I’m a beginner (started two days ago) and am trying to get better at HTML.
To practice, I am trying to make a table that looks something like this: https://i.stack.imgur.com/tqzg9.png
This is a link to my HTML as well as the result: http://www.practiceboard.com/f042cc7c
(note: you may have to click the “see html” button for the result to load)

Am I using the rowspan attribute in the element incorrectly? Do I have the wrong number of cells in the second row? What am I doing wrong? I need the first cell with “Empno” to span 2 rows, and shift the data in the second row one cell over so that all the data in the second row is under “Marks”. :confused:

Hello @micro4903931506 and welcome to the Codecademy community :grinning:
I am still trying to find the exact reason why your code did not work, I believe it is because elements in <thead> can only span the same row.

However you may be able to fix your code by putting all your <td> elements in the <tbody>. Because of the way your code is setup I don’t believe you have a need for a <thead>. Please correct me if I am wrong there.

1 Like

That’s how I’d fix it. :slight_smile:

1 Like

Thanks so much! It worked! :slight_smile: Just as an additional question, if you don’t mind me asking, what is the difference between the class and id attributes for the section element? Is section just a more semantic version of the div element? Thank you so much for your help! I appreciate it so much!

The class and Id attributes for any element are used mostly for styling.
Class can be a group of elements while Id is a specific element.

If say you needed to make a bunch of elements red that have a black background you could put them all in the same class:

<section class="red-black">

And then use CSS to style this class:

.red-black {
    color: red;
    background-color: black;

However if you want one of these element to be blue instead of red you can override the last class and style it with an ID:

<sec class="red-black" id="blue">
#blue {
    color: blue;

<section> is used to divide a page into, well, sections. If you use them, you will notice there is a gap between different <section> elements.
In the case of the <div> element, there is no gap, it is used for more semantic reading and styling.

For more information you can read this:

Hopefully this is helpful :slight_smile:

Thank you so much! Your response was super helpful and informative! :slight_smile:
Just wanted to let everyone who is in the same boat as I am know that some of the minor things you might find confusing about html after you’ve finished the html course makes a lot more sense once you start understanding how it relates to CSS in the CSS course.

Thank you!

1 Like