Round ball

Here is my current css for the circular image circle

.circle-image{
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-size: contain;
    background-position: center;
    background-image: url("/assets/img/dashboard/img-stdn.png");
    display: block;
}

And the output of the div as shown below:

enter image description here

How can I omit the div and become so?

enter image description here

Say the image inside a div:

enter image description here

+4
source share
2 answers

You can use the pseudo-element to create a triangle of the speech bubble, as shown in the demo below.

This works with the help skewon the square and positions it absolutewithin the relatively-position element of the container.

Alternatively, this can be achieved with a single element if you could use background-imagean image tag instead.

.circ {
  height: 100px;
  width: 100px;
  border-radius: 50%;
  bordeR: 5px solid tomato;
  position: relative;
}
.circ img {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  border-radius: 50%;
}
.circ:before{
  content:"";
  position:absolute;
  top:10%;
  right:0;
  height:20px;
  width:20px;
  background:tomato;
  transform:skewX(55deg) skewY(10deg);
  }
<div class="circ">
  <img src="http://i.stack.imgur.com/lCp2t.png" />
</div>
Run codeHide result

, , .


, .

.circ {
  position: relative;
  height: 100px;
  width: 100px;
  border-radius: 50%;  
  border: 5px solid tomato;
  background:url(http://i.stack.imgur.com/lCp2t.png);
  background-size:100% 100%;
}
.circ:before{
  content:"";
  position:absolute;
  top:10%;
  right:0;
  height:20px;
  width:20px;
  background:tomato;
  transform:skewX(55deg) skewY(10deg);
  z-index:-1;
  }
<div class="circ"></div>
Hide result
+6

, , .

http://jsfiddle.net/c3Love5c/1/

.circle-image{
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-image: url("http://i.stack.imgur.com/lCp2t.png");
    display: block;
    border:3px solid purple;
    position:relative;
}

.circle-image:before{
    content:'';
    display:block;
    border:10px solid transparent;
    border-top-color:purple;
    position:absolute;
    right:-5px;
    top:5px;
    transform:rotate(15deg);
    -moz-transform:rotate(15deg);
    -webkit-transform:rotate(15deg);
    -ms-transform:rotate(15deg);
    -o-transform:rotate(15deg);
}
+2

All Articles