Container above collage image in html (css)

I created a collage of images and a small sign in the container. Now I want the container to be placed on top of the collage of images.

html

<section id="signin">
  <div class="photos">
        <img src="http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
        <img src="http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
        <img src = "http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
        <img src = "http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
        <img src="http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
        <img src="http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
  </div>
  <div class="sign container-fluid">
    <div class ="container">
      <div class="row section_blurb">
        <h1> Sign In </h1>
         <div class="col-xs-12 col-sm-4">
            <a href = "http://www.facebook.com">
            <img  src="images/ic_facebook blue.svg" class = "img-responsive" align = "left"><p>Sign in with facebook</p></a>
            <a href = "https://plus.google.com">
            <img  src="images/ic_google plus red.svg" class = "img-responsive" align = "left"><p>Sign in with google+</p></a>
            <a href = "https://instagram.com/">
            <img  src="images/ic_instagram blue.svg" class = "img-responsive" align = "left"><p>Sign in with instagram</p></a>
            <a href = "#email">
           <img   src="images/ic_email white.svg" class = "img-responsive" align = "left"><p>Sign in with Email</p></a>
        </div>   
      </div>     
    </div>
  </div>  
</section>

CSS

.photos {
   /* Prevent vertical gaps */
   line-height: 0;

   -webkit-column-count: 4;
   -webkit-column-gap:   0px;
   -moz-column-count:    4;
   -moz-column-gap:      20px;
   -moz-row-gap:         20px; 
   column-count:         4;
   column-gap:           0px;
   z-index: auto;


}

.photos img {
  /* Just in case there are inline attributes */
  width: 100% !important;
  height: auto !important;
  padding-bottom: 20px;
}

The css container is standard. There is also a different section above and below the signature section.

+4
source share
2 answers

You should put the position: relative on the parent:

#signin { position:relative; }

Then you can use the absolute position and the elements will be placed relative to the parent:

.photos { position:absolute; top:0; left:0; z-index:0; }
.sign { position:absolute; top:40px; right:40px; z-index:2; }

Here is an article explaining: https://css-tricks.com/absolute-positioning-inside-relative-positioning/

Z-index may be more complex, but try the simplest first. :)

+2
source

css ".container-fluid":

.photos {
   /* Prevent vertical gaps */
   line-height: 0;

   -webkit-column-count: 4;
   -webkit-column-gap:   0px;
   -moz-column-count:    4;
   -moz-column-gap:      20px;
   -moz-row-gap:         20px; 
   column-count:         4;
   column-gap:           0px;
   z-index: auto;

  background:#adf;

}

.photos img {
  /* Just in case there are inline attributes */
  width: 100% !important;
  height: auto !important;
  padding-bottom: 20px;
}
.container-fluid{
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background:rgba(0,0,0,0.5);
}
<section id="signin">
  <div class="photos">
        <img src="http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
        <img src="http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
        <img src = "http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
        <img src = "http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
        <img src="http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
        <img src="http://www.hdwallpapersimages.com/winter-tiger-wild-cat-images/31073/">
  </div>
  <div class="sign container-fluid">
    <div class ="container">
      <div class="row section_blurb">
        <h1> Sign In </h1>
         <div class="col-xs-12 col-sm-4">
            <a href = "http://www.facebook.com">
            <img  src="images/ic_facebook blue.svg" class = "img-responsive" align = "left"><p>Sign in with facebook</p></a>
            <a href = "https://plus.google.com">
            <img  src="images/ic_google plus red.svg" class = "img-responsive" align = "left"><p>Sign in with google+</p></a>
            <a href = "https://instagram.com/">
            <img  src="images/ic_instagram blue.svg" class = "img-responsive" align = "left"><p>Sign in with instagram</p></a>
            <a href = "#email">
           <img   src="images/ic_email white.svg" class = "img-responsive" align = "left"><p>Sign in with Email</p></a>
        </div>   
      </div>     
    </div>
  </div>  
</section>
Hide result

"signin-container" ".photos div", #signin, . "signin-container" div , .

0

Source: https://habr.com/ru/post/1613966/


All Articles