Jump to content

Automatic td adding in HTML?

Go to solution Solved by Mr_KoKa,

 

 

When you're rowspaning, cell is not merging with the cell beneath it, instead it takes space of it and you just need to skip one cell that space is taken by the cell that you expanding by rowspan.

 

So when you rowspan you need to skip one cell beneath, if you colspan, you need to skip one to the right. but in your case it is only rowspan, but you need to skip cells in more than one row beneath. 

 

Here is example: http://jsfiddle.net/qwLvx612/ you can see yellow cell that is about to get expanded by 2, using rowspan="3". It will push out purple cells beneath, so you need to get rid of them, I did it by commenting them out.

So I am creating a table in HTML and CSS, more specifically HTML, and when I put in the data in the td's, it automatically adds a new td to the end of the row. Why is this and how can I stop it? 
 
Image:
 http://imgur.com/qZOUkkD

Example of Code:

<td>9:00</td>    <td class = "CS164" rowspan = "4">CS 164 <p><i>Introduction to Computer Science</i></p> <p>Randell Hall 121</p></td> <!-- Monday-->	<!-- Spans from 9 to 11 -->    <td class = "CI101" rowspan = "3">CI 101 <p><i>Computing and Information Design</i></p> <p>Curtis Hall 341</p></td> <!-- Tuesday -->	<!-- Spans from 9 to 10 -->    <td> </td> <!-- Wednesday -->    <td> </td> <!-- Thursday -->	<td> </td> <!-- Friday -->  </tr>
Link to comment
https://linustechtips.com/topic/469085-automatic-td-adding-in-html/
Share on other sites

Link to post
Share on other sites

Not entirely sure what you're saying, is it "</td>" that gets automatically added, because if so then that is correct, you need to have a closing tag

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

Not entirely sure what you're saying, is it "</td>" that gets automatically added, because if so then that is correct, you need to have a closing tag

 

My bad, updated post with code and image. It's not the closing tag of td, on the actual table, it creates a new space.

Link to post
Share on other sites

 

 

When you're rowspaning, cell is not merging with the cell beneath it, instead it takes space of it and you just need to skip one cell that space is taken by the cell that you expanding by rowspan.

 

So when you rowspan you need to skip one cell beneath, if you colspan, you need to skip one to the right. but in your case it is only rowspan, but you need to skip cells in more than one row beneath. 

 

Here is example: http://jsfiddle.net/qwLvx612/ you can see yellow cell that is about to get expanded by 2, using rowspan="3". It will push out purple cells beneath, so you need to get rid of them, I did it by commenting them out.

Link to post
Share on other sites

When you're rowspaning, cell is not merging with the cell beneath it, instead it takes space of it and you just need to skip one cell that space is taken by the cell that you expanding by rowspan.

 

So when you rowspan you need to skip one cell beneath, if you colspan, you need to skip one to the right. but in your case it is only rowspan, but you need to skip cells in more than one row beneath. 

 

Here is example: http://jsfiddle.net/qwLvx612/ you can see yellow cell that is about to get expanded by 2, using rowspan="3". It will push out purple cells beneath, so you need to get rid of them, I did it by commenting them out.

 

Ah, that makes a lot of sense. Thank you!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×