【问题标题】:An image is hidding my paragraph in prestashop一张图片在 prestashop 中隐藏了我的段落
【发布时间】:2019-03-28 13:27:56
【问题描述】:

我坚持这一点并尝试了很多东西,所以我不知道到底尝试了什么,但我想我几乎尝试了 css 中的所有可能性,但我对其他想法持开放态度。 问题是类别图像隐藏了描述文本,如您在此 picture.

img 在与段落不同的 div 中具有绝对位置,因此如果我将其设为相对位置,我无法将其放在另一侧(或者可能不知道如何)。

我不会发布代码,因为它的 prestashop 并且很长,但这是网站: www.tienda.hostman.es

如果您输入“cocinas”类别,您会看到我在说什么。

谢谢。 ps: html文件是prestashop自动生成的,无法编辑

我认为如果我在这里删减部分代码会更好: 这是html:

<div class="block-category card card-block hidden-sm-down">
  <h1 class="h1">Cocinas</h1>
          <div id="category-description" class="text-muted"><p>En esta sección se encuentran todos nuestros productos para la limpieza y cuidado de cocinas</p></div>
                <div class="category-cover">
      <img src="http://tienda.hostman.es/img/c/14-category_default.jpg" alt="Productos cocinas">
    </div>
      </div>

这是css

p{
    display: block;
    margin-block-start: 
    margin-block-end: 
    margin-inline-start: 
    margin-inline-end: 0px;
}

.block-category .category-cover {
    position: absolute;
    right: .75rem;
    bottom: 0;
}

【问题讨论】:

    标签: html css image prestashop paragraph


    【解决方案1】:

    html:

    <div class="block-category card card-block hidden-sm-down">
          <h1 class="h1">Cocinas</h1>
                  <div id="category-description" class="text-muted"><p>En esta sección se encuentran todos nuestros productos para la limpieza y cuidado de cocinas</p></div>
                        <div class="category-cover">
              <img src ="http://tienda.hostman.es/img/c/14-category_default.jpg" alt="Productos cocinas">
            </div>
    </div>
    

    改为使用布局 css:

    .card {
    display:flex;
      flex-wrap:wrap;
     justify-content:space-between;
    }
    
    .h1 {
      flex:1 0 100%;
    }
    
    #category-description {
      flex:1;
    }
    
        .block-category .category-cover {
        /* delete this don't need it
        position: absolute; 
        right: .75rem;
        bottom: 0; */
          margin-right: .75em;
    }
    

    【讨论】:

    • 抱歉,刚看到html。我无法更改prestashop自动生成的html文件,要让它再次正常运行需要做很多工作。
    • 嗯,html和@DanielEspinosa网站上的一样
    • 你是对的,必须改进你的解决方案,现在它正在工作。我将根据您的解决方案发布我使用的代码,谢谢!
    • 很高兴帮助@DanielEspinosa
    【解决方案2】:

    您只需删除“位置:绝对;”或通过添加新的 css 文件来覆盖它。

    【讨论】:

      【解决方案3】:

      根据 Carol McKay 发布的解决方案,对我有用的 css 代码是这样的:

      .card{
          -ms-box-orient: horizontal;
          display: -webkit-box;
          display: -moz-box;
          display: -ms-flexbox;
          display: -moz-flex;
          display: -webkit-flex;
          display: flex; 
          -webkit-justify-content: space-around;
          justify-content: space-around;
          -webkit-flex-flow: row wrap;
          flex-flow: row wrap;
          -webkit-align-items: stretch;
          align-items: stretch;
      }
      .h1{
          flex: 1 100%;   
      }
      .text-muted{
          display:inline;
          flex:1;
      }
      .block-category .category-cover{
          display:inline;
          position:relative;
          float:right;
          margin-top:-6%;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-12-26
        • 2015-06-19
        • 2010-11-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多