DIV leaving the screen

3

I've seen several times a div that comes off the screen, and as I will not know how to explain it right, I'll show you a photo of an example:

Ifigureditwouldbebox-shadow,butIcouldnotdoit.Idonotwanttodothesamedesignastheboy,soIwillnotstealhiswork,butIwantedtoknowwhattodotostaylikethat,leavingthescreen.

Link: link

    
asked by anonymous 30.01.2018 / 13:39

1 answer

2

This effect uses box-shadow yes, but tb uses transform:scale(1.2);

See in this Snipper an example:

* {
  box-sizing: border-box;
}
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  background-color: #3b414d;
  overflow: hidden;
}
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.container div {
  display: inline-block;
  width: 100px;
  height: 100px;
  background-color: blueviolet;
  margin: 0;
  padding: 0;
}
.container div:nth-child(2) {
background-color: pink;
transform: scale(1.2);
box-shadow: 0 0 20px rgba(0,0,0,.5)
}
<div class="container">
  <div></div>
  <div></div>
  <div></div>
</div>

If you want the effect only when you do :hover just replace .container div:nth-child(2){} with .container div:hover{}

* {
  box-sizing: border-box;
}
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  background-color: #3b414d;
  overflow: hidden;
}
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.container div {
  display: inline-block;
  width: 100px;
  height: 100px;
  background-color: blueviolet;
  margin: 0;
  padding: 0;
  transition: all .25s ease-in-out;
  position: relative;
  z-index: 0;
}
.container div:hover {
  background-color: pink;
  transform: scale(1.2);
  box-shadow: 0 0 20px rgba(0,0,0,.5);
  position: relative;
  z-index: 2;
  cursor: pointer;
}
<div class="container">
  <div></div>
  <div></div>
  <div></div>
</div>
    
30.01.2018 / 13:53