0

enter image description hereI want to use a letter which hides the overflows of colors. Want something like google icon but completely built with CSS. Is there a solution to hide the overflow of that red rectangle? Want to rebuilt the Google logo.

#letter {
 background: white;
 font-family: "Product Sans", Arial, sans-serif;
 color: green;
 font-size: 200px;
 font-weight: 900;
 opacity: 0.1;
 position: relative;
 margin-top: 0px;
 margin-left: 0px;
 overflow: hidden;

}

#circle1 {
 width: 30px;
 height: 100px;
 background: red;
 position: absolute;
 top: 30px;
 left: 80px;
}
      <p id="letter">G
      <div id="circle1"></div>http://stackoverflow.com/questions/ask#
Front-end Developer
  • 400
  • 1
  • 6
  • 17
  • Use css gradients. – Ivanka Todorova Oct 06 '16 at 13:00
  • 1
    This is pretty tough, you could try out `-webkit-background-clip: text;` for effects along these lines, though obviously that's not really viable in production yet as it's webkit only. – DBS Oct 06 '16 at 13:01
  • Ivanka Todorova I want blocks of different colors – Front-end Developer Oct 06 '16 at 13:02
  • Please can you clarify what the end goal is - you want to stop the red block coming outside the letter paragraph? Or you want a circle behind the letter? – Pete Oct 06 '16 at 13:14
  • 2
    Why not use an inline SVG like this ready made perfect Google logo https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svgone – web-tiki Oct 06 '16 at 13:18

3 Answers3

1

Using CSS gradients might get you the desired effect, however it's not widely supported because of the -webkit-background-clip: text;

h1 {
  font-size: 72px;
  background: -webkit-linear-gradient(top, #cc0223 28%, #016b14 29%, #016b14 44%, #016b14 63%, #3b01c1 64%, #3b01c1 85%, #febf01 85%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
<h1>E</h1>
Ivanka Todorova
  • 9,964
  • 16
  • 66
  • 103
1

In the base, play with border colors to get some similar to google logo. (See the second base to see it more easily)

Over this, set a G with a blend mode that will hide the overflow.

This will not work in Ie/Edge since the blend mode isn't supported.

.base {
    height: 0px;
  width: 0px;
  border-width: 100px 200px;
  border-style: solid;
  border-top-color: red;
  border-left-color: yellow;
  border-right-color: blue;
  border-bottom-color: green;
  position: relative;
}

.letter {
  font-size: 150px;
  line-height: 190px;
  position: absolute;
  left: -199px;
  top: -99px;
  width: 398px;
  height: 198px;
  background-color: white;  
  text-align: center;
  mix-blend-mode: lighten;
}
<div class="base">
  <div class="letter">G</div>
</div>
<div class="base"></div>
vals
  • 61,425
  • 11
  • 89
  • 138
0

h1 {
  font-size: 100px;
  background: -webkit-linear-gradient(top, red 28%, green 29%, green 44%, green 63%, orange 64%, orange 85%, orange 85%, blue 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
<h1>G</h1>
Ganesh Putta
  • 2,622
  • 2
  • 19
  • 26