简体   繁体   English

将表格与图像HTML对齐

[英]Aligning table with an image HTML

I am trying to align a table next to image, which has text aligned with it currently. 我正在尝试对齐图像旁边的表格,该表格目前与文本对齐。 I want to have the dropdowns align with the lower edge of the image, can anyone assist me with this? 我希望下拉菜单与图像的下边缘对齐,任何人都可以帮我这个吗? Here is my code. 这是我的代码。

<input type="image" src="image.jpg" name="tee" width="180" height="180" ALIGN="center">xxxxxx

<table>
<tr><td><input type="hidden" name="on0" value="Color">Color</td><td><input type="hidden" name="on1" value="Size">Size</td></tr>
<tr>
<td><select name="os0">
    <option value="White">White</option>
    <option value="Black">Black</option>
    <option value="Grey">Grey</option>
</select> </td>
<td><select name="os1">
    <option value="S">S </option>
    <option value="M">M </option>
    <option value="L">L </option>
    <option value="XL">XL </option>
</select> </td>

</tr>

Maybe you should go for the CSS3 , It has a lot properties like left , right or top . 也许你应该去CSS3,它有很多属性,如左,右或顶。 I do not know css completely but their are a lot of tutorials on the internet. 我完全不知道css,但他们在互联网上有很多教程。

Based on your description, this is the best I could come up with using CSS to style it. 根据您的描述,这是我用CSS来设计它的最好方法。

<style>
div {height: 180px;
width: 300px;}

#image {
    float:left; 
 }
 table { float:right;
    margin-top: 130px;
  }

  </style>

<div>
<input id="image" type="image" src="image.jpg" name="tee" width="180" height="180"               ALIGN="center">

<table>
<tr><td><input type="hidden" name="on0" value="Color">Color</td><td><input   type="hidden" name="on1" value="Size">Size</td></tr>
<tr>
<td><select name="os0">
<option value="White">White</option>
<option value="Black">Black</option>
<option value="Grey">Grey</option>
</select> </td>
<td><select name="os1">
<option value="S">S </option>
<option value="M">M </option>
<option value="L">L </option>
<option value="XL">XL </option>
</select> </td>

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

But you can also fix the issue by using a table and then vertically aligning the contents of the second cell in the row to the bottom. 但您也可以通过使用表格然后将行中第二个单元格的内容垂直对齐到底部来解决问题。

    <table><tr><td>
<input id="image" type="image" src="image.jpg" name="tee" width="180" height="180" ALIGN="center"></td>

<td valign="bottom"> <!-- This line right here is what does the trick -->

<table>
<tr><td><input type="hidden" name="on0" value="Color">Color</td><td><input type="hidden" name="on1" value="Size">Size</td></tr>
<tr>
<td><select name="os0">
<option value="White">White</option>
<option value="Black">Black</option>
<option value="Grey">Grey</option>
</select> </td>
<td><select name="os1">
<option value="S">S </option>
<option value="M">M </option>
<option value="L">L </option>
<option value="XL">XL </option>
</select> </td>

</tr></table>
    </td></tr>
        </table>

hope this helps! 希望这可以帮助!

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

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