【问题标题】:Applying z-index to an image将 z-index 应用于图像
【发布时间】:2020-06-07 04:00:28
【问题描述】:

所以我试图在 WordPress 中通过我的主页显示图像。我可以通过 css,通过小部件显示它,但不能通过将其作为代码添加到我的主页。

我已经尝试应用 z-index,因为我有一个在该部分显示文本图像的元素,但什么都不会显示。

图片html

<div class="fbfp"><img src="http://4309.co.uk/wp-content/uploads/2020/06/IMG_20200601_134623-300x279.jpg" alt="" width="300" height="279" class="size-medium wp-image-16023" /></div>

和html控制主页。

<section class="content- 
area  pt0 "><div id="main" 
class="" role="main">
<div 
id="shapely_home_parallax- 
 2" class="widget 
shapely_home_parallax">      
<section class="cover 
fullscreen image-bg">
<div class="parallax-window 
fullscreen" data- 
parallax="scroll" data- 
image- 
src="http://4309.co.uk/wp-  
content/uploads/2019/0
8/download-2.png" data-ios- 
fix="true" data-over- 
scroll-fix="true" data- 
android-fix="true">
<div class="align- 
transform">
<div class="row">
<div class="top-parallax- 
section">

页面here

在 WordPress 中应该是直截了当的,因为您只需将代码添加到页面上的文本编辑器中。

CSS

.fbfp {position:relative; bottom:300px;z-index: 100;} 

parallax-window 是我认为的操作部分。

【问题讨论】:

  • 在您的网页代码 HTML 中看不到此图像
  • 在此处和现场更新代码并重新发布。现在?
  • 请澄清您的问题。您的代码中有 IMG_20200601_134623-300x279.jpg。
  • 应该有。我刚刚发布了它,但它不会显示。为什么不呢?
  • 刷新页面,页面,尝试不同的浏览器 - 仍然没有

标签: html css wordpress


【解决方案1】:

如您所知,z-index 仅适用于具有 position:absolutefixedrelativesticky 的元素。

添加到您的 CSS

.fbfp /*or '.fbfp img' */ {
  position: relative; 
  z-index: 9999; /* or any your value*/ 
}

记住。如果您的图像的任何父元素也有z-index - 它会更强大并且 以z-index 决定其他元素。

【讨论】:

  • 谢谢。是的。应用了 z-index 9999 但没有用。我想知道是否有其他东西会掩盖它,因为在其他页面上它很好。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-06
  • 1970-01-01
  • 1970-01-01
  • 2014-02-08
  • 1970-01-01
相关资源
最近更新 更多