Html 调整浏览器窗口的大小会导致表格单元格中出现奇怪的行为
我有把小提琴: 一旦我调整浏览器的宽度,图像就会变小(这是我真正想要的),但tablecells不会。我希望表格单元格的宽度和高度也变小,这样按钮所在的单元格实际上就是图片的大小。我不知道该如何解决这个问题,真的需要一些帮助 CSS: HTML: 编辑:现在我更改了它,使其全部包含百分比: 但现在这种行为更为怪异。我的桌面单元格的高度太小了,尽管我认为它应该显示为桌面大小的33% 我现在真的陷入了死胡同,不知道自己做错了什么- 问候Html 调整浏览器窗口的大小会导致表格单元格中出现奇怪的行为,html,css,mobile,Html,Css,Mobile,我有把小提琴: 一旦我调整浏览器的宽度,图像就会变小(这是我真正想要的),但tablecells不会。我希望表格单元格的宽度和高度也变小,这样按钮所在的单元格实际上就是图片的大小。我不知道该如何解决这个问题,真的需要一些帮助 CSS: HTML: 编辑:现在我更改了它,使其全部包含百分比: 但现在这种行为更为怪异。我的桌面单元格的高度太小了,尽管我认为它应该显示为桌面大小的33% 我现在真的陷入了死胡同,不知道自己做错了什么- 问候 Flo尝试将“最大宽度”更改为“宽度”看看[这个][1]问题,
Flo尝试将“最大宽度”更改为“宽度”看看[这个][1]问题,简言之,不。不仅仅是CSS。[1] :欢迎光临。你能详述你的答案吗?例如,请提供这样做的原因、两者之间的区别以及其他有助于补充答案的信息。如果你可以编辑你的答案,为你的答案添加更多的信息,那就太好了。非常感谢。
body, html {
font-family:"HelveticaNeue-Bold", sans-serif;
background-color: black;
max-width:640px;
margin-left: auto;
margin-right: auto;
}
.button1 {
background:url(http://thumb4.ftd.de/standardteaser/Image/2012/11/19/20121119200026.1845.maerskline.290x180.jpg) no-repeat center center;
background-size: 100%;
width:100%;
max-width: 100%;
height:100%;
cursor:pointer;
border:none;
font-size: 0.1px;
}
.button2 {
background:url(http://thumb4.ftd.de/standardteaser/Image/2012/11/19/20121119200026.1845.maerskline.290x180.jpg) no-repeat center center;
background-size: 100%;
width:100%;
height:100%;
cursor:pointer;
max-width: 100%;
border:none;
font-size: 0.1px;
}
.button3 {
background:url(http://thumb4.ftd.de/standardteaser/Image/2012/11/19/20121119200026.1845.maerskline.290x180.jpg) no-repeat center center;
background-size: 100%;
width:100%;
height:100%;
max-width: 100%;
cursor:pointer;
border:none;
font-size: 0.1px;
}
.button4 {
background:url(http://thumb4.ftd.de/standardteaser/Image/2012/11/19/20121119200026.1845.maerskline.290x180.jpg) no-repeat center center;
background-size: 100%;
width:100%;
height:100%;
max-width: 100%;
cursor:pointer;
border:none;
font-size: 0.1px;
}
.button5 {
background:url(http://thumb4.ftd.de/standardteaser/Image/2012/11/19/20121119200026.1845.maerskline.290x180.jpg) no-repeat center center;
background-size: 100%;
width:100%;
max-width: 100%;
height:100%;
cursor:pointer;
border:none;
font-size: 0.1px;
}
.button6 {
background:url(http://thumb4.ftd.de/standardteaser/Image/2012/11/19/20121119200026.1845.maerskline.290x180.jpg) no-repeat center center;
background-size: 100%;
width:100%;
max-width: 100%;
height:100%;
cursor:pointer;
border:none;
font-size: 0.1px;
}
.header {
width: 100%;
}
.header img {
width: 100%;
}
.formClass {
width: 100%;
height:100%;
}
.sixButtons {
width: 100%;
height:100%;
}
table.sixButtons tr {
width:100%;
height:200px;
}
table.sixButtons td {
width:50%;
height:200px;
}
<body>
<div class="header">
<img src="images/headerbefore.jpg" />
</div>
<form action="vote.php" method="post" class="formClass" name="buttonForm">
<table class="sixButtons">
<tr>
<td>
<button type="image" onclick="setavalue(1)" enctype="multipart/form-data" id="votingvalue1" class="button1">
</td>
<td>
<button type="image" onclick="setavalue(2)" enctype="multipart/form-data" id="votingvalue2" class="button2">
</td>
</tr>
<tr>
<td>
<button type="image" onclick="setavalue(3)" enctype="multipart/form-data" id="votingvalue3" class="button3">
</td>
<td>
<button type="image" onclick="setavalue(4)" enctype="multipart/form-data" id="votingvalue4" class="button4">
</td>
</tr>
<tr>
<td>
<button type="image" onclick="setavalue(5)" enctype="multipart/form-data" id="votingvalue5" class="button5">
</td>
<td>
<button type="image" onclick="setavalue(6)" enctype="multipart/form-data" id="votingvalue6" class="button6">
</td>
</tr>
</table>
<input id="votingvalue" type="hidden" value="" name="votingvalue">
<input type="hidden" value="2" name="voteid">
</form>
</div>
</body>
</html>
function setavalue(value) {
value = parseInt(value);
if (value === 1) {
document.getElementById('votingvalue').value = '1';
} else if (value === 2) {
document.getElementById('votingvalue').value = '2';
} else if (value === 3) {
document.getElementById('votingvalue').value = '3';
} else if (value === 4) {
document.getElementById('votingvalue').value = '4';
} else if (value === 5) {
document.getElementById('votingvalue').value = '5';
} else if (value === 6) {
document.getElementById('votingvalue').value = '6';
}
document.forms["buttonForm"].submit();
}