For those who can't wait Fiddle
I have this problem in CSS. The structure of the html
and css
code looks like this
HTML:
<div class="one">
<div class="two">
<div class="three">
</div>
</div>
</div>
CSS:
.one{
width: 500px;
height: 500px;
background: url('http://www.moonlightcompanies.com/wp-content/uploads/2013/01/6973_MOONF-PomegranatesOnTree-8536-1.jpg');
background-size: cover;
background-repeat: no-repeat;
padding: 20px;
}
.two{
width: 300px;
height: 300px;
background: blue;
padding: 20px;
}
.three{
width: 200px;
height: 200px;
background: transparent;
padding: 20px;
border: 5px solid yellow;
}
My problem is how do I make the background of <div class="three"></div>
that it would be transparent and would blend to the background of the <div class="one"></div>
. I want my desired output to be like the attached image. Is this possible ?
You can try like this: Demo
.three{
width: 200px;
height: 200px;
background: transparent;
padding: 20px;
border: 5px solid yellow;
outline:solid 100px rgba(0,0,255,.5);
}
update the border value as per your requirement.
Updated Demo
.three {
background: transparent;
border: solid blue;
margin: 10px 0px;
border-width:20px 40px 40px 20px;
}
.inner {
outline: 5px solid yellow;
width: 200px;
height: 60px;
margin:0;
padding: 20px;
}
I have added :before
and :after
also for blue background in right and bottom, so that more content can be added in the second div
.
Here is the fiddle - http://jsfiddle.net/afelixj/ouy9thkk/15/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With