Page Widget How to - Create Pure CSS Heart








Question

We would like to know how to create Pure CSS Heart.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
/*  <!--from   ww w . j ava 2 s  . c  o m-->
This Pure CSS Heart created by Alexander Harris 
Feel free to use / improve and spread the love.
*/
div {
  background-color: red;
}

#aorta {
  width: 295px;
  height: 295px;
  transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
  position: absolute;
  left: 122px;
  top: 124px;
}

#left-ventricle {
  border-radius: 100%;
  width: 300px;
  height: 300px;
  position: absolute;
  top: 0;
  left: 0;
}

#right-ventricle {
  border-radius: 100%;
  width: 300px;
  height: 300px;
  position: absolute;
  left: 239px;
  top: 0;
}
</style>
</head>
<body>
  <div id="aorta"></div>
  <div id="left-ventricle"></div>
  <div id="right-ventricle"></div>
</body>
</html>

The code above is rendered as follows: