简体   繁体   English

当屏幕放大或缩小时,如何使元素保持原位?

[英]How do I make <td> elements stay in place when the screen is zoomed in or out?

<div>
 <table cellpadding="0" cellspacing="0" border="0" class="standard-table standard-table-mini" 
 summary="Object Table" style="padding-left: 224px; padding-right: 50px;">
  <thead>
   <tr>
    <th align="center" style="right-padding:10px;"><b>Action</b></th>
     <th align="left"><b>Components</b></th>
   </tr>
  </thead>
<tbody>
 <tr class="even">
  <td align="left" style="width: 550px;>
   <div class="field">//some code here to enter radio button as input</div>
  </td>

  <td align="center">
   <div class="field">//some code here to populate components when radio button is selected</div>
  </td>

  <td align="right" style="display: block;" id ="somelabel"> //this is initially not displayed and will only be displayed when Radio button8 is selected
   <input type="number">//some code here to enter labels and input
  </td>

 </tr>
</tbody>
</table>
</div>

This is what it looks like at 100% zoomed in:这是 100% 放大后的样子: 在此处输入图像描述

This is what it looks kike when the last radio button is selected at 100% zoomed in:这是在 100% 放大时选择最后一个单选按钮时的样子: 在此处输入图像描述

This is what I want it to look like (this is when its 67% zoomed out)这就是我想要的样子(这是缩小 67% 的时候) 在此处输入图像描述 And i want the middle and right <td> element to stay in its place even when I zoom in and out.而且我希望中间和右侧的<td>元素即使在我放大和缩小时也能保持原位。 I am not allowed to change the implementation to css flexbox so, it will be great if I can work something with position width or something like that.我不允许将实现更改为 css flexbox 所以,如果我可以使用position width或类似的东西,那就太好了。 Very new to HTML/CSS. HTML/CSS 非常新。

May bee td align="left" style="width: 60%"?可能bee td align="left" style="width: 60%"? or td align="center" position: absolute;或 td align="center" position:绝对; top: 20%;最高:20%; left: 60%;左:60%; and position: relative should not be at the parent和 position:亲戚不应该在父母

this one is fixed to the left component这个固定在左边的组件上

 <div> <table cellpadding="0" cellspacing="0" border="0" class="standard-table standard-table-mini" summary="Object Table" style="padding-left: 224px; padding-right: 50px;"> <thead> <tr> <th align="center" style="right-padding:10px;"><b>Action</b></th> <th align="left"><b>Components</b></th> </tr> </thead> <tbody> <tr class="even"> <td align="left" style="width: 60%"> <div class="field">//some code here to enter radio button as input</div> </td> <td align="center"> <div class="field">//some code here to populate components when radio button is selected</div> </td> <td align="right" style="display: block;" id ="somelabel"> //this is initially not displayed and will only be displayed when Radio button8 is selected <input type="number">//some code here to enter labels and input </td> </tr> </tbody> </table> </div>

but this one is fixed to the window但是这个固定在 window

 <div> <table cellpadding="0" cellspacing="0" border="0" class="standard-table standard-table-mini" summary="Object Table" style="padding-left: 224px; padding-right: 50px;"> <thead> <tr> <th align="center" style="right-padding:10px;"><b>Action</b></th> <th align="left"><b>Components</b></th> </tr> </thead> <tbody> <tr class="even"> <td align="left" style="width: 550px"> <div class="field">//some code here to enter radio button as input</div> </td> <td align="center" style="position: absolute; left: 60%; top: 20%"> <div class="field">//some code here to populate components when radio button is selected</div> </td> <td align="right" style="display: block; position: absolute; left: 80%; top: 20%" id ="somelabel"> //this is initially not displayed and will only be displayed when Radio button8 is selected <input type="number">//some code here to enter labels and input </td> </tr> </tbody> </table> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM