Html 拉伸表格的宽度以适应网络浏览器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4637750/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Stretching a Table's Width to fit web browser
提问by Techn0guy
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:
我已经在互联网上搜索了很长时间试图解决我的问题。我有一张桌子,里面有我的整个网站,并希望它能够拉伸以适应用户的 Web 浏览器大小。这是网站的所有代码:
<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.
任何有用的解决方案将不胜感激。
回答by Harry Joy
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>
以百分比形式给出宽度<table>
并<TD>
标记。这将根据浏览器窗口大小进行设置。给<table>
每一个100%和适当的百分比<TD>
回答by Harry Joy
<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.
这将确保您的表格将拉伸到浏览器的大小。
回答by ifaour
I'm surprised that there are already three answers for this question!
Well, first of all the guy tagged the question dreamweaver
, using My Images
in the src
and using tables! This means that the real help he needs is actually learning the basics of HTML and CSS!
我很惊讶这个问题已经有三个答案了!
好吧,首先这个家伙标记了问题dreamweaver
,使用My Images
insrc
和 using 表!这意味着他真正需要的帮助实际上是学习 HTML 和 CSS 的基础知识!
What I suggest is try to search for resources to learn the basics and if you couldn't find then ask for that here! how does that sounds? :-)
我的建议是尝试搜索资源来学习基础知识,如果找不到,请在此处索取!听起来如何?:-)
And for you guys (who answered) even changing the td widths to percentage wouldn't fix his problem since the img
s will stretch to their full widths! so it would be ~2044px! which is wider than most screen resolutions!!
对于你们(谁回答),即使将 td 宽度更改为百分比也无法解决他的问题,因为img
s 会拉伸到它们的全宽!所以它会是~2044px!这比大多数屏幕分辨率都宽!!