2017-01-22 34 views
-3

enter image description hereMVC如何創建磚(?)在視圖

我很抱歉我認爲是一個壞的問題。任何人都會有一個例子來說明如何在圖片上創建一些東西,所以在MVC中有些圖塊?這已經在https://www.exceptionnotfound.net/asp-net-mvc-demystified-display-and-editortemplates/上可用,但它不再是了,我需要知道如何創建類似的東西,但一直沒能找到它。

任何幫助將不勝感激,即使它只是上述的正確名稱!

+0

你可能想看看這個答案:https://stackoverflow.com/questions/8470070/how-to-create-grid-tile-view#8470083 – SharpC

回答

0

如果它在ASP,Java Spring或普通的舊HTML中,它確實無關緊要,它更多地與CSS和Bootstrap相關,而不是ASP.NET MVC。

這就是我會做的。

打開你的Views\Home\index.html,你可以刪除一切並粘貼下面的東西(這是一個很好的開始模板) - 從here中抓取。

@{ 
    ViewBag.Title = "Home Page"; 
} 
<div class="container"> 
    <div class="row"> 
     <div class="col-xs-4"> 
      <a href="#" class="thumbnail"> 
      <img src="http://placehold.it/400x200" alt="..." /> 
      </a> 
     </div> 
     <div class="col-xs-4"> 
      <a href="#" class="thumbnail"> 
      <img src="http://placehold.it/400x200" alt="..." /> 
      </a> 
     </div> 
     <div class="col-xs-4"> 
      <a href="#" class="thumbnail"> 
      <img src="http://placehold.it/400x200" alt="..." /> 
      </a> 
     </div> 
     <div class="col-xs-3"> 
      <a href="#" class="thumbnail"> 
      <img src="http://placehold.it/300x150" alt="..." /> 
      </a> 
     </div> 
      <div class="col-xs-3"> 
      <a href="#" class="thumbnail"> 
      <img src="http://placehold.it/300x150" alt="..." /> 
      </a> 
     </div> 
     <div class="col-xs-3"> 
      <a href="#" class="thumbnail"> 
      <img src="http://placehold.it/300x150" alt="..." /> 
      </a> 
     </div> 
     <div class="col-xs-3"> 
      <a href="#" class="thumbnail"> 
      <img src="http://placehold.it/300x150" alt="..." /> 
      </a> 
     </div> 
    </div> 
</div> 

您將獲得縮略圖風格格,你再需要改進(與CSS)給它的外觀和感覺,你後(讓你閱讀bootstrap's documentation)。

enter image description here

0

您不需要使用MVC創建切片。你可以使用CSS或Javascript。有許多JS/CSS庫可以讓你平鋪你的HTML。

我會在這裏發佈一些,但老實說,你應該使用谷歌來找到一些js/css瓷磚佈局庫,以便找到最適合您的需求的庫。