Column Width For Not Working - Stack Overflow
Trang chủ » Html Th Column Width
» Column Width For
Not Working - Stack Overflow
Có thể bạn quan tâm
Just browsing Stack Overflow? Help us improve your experience. Sign up for research -
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams Get early access and see previews of new features.
Learn more about Labs Column width for <th> not working Ask Question Asked 10 years, 2 months ago Modified 10 years, 2 months ago Viewed 76k times 15 Here is my html:
<html> <head> <meta charset="utf-8"> <link href="css/bootstrap.css" rel="stylesheet"> <link href="css/bootstrap-theme.css" rel="stylesheet"> </head> <body style="padding-top: 47px;"> <table class="table table-hover table-striped-custom"> <thead> <tr> <th style="width: 5px;"></th> <th>Column2</th> <th>column2</td> </tr> </thead> <tbody> <tr> <td style="background-color: #FF5F5F;width: 5px;"></td> <td>blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bla</td> </tr> <tr> <td style="background-color: deepskyblue"></td> <td>bla</td> <td>bla</td> </tr> </tbody> </table> Problem is when setting width for first column: it won't go under 16px. If I put bigger width(20,50), colored column become larger, but when I try to set them thinner (for example 7px), It doesn't take any effect. How can I do it, without removing any css class from existing template. Colored column have to be first, it's height must be as row's height and I have to be able to set it's width to any value I want.
- html
- css
- twitter-bootstrap
Share Improve this question Follow edited Sep 15, 2014 at 14:50 j08691 208k3232 gold badges267267 silver badges280280 bronze badges asked Sep 15, 2014 at 14:47 ErrorError 82511 gold badge1919 silver badges3333 bronze badges 3 - Seems to work here jsfiddle.net/mendesjuan/qq3L0o77. Oops nevermind, it breaks after you add bootstrap jsfiddle.net/mendesjuan/qq3L0o77/1 – Ruan Mendes Commented Sep 15, 2014 at 14:59
- something like this? – Litestone Commented Sep 15, 2014 at 15:04
- @Litestone Read my comment, the problem happens when you add bootstrap – Ruan Mendes Commented Sep 15, 2014 at 15:10
Add a comment | 2 Answers 2
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 10 It's because your bootstrap css is adding 8px padding to the table cells (which is why your min width is 16px: 8px left plus 8px right) - try adding padding:0; for those cells and it should work
Example
Share Improve this answer Follow answered Sep 15, 2014 at 14:58 PetePete 58.3k2929 gold badges129129 silver badges183183 bronze badges 3 - Note that to add it in a CSS section will require a lot of specificity since bootstrap uses .table>thead>tr>td – Ruan Mendes Commented Sep 15, 2014 at 15:15
- @JuanMendes As OP is using inline styles, they should override the stylesheet styles, otherwise yes they will need to be more specific than the css in the bootstrap – Pete Commented Sep 15, 2014 at 15:18
- That's what I said, if the OP is going to move to using best practices, they'll need to use high specificity. I never said what you have doesn't work, but I'm sure we agree it's not the best way to do things. – Ruan Mendes Commented Sep 15, 2014 at 15:20
Add a comment | 4 It's possible that bootstrap has set min-width on th or td. If so, I'd add an additional style block (in the HTML, if you can't add/edit external CSS), to allow the first column to be as small as you like:
<style type="text/css"> .table td:first-child, .table th:first-child { min-width: 0; padding: 0; } </style> Share Improve this answer Follow answered Sep 15, 2014 at 14:59 Paul RoubPaul Roub 36.4k2727 gold badges8585 silver badges9393 bronze badges Add a comment | Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discarded Sign up or log in
Sign up using Google Sign up using Email and Password Submit Post as a guest
Name Email Required, but never shown
Post Your Answer Discard By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged - html
- css
- twitter-bootstrap
or ask your own question.
- The Overflow Blog
- Your docs are your infrastructure
- Featured on Meta
- More network sites to see advertising test [updated with phase 2]
- We’re (finally!) going to the cloud!
- Call for testers for an early access release of a Stack Overflow extension...
Related
0 Unable to Fix the width of colum in bootstrap 0 Bootstrap column width 1 html : set column width 0 Style width selector of column 2 Bootstrap Col & Td width 1 Bootstrap Col width 0 Td widths not working 1 table not respecting column width properly 0 Bootstrap css,how to reduce the width of "th" and "td"? 1 Bootstrap Table Column width not getting Hot Network Questions
- Identifying a TNG episode where Dr. Pulaski instructs another doctor on a sling
- How to model data with "super failures"?
- Did renaissance actors learn their parts by heart?
- Is there any penalty for providing half cover to another creature?
- What is 擦边 as in the case of the athlete champion turned dancer?
- Table structure with multiple foreign keys and values
- An idiom similar to 'canary' or 'litmus test' that expresses the trend or direction a thing is pointed
- What is this Stardew Valley item?
- Rational independence of higher golden ratios
- How can I avoid overusing her/she or the character name when describing character action
- How do different observers decide if they are looking at the same thing?
- Comedy/Sci-Fi movie about one of the last men on Earth living in a museum/zoo on display for humanoid robots
- Find the Smallest Data Type for a Number
- How can I politely decline a request to join my project by a free rider professor
- Is the A321 XLR really necessary to fly MAD-BOS?
- Student is almost always late, and expects me to re-explain everything he missed
- Solving Large size problems in industry: Tips and Tricks
- Equally scaling and offsetting a 3D triangular mesh
- wikipedia: "the cross product is invariant under proper rotations"
- Where on Earth do tides go out furthest?
- The British used to (still?) classify their guns by weight in pounds rather than caliber. Was that a constant across shell types?
- Special stairs of infinites and infinitesimals
- Likely source of a hot-cold crossover?
- Is Holy Terra Earth?
more hot questions Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-html
Từ khóa » Html Th Column Width
-
HTML | Width Attribute - GeeksforGeeks
-
HTML Th Tag - W3Schools
-
HTML Table Sizes - W3Schools
-
HTML Th Width Attribute
-
Stop Using To Set Table Width In HTML: Here's Why »
-
Changing Column Width - The Complete HTML5 Tutorial
-
Table-layout - CSS: Cascading Style Sheets - MDN Web Docs
-
: The Table Column Element - HTML - MDN Web Docs - Mozilla
-
HTML Table Column Width - Tutorial Kart
-
Advanced Table Settings: Column Width, Alignment And Merging Cells
-
How To Set The Table Column Width Regardless Of The Text Amount ...
-
Chapter 3. How To Specify Tables And Columns Width
-
Tables In HTML Documents
-
Making A Wild Card Column Width - Tables
Liên Hệ
TRUYỀN HÌNH CÁP SÔNG THU ĐÀ NẴNG
Địa Chỉ: 58 Hàm Nghi - Đà Nẵng
Phone: 0904961917
Facebook: https://fb.com/truyenhinhcapsongthu/
Twitter: @ Capsongthu
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu
Trang chủ » Html Th Column Width » Column Width For
Có thể bạn quan tâm
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about Labs Column width for <th> not working Ask Question Asked 10 years, 2 months ago Modified 10 years, 2 months ago Viewed 76k times 15Here is my html:
<html> <head> <meta charset="utf-8"> <link href="css/bootstrap.css" rel="stylesheet"> <link href="css/bootstrap-theme.css" rel="stylesheet"> </head> <body style="padding-top: 47px;"> <table class="table table-hover table-striped-custom"> <thead> <tr> <th style="width: 5px;"></th> <th>Column2</th> <th>column2</td> </tr> </thead> <tbody> <tr> <td style="background-color: #FF5F5F;width: 5px;"></td> <td>blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bla</td> </tr> <tr> <td style="background-color: deepskyblue"></td> <td>bla</td> <td>bla</td> </tr> </tbody> </table>Problem is when setting width for first column: it won't go under 16px. If I put bigger width(20,50), colored column become larger, but when I try to set them thinner (for example 7px), It doesn't take any effect. How can I do it, without removing any css class from existing template. Colored column have to be first, it's height must be as row's height and I have to be able to set it's width to any value I want.
- html
- css
- twitter-bootstrap
- Seems to work here jsfiddle.net/mendesjuan/qq3L0o77. Oops nevermind, it breaks after you add bootstrap jsfiddle.net/mendesjuan/qq3L0o77/1 – Ruan Mendes Commented Sep 15, 2014 at 14:59
- something like this? – Litestone Commented Sep 15, 2014 at 15:04
- @Litestone Read my comment, the problem happens when you add bootstrap – Ruan Mendes Commented Sep 15, 2014 at 15:10
2 Answers 2
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 10It's because your bootstrap css is adding 8px padding to the table cells (which is why your min width is 16px: 8px left plus 8px right) - try adding padding:0; for those cells and it should work
Example
Share Improve this answer Follow answered Sep 15, 2014 at 14:58 PetePete 58.3k2929 gold badges129129 silver badges183183 bronze badges 3- Note that to add it in a CSS section will require a lot of specificity since bootstrap uses .table>thead>tr>td – Ruan Mendes Commented Sep 15, 2014 at 15:15
- @JuanMendes As OP is using inline styles, they should override the stylesheet styles, otherwise yes they will need to be more specific than the css in the bootstrap – Pete Commented Sep 15, 2014 at 15:18
- That's what I said, if the OP is going to move to using best practices, they'll need to use high specificity. I never said what you have doesn't work, but I'm sure we agree it's not the best way to do things. – Ruan Mendes Commented Sep 15, 2014 at 15:20
It's possible that bootstrap has set min-width on th or td. If so, I'd add an additional style block (in the HTML, if you can't add/edit external CSS), to allow the first column to be as small as you like:
<style type="text/css"> .table td:first-child, .table th:first-child { min-width: 0; padding: 0; } </style> Share Improve this answer Follow answered Sep 15, 2014 at 14:59 Paul RoubPaul Roub 36.4k2727 gold badges8585 silver badges9393 bronze badges Add a comment |Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discardedSign up or log in
Sign up using Google Sign up using Email and Password SubmitPost as a guest
Name EmailRequired, but never shown
Post Your Answer DiscardBy clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged - html
- css
- twitter-bootstrap
or ask your own question.
- The Overflow Blog
- Your docs are your infrastructure
- Featured on Meta
- More network sites to see advertising test [updated with phase 2]
- We’re (finally!) going to the cloud!
- Call for testers for an early access release of a Stack Overflow extension...
Related
0 Unable to Fix the width of colum in bootstrap 0 Bootstrap column width 1 html : set column width 0 Style width selector of column 2 Bootstrap Col & Td width 1 Bootstrap Col width 0 Td widths not working 1 table not respecting column width properly 0 Bootstrap css,how to reduce the width of "th" and "td"? 1 Bootstrap Table Column width not gettingHot Network Questions
- Identifying a TNG episode where Dr. Pulaski instructs another doctor on a sling
- How to model data with "super failures"?
- Did renaissance actors learn their parts by heart?
- Is there any penalty for providing half cover to another creature?
- What is 擦边 as in the case of the athlete champion turned dancer?
- Table structure with multiple foreign keys and values
- An idiom similar to 'canary' or 'litmus test' that expresses the trend or direction a thing is pointed
- What is this Stardew Valley item?
- Rational independence of higher golden ratios
- How can I avoid overusing her/she or the character name when describing character action
- How do different observers decide if they are looking at the same thing?
- Comedy/Sci-Fi movie about one of the last men on Earth living in a museum/zoo on display for humanoid robots
- Find the Smallest Data Type for a Number
- How can I politely decline a request to join my project by a free rider professor
- Is the A321 XLR really necessary to fly MAD-BOS?
- Student is almost always late, and expects me to re-explain everything he missed
- Solving Large size problems in industry: Tips and Tricks
- Equally scaling and offsetting a 3D triangular mesh
- wikipedia: "the cross product is invariant under proper rotations"
- Where on Earth do tides go out furthest?
- The British used to (still?) classify their guns by weight in pounds rather than caliber. Was that a constant across shell types?
- Special stairs of infinites and infinitesimals
- Likely source of a hot-cold crossover?
- Is Holy Terra Earth?
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-htmlTừ khóa » Html Th Column Width
-
HTML |
Width Attribute - GeeksforGeeks HTML Th Tag - W3Schools
HTML Table Sizes - W3Schools
HTML Th Width Attribute
Stop Using To Set Table Width In HTML: Here's Why »
Changing Column Width - The Complete HTML5 Tutorial
Table-layout - CSS: Cascading Style Sheets - MDN Web Docs
: The Table Column Element - HTML - MDN Web Docs - Mozilla HTML Table Column Width - Tutorial Kart
Advanced Table Settings: Column Width, Alignment And Merging Cells
How To Set The Table Column Width Regardless Of The Text Amount ...
Chapter 3. How To Specify Tables And Columns Width
Tables In HTML Documents
Making A Wild Card Column Width - Tables
Liên Hệ
TRUYỀN HÌNH CÁP SÔNG THU ĐÀ NẴNG
Địa Chỉ: 58 Hàm Nghi - Đà Nẵng
Phone: 0904961917
Facebook: https://fb.com/truyenhinhcapsongthu/
Twitter: @ Capsongthu
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu