【问题标题】:How to place img tag and div tag beside each other?如何将 img 标签和 div 标签并排放置?
【发布时间】:2013-02-20 04:57:59
【问题描述】:

我试图在我的img tag 旁边放置一个div,但div 显示在img tag 下方,但我想要它在旁边,我们如何将img and div tag 放在彼此旁边

 <img usemap="#ChartImageMap" src="@Url.Action("GetChart", "Home")" alt="Asp.Net Char" style="width:450px;height:300px;border-width:0px;" />
 <div id="map" style="height:300px;"></div>

【问题讨论】:

  • 只需使用display:inline 作为您的 div 标签。 fiddle

标签: asp.net-mvc html tags image


【解决方案1】:

您希望 div 内联显示:

<div id="map" style="display:inline; height:300px;"></div>

你也可以只使用一个跨度:

<span id="map" style="height:300px;"></span>

【讨论】:

  • 我希望 div 和 img 并排显示,即在同一行中...使用 display:inline 属性后,地图本身不会显示在任何地方
  • 尝试将 img 设置为向左浮动。
猜你喜欢
  • 2019-01-15
  • 1970-01-01
  • 2012-05-12
  • 1970-01-01
  • 2018-12-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多