簡體   English   中英

如何使用CSS在圖像旁邊設置表格位置?

[英]How to set table position beside image with css?

我想在圖像的右邊設置桌子的位置。

這是我的代碼:

 <html> <head> <style type="text/css"> .podium { display: block; margin-left: 300; margin-top: 500; position: static; } table { position: relative; left: 100px; } </style> </head> <body> <img src="podium.jpg" class="podium"> <table border="5px"> <tr> <td>aaa</td> </tr> </table> </body> </html> 

我已經嘗試過了,但是沒有用。

我該怎么做?

將圖片和表格包裝在div中,然后可以使用Flex order的 flex和flex-order屬性。

 #wrapper{ display: flex; } #image{ order:2; width: 100px; height:100px; margin-left:15px} #table{ order:1; } 
 <div id='wrapper'> <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSNyNcwf4fDjX_2L4mUcJNmg92fOmWlDTYxcefggBG0VAr6MX32" class="podium" id='image'> <table border="5px" id='table'> <tr> <td>aaa</td> </tr> </table> </div> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM