0

I tried create a view something like following image in css but no useful result using before .

check image

my CSS codes :

 .geo-login-left{
    background-color: #7199bd;
    background-image: url(../img/home-bg.png);
    background-repeat: no-repeat;
    background-size: cover;
    display: block;
    background-position: center;
    text-align: center;
   }

 .geo-login-left:before{
   background-image: url(../images/logo-white.jpg);
   margin-top: 5px;
   content : "";
   opacity: 0.3;
   }

 .geo-login-left:after{
  background-image: url(../images/logo-white.jpg);
  content : "";
  }
3
  • 1
    can you please share a fiddle for this Commented Dec 14, 2016 at 10:49
  • here is solution of similar issue stackoverflow.com/questions/41048201/…. you can just reorder images and paly with z-indexes Commented Dec 14, 2016 at 10:50
  • jsfiddle.net/95h82gha Commented Dec 14, 2016 at 11:15

1 Answer 1

1

One without images would be like:

body {
  background-color: #0074D9;
}

.box {
  background-color: white;
  border-radius: 10px;
  margin: 3em auto;
  padding: 2em;
  position: relative;
  width: 24em;
}
.box:before, .box:after {
  background: inherit;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  content: "";
  display: block;
  left: 50%;
  opacity: 0.5;
  position: absolute;
  transform: translateX(-50%);
  width: 100%;
}
.box:before {
  height: 1em;
  top: -1em;
  width: calc(100% - 2em);
}
.box:after {
  height: 2em;
  top: -2em;
  width: calc(100% - 4em);
}
<div class="box">
  Block
</div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.