Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Margin-top affects to another element besides

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #168940
    tirengarfio
    Participant

    Hi,

    when I give a top margin to “.galeria” element, why I get also the top margin in “.sorial-grande” element?

    http://sorialconstrucciones.com/trabajos

    .sorial-grande {
        position: absolute;
        right: 0;
        left: 0;
        background: url("/drawing.svg");
        background-repeat: repeat-x;
        height: 337px;
        background-position: center center;
      }
      .galeria {
        padding: 40px;
        clear: both;
        /*margin-top: 350px;*/
        img {
          width: 207px;
          margin-right: 10px;
          margin-bottom: 10px;
        }
      }
    
    <div>
    </div>
    &lt;section class="galeria"&gt;
      <img src="/images/28.jpg" />&lt;/img&gt;
      <img src="/images/30.jpg" />&lt;/img&gt;
    &lt;/section&gt;
    
    #168943
    Alen
    Participant

    It’s because the .sorial-grande has position: absolute; taking it out of document flow.

    #168946
    tirengarfio
    Participant

    But i hace the same property for the rest of the pages, and not the same problem

    #168951
    Alen
    Participant

    Adding position:relative; to .galeria should fix it.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.