I have just started working with CSS.
I have a rectangle image. I want to put it on a background and view it as a circle with light transparency as the example.
I have just started working with CSS.
I have a rectangle image. I want to put it on a background and view it as a circle with light transparency as the example.
here's a rough demo of how to do it:
http://jsfiddle.net/jalbertbowdenii/vfac6L4x/
using your pix, just simply add the correct url for the img element and change the backgroudn color of the mask container div as well as the border color of the image.
if you want more info, search for css masks
because stackoverflow requires this:
.mask{background-color:#000}
img{display:block; margin-left:auto; margin-right:auto;
border-radius:25px; border:solid #000}
and the markup
<div class="mask">
<img src="https://photos-6.dropbox.com/t/1/AAASULb1odiWJlk3dyEG-rF4B0baCCQ2D9aoTqXZiYZW6w/12/107220852/jpeg/1024x768/3/1416250800/0/2/trans-cirecle.jpg/VFul9uUE7QKOIrYKVNy58z9JzoOHj9UK3AGRUsSFbgY" />
</div>
Is this what you looking for?
When you apply: border-radius: 50%;
to your img
it gets a circle as you you want.
.bg {
background-color: mediumaquamarine;
width: 500px;
height: 500px;
margin: auto
}
img {
border-radius: 50%;
/* Safari 3-4, iOS 1-3.2, Android 1.6- */
-webkit-border-radius: 50%;
/* Firefox 1-3.6 */
-moz-border-radius: 50%;
border: 1px solid red;
margin-left: 25%;
margin-top: 25%;
z-index: 1;
position: relative;
opacity: 0.8
}
<div class="bg">
<img src="http://placehold.it/250x250&text=Image" />
</div>