我想把我的邊欄與搜索結果旁邊我的谷歌地圖(我使用gmaps4rails)。我得到了他們並肩但問題是側邊欄沒有延伸到地圖的長度看圖像SideBar with google Map.我有困難的時候把我的側邊欄旁邊我的谷歌地圖 - gmaps4rails
這是我在我看來代碼
<div id="sideBar" class="pre-scrollable">
<h2><%= @count%> results found </h2>
<br>
<% @maps.each do |map| %>
<div>
<div class="" id="map_<%= map.id %>">
<h4>
<%= link_to map.number, controller: "maps", action: "show", id: map.id%>
</h4>
<hr>
</div>
</div>
<% end %>
<%= link_to 'Return to Main Map', maps_path %>
</div>
<div id="map_wrapper">
<div id="map" style='width: 100%; height: 100%;'></div>
</div>
這裏是我的代碼在CSS:
#map_wrapper {
margin-left: 300px;
height: 800px;
}
#sideBar{
width: 300px;
height: 800px;
position: absolute;
}
我的目標是肩並肩,長度完全相同。
嘗試都在一個'.wrapper'元件包裹,並用'.wrapper {顯示:彎曲; }'。然後從'#map_wrapper'中刪除邊距,並從'#sideBar'中刪除位置 –
@MichaelCoker我試圖對所提到的更改進行修改,但對我無效。謝謝你試圖幫助我。我會繼續努力,並在我這樣做的時候更新我的答案。 –