Hoseong Jeon
Hoseong Jeon

Reputation: 1350

How to set table position beside image with css?

I want to set my table's position right of my image.

Here's my code:

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

I've tried this, but it didn't work.

How can I make it?

Upvotes: 0

Views: 64

Answers (1)

Code Maniac
Code Maniac

Reputation: 37775

Wrap image and table in a div and than You can use flex and flex-order property of 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>

Upvotes: 1

Related Questions