【问题标题】:Logo Image float on a Image Slider Wordpress Theme CSS徽标图像浮动在图像滑块 Wordpress 主题 CSS 上
【发布时间】:2015-09-28 20:42:04
【问题描述】:

免责声明:我没有编写主题代码。这是由另一位离开项目的开发人员制作的,我正在根据新要求进行调整。我没有 Wordpress 主题的经验,但我可以理解代码。

我正在网站上进行设计,我想让我的徽标像浮动在 Slider 层之上。我正在开发一个 wordpress 主题:

如您所见,“Red Dela Cruz”徽标位于顶部,占据了一个单独的空间或 div。我希望它在滑块内并像图层一样漂浮在上面,每当幻灯片更改图像时,徽标应该仍然存在。这是我的代码:

       <div class="slider">
            <img src="<?php echo $template_path; ?>images/redlogo_website.png" alt="" class="web-logo"/>
            <div id="one-by-one-slider" class="one-by-one-slider">
                <ul class="one-by-one-slider-large">

                    <?php
                          $args = array(
                              'post_type' => 'rdc_home', 
                              );
                           query_posts( $args );
                           // The Loop
                          if ( have_posts() ) : 
                          while (have_posts()) :
                          //the post for declaration
                          the_post();
                    ?>

                    <li>
                        <img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'thumbnail') ); ?>" alt="<?php the_title(); ?>"/>
                        <div class="slider-content text-center">

                            <div class="slider-heading shp-12 slides" data-animation="bounceInDown" data-duration=4 data-delay=1>
                                <div class="container">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <h1><?php the_title(); ?></h1>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="slider-heading shp-13 slides" data-animation="bounceInDown" data-duration=6 data-delay=2>
                                <div class=" container">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <h3><?php the_content(); ?></h3>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- <div class="slider-heading shp-14 slides" data-animation="bounceInUp" data-duration=8 data-delay=4>
                                <div class=" container">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <a href="#contact" class="btn lm-gallery btn-remore">For Bookings</a>
                                        </div>
                                    </div>
                                </div>
                            </div> -->
                        </div>
                    </li>
                    <?php 
                    endwhile;
                    endif;
                    wp_reset_query();
                    ?>

                </ul>
                <div class="one-by-one-slider-nav">
                    <ul class="one-by-one-slider-thumbs">
                        <li class="one-by-one-slider-element"></li>
                        <?php
                              $args = array(
                                  'post_type' => 'rdc_home', 
                                  );
                               query_posts( $args );
                               // The Loop
                              if ( have_posts() ) : 
                              while (have_posts()) :
                              //the post for declaration
                              the_post();
                        ?>
                            <li><a href="#"></a></li>
                        <?php 
                               endwhile;
                               endif;
                               wp_reset_query();
                        ?>

                    </ul>
                </div><!-- one-by-one-slider-nav -->  

            </div><!-- one-by-one-slider -->
        </div><!-- slider -->

标志在第二行,我还没有在课堂上做过任何css

web-logo

【问题讨论】:

  • 你能在fiddle中运行代码吗
  • @ivinraj 怎么样?这是一个 wordpress 主题。
  • 你好,我会做的先生
  • @ivinraj 哇。谢谢!这是另一个开发人员留下的项目,所以我不知道要编辑什么。我第一次使用 wordpress 主题。
  • 等一下,先生我试试看

标签: html css wordpress wordpress-theming


【解决方案1】:

这应该可行:

.web-logo {
    position:absolute;
}

如果徽标位于滑块“后面”,则应添加 z-index,并使其更高,直到图像显示:

.web-logo {
    position:absolute;
    z-index:2;
}

【讨论】:

  • 嗨。它在定位中起作用,但问题是它正在消失。当滑块图像发生变化时,这是我唯一一次看到徽标,但在加载滑块中的下一个图像后它会消失。
  • 尝试将 移到 .slider-div 之外
  • 现在工作 :) 正如你所建议的,我将 z 索引设为 100 :D
  • 很高兴能帮上忙!
【解决方案2】:

你可以试试这个:

.web-logo {
    position: absolute;
    right: 10px;
    top: 10px;
   z-index:2;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多