Jump to content

newbie Q re table, col width


Recommended Posts

Hi Friends,

This will probably be easy for you.  I'm trying to learn some simple info about tables, and I'm studying this page https://www.w3schools.com/html/html_tables.asp and specifically this example https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_intro

I see that the first column is wider than the other 2.  But I can't figure out which code on the left side of the page is responsible for that.

When I remove the width = 100% part, it removes all the extra space.  So that partly answers it.  But why does the first column have more extra space than the other 2 columns?


Thanks for your help.

Link to comment
Share on other sites

By default, the browser decides how much space to reserve for the columns based on how much content is in each one. I'm not sure if the W3C specifies an algorithm for this or if each browser just does its own thing.

You can manually set the width of a column by setting the width of one of its cells, however a cell will always be forced to be wide enough to fit its content without overflowing.

Link to comment
Share on other sites

Thanks for the info!

Yes, I remember that there's a way to set the column width. But I can't find a page on w3schools.com that explains it. Could someone either show me the page, or show me the proper code?


I found some old pages of mine that show row span and col span. But I can't find one for column width.

Edit #2
I need inline code. I can't get to the stylesheet or style tags. So it needs to be inline code. I looked and looked on w3schools.com. Can't find.

Edited by brynn
Link to comment
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

  • Create New...