2016-06-14 64 views
0

我想在內嵌塊元素下方顯示一個按鈕?如何顯示在內嵌塊元素下面放置一個按鈕?

image我想把按鈕放在標題下方?

這是我的代碼:

function(data) { 
       var output; 
       $.each(data.items, function(i,item) { 
        console.log(item); 
        videTitle = item.snippet.title; 
        videoId = item.snippet.resourceId.videoId; 
        output = '<li style="margin-bottom: 5%;"><img style="display:inline; margin-right: 2%;" src="http://img.youtube.com/vi/'+videoId+'/hqdefault.jpg" width="150" class="img img-responsive" /><span style="font-size:16px;">'+videTitle+'</span><div class="buttons" style="position:absolute; margin: 1%;"><a class="bn btn-success" style="padding:3px;" href="https://www.youtube.com/watch?v='+videoId+'\">'+"Watch on Youtube"+'</a><a class="bn btn-primary" style="padding:4px; margin-left: 10px;" href="https://www.youtube.com/watch?v='+videoId+'\">'+"Convert to MP3"+'</a></div></li>'; 
        $('#results').append(output); 
       }) 
      } 

我不知道爲什麼,但我不能這樣做右上方BUTTOM左側定位上的按鈕?

+0

嗨,u能請創建問題的搗鼓更好的理解。 – Help

回答

0

首先讓我開始說,最好是在樣式表中不要內聯樣式表。無論如何使用「右上角的左下角」,您應該有position: relative,絕對的或固定的。
在你的情況我會建議使用position: relativeli,然後你可以使用position: absolute相對於容器

+0

謝謝,我很困惑它的容器 –

相關問題