簡體   English   中英

關於 CSS - 使用 CSS position 屬性,但它不起作用

[英]Regarding CSS - Using CSS position property but it is not working

我只是想知道我做錯了什么? 我使用完全相同的代碼來定位其他圖像。 但由於某種原因,它現在不起作用。 基本上,我覺得我的 CSS 不工作。 我也嘗試設計鏈接,但 CSS 部分不起作用。

希望這是有道理的。 謝謝並期待收到你們的來信。

HTML 零件:

<div id = 'last-part-of-the-side-news'>
  <img id = 'apple' src = 'images/wework.jpg'>
</div>

CSS 零件:

#last-part-of-the-side-news{
  float:left;
}

#apple{
  width: 230px;
  height: 140px;
  position:relative;
  bottom: 448px;
  left: 200px;
}

圖片位於 div 上方 448px 和右側 200px 處。 下面是一個片段來說明這個例子:

 #last-part-of-the-side-news{ float:left; width: 200px; height: 200px; background: blue; position: absolute; top: 448px; } #apple{ background: rgba(255,0,0,0.3); width: 230px; height: 140px; position:relative; bottom: 448px; left: 200px; }
 <div id = 'last-part-of-the-side-news'> <div id = 'apple'></div> </div>

如果您的 div 位於文檔頂部,則您的圖像將位於 window 之外。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM