如何使用CSS图像旁边表中的位置?

问题描述 投票:0回答:1

我想设置我的形象我的表的位置正确。

这里是我的代码:

<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>

我已经试过这一点,但没有奏效。

我怎么能做到吗?

javascript html css
1个回答
1
投票

裹图像和表格在一个div比你可以使用Flex order的柔性和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>
© www.soinside.com 2019 - 2024. All rights reserved.