繁体   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