Html - Stretching A Table's Width To Fit Web Browser - Stack Overflow

    1. Home
    2. Questions
    3. Tags
    4. Users
    5. Companies
    6. Labs
    7. Jobs
    8. Discussions
    9. Collectives
    10. Communities for your favorite technologies. Explore all Collectives

  1. Teams

    Ask questions, find answers and collaborate at work with Stack Overflow for Teams.

    Try Teams for free Explore Teams
  2. Teams
  3. 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 Stretching a Table's Width to fit web browser Ask Question Asked 13 years, 10 months ago Modified 7 years, 2 months ago Viewed 61k times 7

I have scoured the internet for a long time trying to solve my problem. I have a table with my whole site in it and would like for it to stretch to fit the user's web browser size. Here is all the site's code:

<body> <table width="100%" border="0"> <tr> <td width="525" rowspan="2"><img src="My Images/Speaker.png" width="525" height="772" ondragstart="return false" /> </td> <td width="697" height="16"> *Flash Video Here* </td> </tr> <tr> <td><img src="My Images/Vymil.jpg" width="822" height="597" ondragstart="return false"/></td> </tr> </table> </body> </html>

Any helpful solutions would be greatly appreciated.

Share Improve this question Follow edited Sep 10, 2017 at 18:14 Brian Tompsett - 汤莱恩's user avatar Brian Tompsett - 汤莱恩 5,87572 gold badges60 silver badges133 bronze badges asked Jan 9, 2011 at 4:51 Techn0guy's user avatar Techn0guyTechn0guy 791 gold badge1 silver badge2 bronze badges 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) 7

Give width in Percentage in <table> and <TD> tag. This it will set as per browser window size. Give 100% in <table> and appropriate percentages to every <TD>

Share Improve this answer Follow answered Jan 9, 2011 at 4:54 Harry Joy's user avatar Harry JoyHarry Joy 59.6k30 gold badges163 silver badges209 bronze badges 2
  • Thanks for all the quick responses I've tried the above 2, and still no luck. Harry Joy I know that this is a possible solution I just didnt want to have to delve into percentages anymore wanted to know if there was a simpler solution to make the <TD> tags auto resize due to the parent tables resizing – Techn0guy Commented Jan 9, 2011 at 5:08
  • @Tech0guy: No its not dependent on parent if you give size without percentage. It will be same for all browser sizes. – Harry Joy Commented Jan 9, 2011 at 5:14
Add a comment | 1 <style type="text/css"> * { margin: 0px; padding: 0px; } html, body { height: 100%; } </style> <table style="width:100%;height:100%;"> <!-- content --> </table>

This will ensure your table will stretch to your browser's size.

http://jsfiddle.net/L9wMU/

Share Improve this answer Follow edited Jan 9, 2011 at 5:32 answered Jan 9, 2011 at 4:57 user1385191user1385191 2
  • I added a test page for you to show how your code should look.user1385191 Commented Jan 9, 2011 at 5:33
  • @user1385191 thanks for sharing a propert snippet of code, that everyone can relate and understand too! – 3kstc Commented Jul 20, 2017 at 0:57
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 or ask your own question.

  • The Overflow Blog
  • We'll Be In Touch - A New Podcast From Stack Overflow!
  • The app that fights for your data privacy rights
  • Featured on Meta
  • More network sites to see advertising test
  • We’re (finally!) going to the cloud!
  • Call for testers for an early access release of a Stack Overflow extension...
3 HTML table width fit to browser window 0 Dream Weaver Table Width 1 Stretching a table-cell to the width of the table 0 how to fix the width of a td or table so that it does not stretches 1 Making html table use 100% of available width 1 Make HTML table columns fixed width (and stretch to fit) 6 Make HTML table wide enough to fit content 0 Table column width stretched 1 Let <table> expand width via CSS 2 How to stretch each TD to fit the table width

Hot Network Questions

  • Where in the Gospels does Jesus explain what 'The Truth' is?
  • Did renaissance actors learn their parts by heart?
  • C# basic calculator
  • Unexpected Slower Performance with Column-Major Access in Fortran Arrays
  • Is my evaluation for this multiple linear regression correct?
  • Will Spirit trade with SAVEQ when it recovers?
  • Gifting $10k to my 17 year old nephew
  • Why constrain the unit type by a generic trait bound in a where clause (as in `where () : Trait<…>`)?
  • User temp folder is 103GB. Is it safe to delete?
  • I want to align Mathematics and class X vertically
  • Short story about a man living In an apartment who's curious about his neighbor who turns out to be a monster or demon
  • Remove vertical lines from a cell row
  • Why「记」for shop names?
  • What do I need to use the Transform Gizmo in Geometry Nodes?
  • Testing Puzzles for Puzzle Book: Enigmatic Puzzle
  • Why is there an erroneus Hebrew text, about the completed works on the seventh day?
  • Advantages of information criteria over cross-validation
  • Topology generated by seminorm, why not just take supremum
  • Does the earliest known use of an "average" occur after the invention of calculus?
  • Generator breaker trips when hooked up for backfeed
  • Do referees get to see each other's reports?
  • How SMA (or RF) connector's impedance is measured and rated?
  • How to protect against fake gold bars?
  • Is partial correctness decidable?
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 Table Stretch