0

I'm trying to create a table with html and using css to style it. I want it to be 8 rows and one column, but the rows are weirdly formatted, and the column only covers one piece of the table see ss

HTML:

<section class="table-body">
    <div class="table">
    <table border="1">
  <tr>
    <th>Skills</th>
  </tr>
  <tr>
    <td>HTML & CSS</td>
    <td>MySQL</td> 
    <td>White Box Testing</td>
    <td>Black Box Testing</td>
    <td>Computer Networking</td>
    <td>Corporate Cybersecurity Best Practices</td> 
    <td>Python</td>
    <td>Software Engineering</td>
  </tr>
</table>
</div>
</section>

   

CSS:

.table th, td{
    border: 1px solid;
    color: white;
    padding: 5px;
    width: 100%;
    background-image: linear-gradient(rgba(4,9,30,0.7),rgba(4,9,30,0.7)),url(images/footer.jpeg);

}

I tried using some of the code from W3, and played around with the <td> and <th> but the "Skills" column will not cover the entire table.

This is how I was expecting it to look.

                            Skills                             

Cell 1 | Cell 2 |Cell 3 | Cell 4| Cell 5 | Cell 6 | Cell 7 | Cell 7|

1 Answer 1

1

What you need is to use the colspan attribute.

<section class="table-body">
    <div class="table">
    <table border="1">
  <tr>
    <th colspan="8">Skills</th>
  </tr>
  <tr>
    <td>HTML & CSS</td>
    <td>MySQL</td> 
    <td>White Box Testing</td>
    <td>Black Box Testing</td>
    <td>Computer Networking</td>
    <td>Corporate Cybersecurity Best Practices</td> 
    <td>Python</td>
    <td>Software Engineering</td>
  </tr>
</table>
</div>
</section>

In your case, colSpan="8" so it spans 8 columns

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.