我试图将三个表格显示为三个独立的元素,水平显示。这意味着它们应该从左到右并排出现。我尝试使用inline-block
和设置边距、边框,但它不起作用:
<div style="border:2px solid black; width:485px;">
<h1 align= "center" style="color:blue"> Interaction </h1>
<p style="display:inline-block; width:180px; margin:10px; padding:20px;">
<h3> Light </h3>
<table border="1">
<tr>
<td> Color </td>
<td> <input type="text" id="light-color" value="0xffffff"> </input> </td>
</tr>
<tr>
<td> Type </td>
<td>
<select id="light-type">
<option value="point"> Point Light </option>
<option value="spot"> Spot Light </option>
<option value="ambient"> Ambient Light </option>
<option value="area"> Area Light </option>
<option value="directional"> Directional Light </option>
<select>
</td>
</tr>
</table>
</p>
<p style="display:inline-block; width:180px; margin:10px; padding:20px;">
<h3> Material </h3>
<table border="1">
<tr>
<td> Diffuse </td>
<td> <input type="text" id="material-diffuse" value="0xffffff"> </input> </td>
</tr>
<tr>
<td> Ambient </td>
<td> <input type="text" id="material-ambient" value="0xffffff"> </input> </td>
</tr>
<tr>
<td> Emissive </td>
<td> <input type="text" id="material-emissive" value="0xffffff"> </input> </td>
</tr>
<tr>
<td> Specular </td>
<td> <input type="text" id="material-specular" value="0xffffff"> </input> </td>
</tr>
<tr>
<td> Shininess </td>
<td> <input type="text" id="material-shininess" value="0xffffff"> </input> </td>
</tr>
<tr>
<td> Type </td>
<td>
<select id="material-type">
<option value="lambert"> Lambert </option>
<option value="normal"> Normal </option>
<option value="phong"> Phong </option>
</select>
</td>
</tr>
</table>
</p>
<p style="display:inline-block; width:180px; margin:10px; padding:20px;">
<h3> Object </h3>
<table border="1">
<tr>
<td> Type </td>
<td>
<select>
<option value= "sphere"> Sphere </option>
<option value= "cube"> Cube </option>
<option value= "cylinder"> Cylinder </option>
</select>
</td>
</tr>
</table>
</p>
</div>
表格仍然垂直显示。