How would I create an SVG Triangle with a Circle around it?

Instead of using an image, if I wanted to make my own.

Code:


html, body {
  height: 100%;
  background: #000;
  color: #fff;
  padding: 0;
  margin: 0;
}

.outer {
  display: table;
  height: 100%;
  margin: 0 auto;
  width: 100%;
}

.tcell {
  display: table-cell;
  vertical-align: middle;
}

.wrap {
  max-width: 400px;
  position: relative;
  margin: auto;
  border: 0px solid #5CB378;
}

.inner {
  position: relative;
  height: 0;
  padding-bottom: 100%;
  cursor: pointer;
  background-color: black;
}

#thevideo, .image {
  position: absolute;
  left: 0px;
  top: 0px;
  right: 0px;
  bottom: 0px;
  height: 100%;
  width: 100%;
  background-color: #000000;
  cursor: pointer;
  overflow: hidden;
}

#thevideo iframe {
  width: 100%;
  height: 100%;
  border: 0px;
}

.image {
  background: url('http://via.placeholder.com/400x400');
  background-size: cover;
  border-radius: 50px;
}

.image:after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-image: url(https://i.imgur.com/WSlJUPf.png);
  background-repeat: no-repeat;
  background-size: 24.5% Auto;
  background-position: 50% 50%;
}


<div class='outer'>
  <div class='tcell'>
    <div class='wrap'>
      <div class='inner'>
        <div class='image' onclick="thevid=document.getElementById('thevideo');
thevid.style.display='block'; this.style.display='none';
document.getElementById('iframe').src =
document.getElementById('iframe').src.replace('autoplay=0','autoplay=1');"> </div>

        <div id='thevideo' style='display: none;'>

          <iframe frameborder='0'id='iframe' src='https://www.youtube.com/embed/_0ZCVrg6Kzs?rel=0&keyboard=1&disablekb=1&vq=medium&showinfo=0&controls=1&autoplay=0&iv_load_policy=3&fs=0&wmode=transparent'></iframe></div>
      </div>
    </div>
  </div>
</div>

I think Iā€™m on the right track, how do I center it?

html,
body {
  height: 100%;
  background: #000;
  color: #fff;
  padding: 0;
  margin: 0;
}

.outer {
  display: table;
  height: 100%;
  margin: 0 auto;
  width: 100%;
}

.tcell {
  display: table-cell;
  vertical-align: middle;
}

.wrap {
  max-width: 400px;
  position: relative;
  margin: auto;
  border: 0px solid #5CB378;
}

.inner {
  position: relative;
  height: 0;
  padding-bottom: 100%;
  cursor: pointer;
  background-color: black;
}

#thevideo,
.image {
  position: absolute;
  left: 0px;
  top: 0px;
  right: 0px;
  bottom: 0px;
  height: 100%;
  width: 100%;
  background-color: #000000;
  cursor: pointer;
  overflow: hidden;
}

#thevideo iframe {
  width: 100%;
  height: 100%;
  border: 0px;
}

.image {
  background: url('http://via.placeholder.com/400x400');
  background-size: cover;
  border-radius: 50px;
}

.image::before {
  position: absolute;
  width: 140px;
  height: 140px;
  background: blue;
  -moz-border-radius: 70px;
  -webkit-border-radius: 70px;
  border-radius: 70px;
  content: '';
}

.image::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-top: 50px solid transparent;
  border-left: 100px solid red;
  border-bottom: 50px solid transparent;
}

Add top: and right: as shown:

.image::before {
  position: absolute;
  width: 140px;
  height: 140px;
  right: 130px;
  top: 130px;
  background: blue;
  -moz-border-radius: 70px;
  -webkit-border-radius: 70px;
  border-radius: 70px;
  content: '';
}

.image::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  right: 140px;
  top: 150px;
  border-top: 50px solid transparent;
  border-left: 100px solid red;
  border-bottom: 50px solid transparent;
}
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.