DEV Community

Cover image for google logo with just html & css
rs9110
rs9110

Posted on

CSS Logo google logo with just html & css

So, here's how to create the Google logo with just HTML and CSS.

First, place a div in your html with an id of google.

<div id="google"></div>
Enter fullscreen mode Exit fullscreen mode

Then, hop into css and input the following code.

#google {
  position: relative;
  border-top: 100px solid #EA4335;
  border-right: 100px solid #4285F4;
  border-bottom: 100px solid #34A853;
  border-left: 100px solid #FBBC05;
  border-radius: 50%;
  background-color: #FFFFFF;
  width: 300px;
  height: 300px;
  padding: 0;
  margin: 10vh auto 0;
}
Enter fullscreen mode Exit fullscreen mode

That should leave you with a circle that has 4 of the Google's color. To turn that into a 'G', input the code below.

#google::before {
  content: "";
  z-index: 100;
  position: absolute;
  top: 50%;
  right: -95px;
  transform: translateY(-50%);
  width: 245px;
  height: 100px;
  background: #4285F4;
}

#google::after {
  content: "";
  z-index: 101;
  position: absolute;
  border-top: 200px solid transparent;
  border-right: 200px solid #FFFFFF;
  top: -100px;
  right: -100px;
  width: 0;
  height: 0;
}
Enter fullscreen mode Exit fullscreen mode

Voila, you just created the Google logo using only HTML and CSS. ✌️

Top comments (15)

Collapse
 
link2twenty profile image
Andrew Bone

A little tip for future posts, you can embed a demo of your code by writing it somewhere like JSFiddle and then embedding it like so

{% jsfiddle https://jsfiddle.net/link2twenty/bxL16fum/ result css html %}

Collapse
 
srezas profile image
SeyedReza SeyedMohseni

may you please also implement its animation?

Collapse
 
rkdme profile image
Rafal Kolodziej

interesting approach.

btw. there is missing colon in margin 10vh auto 0; for #google rule

Collapse
 
rs9110 profile image
rs9110

ah yes, thanks for pointing that out.

Collapse
 
olalani profile image
Olalani Oluwaseun

Have tried it out ☺️ viewing G but not animating like your post gif

Collapse
 
srezas profile image
SeyedReza SeyedMohseni

click bate :))

Collapse
 
olalani profile image
Olalani Oluwaseun

How ???

Collapse
 
ashraful profile image
Mohamad Ashraful Islam

That's creative

Collapse
 
ashishmohanty profile image
Ashish Mohanty

Thanks alot

Collapse
 
srezas profile image
SeyedReza SeyedMohseni

nice. this page on Instagram should mention your article
dev.to/rs9110/google-logo-with-jus...

Collapse
 
kpeale profile image
Kpeale Legbara

I am going to try this out🔥🔥

Collapse
 
robertkameni profile image
Robert Kameni

Magnifique 🔥🔥🔥

Collapse
 
mathiasfx profile image
Mathias Pereira

amazing