【问题标题】:How to put image over div and this image out of the div responsive?如何将图像放在 div 上,并将此图像从 div 响应中取出?
【发布时间】:2021-08-03 07:58:25
【问题描述】:

如下图所示,我想在滑块的 div 上放置一个图像,并且该图像会响应地调整大小并且不会改变底部的位置。

图片是<div class="img-top">

   <section id="hero-section">  
        <div class="hero-wrapper">                      
            <div class="grid-x grid-padding-x">
                <div class="cell small-12 medium-12 large-6 full-height">

                    <div class="img-top">
                        <img src="https://localhost/app/uploads/2021/05/goku_img.png">
                    </div> 
                            
                    <div class="hero-inner">
                        <?php echo do_shortcode(get_field("section_1_left"));?>
                    </div>                              
                 </div><!-- .cell -->

                <div class="cell small-12 medium-12 large-6 full-height section1right">
                    <div class="hero-inner-right">
                        <?php echo do_shortcode(get_field("section_1_right"));?>
                    </div>                          
                </div><!-- .cell -->

            </div>
        </div>
    </section><!-- #hero-section -->

我没有css,没有想法。谢谢你的帮助

【问题讨论】:

  • 到目前为止你尝试了什么?
  • @caiovisk #hero-section{position:absolute;} amd .img-top{ position:relative}
  • 您正在路上,请参阅 CSS 定位文档:w3schools.com/css/css_positioning.asp。所以,#hero-section 应该是相对的,.img-top 是绝对的。那么您可以随意定位...为了更好地帮助您,请为我们提供一个最小的工作示例,请参阅:stackoverflow.com/help/minimal-reproducible-example ...我们不会为您编码

标签: html css wordpress wordpress-theming responsive-images


【解决方案1】:

通过添加解决的问题:

#hero-section {
   position: relative;
}
#hero-section .img-top img {
   position: absolute;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-03
    • 2022-10-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多