brynn Posted February 18, 2020 Share Posted February 18, 2020 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 More sharing options...
Ingolme Posted February 18, 2020 Share Posted February 18, 2020 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 More sharing options...
brynn Posted February 19, 2020 Author Share Posted February 19, 2020 (edited) 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? Thanks. Edit 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 February 19, 2020 by brynn Link to comment Share on other sites More sharing options...
brynn Posted February 19, 2020 Author Share Posted February 19, 2020 (edited) Could it be <th style="width:30%"> ? Edited February 19, 2020 by brynn Link to comment Share on other sites More sharing options...
Ingolme Posted February 19, 2020 Share Posted February 19, 2020 Yes, that code should work. You can set the width of anything on the page using CSS. The code above is just CSS inside an HTML attribute. Link to comment Share on other sites More sharing options...
brynn Posted February 20, 2020 Author Share Posted February 20, 2020 Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now