HTML 'td' Width And Height - Stack Overflow
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 HTML 'td' width and height Ask Question Asked 12 years, 1 month ago Modified 7 years, 1 month ago Viewed 353k times 61The 'height' and 'width' are not supported in HTML5. How can I set a td's width and height while conforming to the HTML5 standard?
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>219 班網</title> </head> <body bgcolor="silver"> <div align="center"> <table> <tr> <td width="1000" height="250"> <object width="100%" height="100%" data="frameTop.html"></object> </td> </tr> </table> <table> <tr> <td width="300" height="700" > <object width="100%" height="100%" data="frameLeft.html"></object> </td> <td width="700" height="700"> <object width="100%" height="100%" data="frameRight.html"></object> </td> </tr> </table> </div> </body> </html> Share Improve this question Follow edited Oct 25, 2016 at 14:52 Brian Tompsett - 汤莱恩 5,87572 gold badges60 silver badges133 bronze badges asked Oct 14, 2012 at 9:50 Shane HsuShane Hsu 8,3076 gold badges42 silver badges65 bronze badges 3- To any HTML/javascript people that the code is in C-style layout LOL – Shane Hsu Commented Oct 14, 2012 at 9:51
- @Zyga So if I use CSS to assign width and height value, it won't be in conflict with HTNL5 standard? – Shane Hsu Commented Oct 14, 2012 at 9:53
- Thats right, there is no conflict as its CSS code not HTML. The HTML attributes were deprecated in HTML5, nothing to do with CSS if you know what I mean. – Zyga Commented Oct 14, 2012 at 9:56
2 Answers
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 98The width attribute of <td> is deprecated in HTML 5.
Use CSS. e.g.
<td style="width:100px">in detail, like this:
<table > <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td style="width:70%">January</td> <td style="width:30%">$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table> Share Improve this answer Follow edited Jun 6, 2014 at 0:51 bd33 5121 gold badge15 silver badges31 bronze badges answered Oct 14, 2012 at 9:54 Ravindra BagaleRavindra Bagale 17.6k9 gold badges45 silver badges70 bronze badges 5- What if you need to exceed the width of the page? For example the width of the page is 2000 and your cell needs to be 5000 like: <td style="width:5000px">January</td> – Igor Krupitsky Commented Feb 9, 2016 at 9:46
- @IgorKrupitsky put the table inside t div that has css: overflow-x: scroll; You will then get a horizontal scrollbar – punkologist Commented Jul 12, 2016 at 4:34
- 7 doesn't seem to work for a table with more columns, and where the columns have varying amounts of data in them – Don Cheadle Commented Sep 12, 2016 at 19:25
- 1 "The width attribute of <td> is deprecated in HTML 5." - it was actually already deprecated in HTML 4; see w3.org/TR/html401/struct/tables.html#edef-TH. – Mark Amery Commented Jul 22, 2017 at 16:25
- 1 Its deprecated but I noticed it still working - at least in Chrome 64. Why? – ed1nh0 Commented Feb 26, 2018 at 12:53
Following width worked well in HTML5: -
<table > <tr> <th style="min-width:120px">Month</th> <th style="min-width:60px">Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table>Please note that
- TD tag is without CSS style.
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
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!
Linked
652 How to set up fixed width for <td>? 0 JQuery - Every click on table changes the cell width 1 HTML TD width not taking effect 0 Why two tables cannot align properly?Related
1 Resize TD in a table 0 how to set width,height etc to particular table in html 0 HTML - table / td sizing issue 0 Change size of TD in an HTML table 0 Width property applied to td 0 td height and width not getting picked up 1 increase width and height of td cells in html 1 How to set Dynamic height and width to a HTML table? 0 Table dimensions in CSS not working in HTML 0 JavaScript, td size always changeHot Network Questions
- Does length contraction "break the speed limit"?
- Why did Satan take Jesus to the Temple to jump down from?
- Mega Man: Powered Up
- Diagonal analogue of symmetric functions
- What exactly is the cornerstone that Mark 12:10 speaks of?
- What mechanism could cause a person not to cast a reflection?
- I am the owner of an image. I published it in Unsplash. Am I allowed to upload that same image to other sites?
- The product of the alternating lengths of a hexagon whose vertices belong to an ellipse
- Values of quadratic function and its discriminant
- Is ATL-98 Carvair still alive in the US?
- What's a good way to append a nonce to ciphertext in Python for AES GCM in Python?
- Walks in Nice (Nizza)
- What was the female equivalent of πάππας in Ancient Greek?
- Isekai mahwa with silver haired male lead who is an illegitimate prince
- What powers do police have to force people onto trains?
- Can you see through a cannonball packing?
- How is one supposed to play these notes?
- Reality check: energy source for power armour
- Can .zshrc be modified automatically?
- Conditional Definition of a Mathematical Operator
- If Occam's razor supports naturalism over theism, then why was William of Ockham, its author, a theist and not a naturalist?
- p column type stops compilation in RevTeX
- Find the one sentence that is wrong in the following proof.
- Is there a limit below a panel's rating for bonding neutrals and grounds?
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-htmlTừ khóa » Html Td Width Html5
-
HTML Td Tag - W3Schools
-
How To Set Cell Width And Height In HTML? - Tutorialspoint
-
Stop Using To Set Table Width In HTML: Here's Why »
-
HTML |
Width Attribute - GeeksforGeeks How To Set Fixed Width For
In A Table ? - GeeksforGeeks HTML Td Width Attribute - W3Schools
HTML/Table Tags/width And Height Of A Cell - TAG Index
Changing Column Width - The Complete HTML5 Tutorial
: The Table Data Cell Element - HTML - MDN Web Docs - Mozilla HTML Td Width Attribute
HTML Element: Td: Width | Can I Use... Support Tables For HTML5 ...
The “width” Attribute On The Table (or Td) Element Is Obsolete. Use ...
How To Set HTML Table Width And Height
HTML And CSS Tutorial: How-To's And Miscellaneous
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu