Tables with HTML


#1

I have a question about two tags when making tables. In the exercises, they teach us about using td and th tags
Why can’t I just use td instead of th if the output will look the same? Wouldn’t it be simpler to eliminate tags if it has the same output?? Or is it just used differently to distinguish it within the code? Or what’s the reason for that if any?


#2

By default the output will not look the same. TD is left aligned and normal typeface, TH is center aligned and bold typeface.

TH has a special meaning as it tells the user agent it is a column or row heading, and has an associated attribute, scope that tells which. TD is meant to contain data, not headings.


#3

Ok. I understand that it’ll have a special meaning…but when I look at the output in the course, the output looks the same for td and th. Everything is left aligned and nothing is in bold. Is there a reason for that? Or is it just because it’s practice?


#4

Also, I did try to replace th with td in the course to see the output, the output looks the same either way. So I’m a bit confused on that. I’m sure the explanation you gave me is correct. But then why does the course not show me the difference?


#5

User agent style sheets may vary but for the most part we can expect a normal rendering from all of them on the core attributes. The style properties would have to be manipulated to circumvent expected criteria. Clear your style sheets and see how the page renders by default.

Truth Tables

We could examine the exercise with a link to the lesson, if you would oblige us with same…


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.