Google Homepage Clone Using HTML and CSS

Google Homepage Clone Using HTML and CSS

Welcome programmers, here in this blog you will learn how to create a fully responsive Google Clone Homepage clone using HTML and CSS. No Javascript is required.

A home page is the default or front page of a site. It is the first page that visitors see when they load a URL.

To brief you all what Google Homepage is, your startup page is the one that shows up when you first launch Chrome on your device. Your homepage is the one you go to when you click Home .

Now let’s start making google homepage clone in a step-by-step process.

We will be creating two separate files for this project. One is the HTML file which will add structure to our project and other is a CSS file which will add style to our structure given by the html elements.

Step 1: Start by creating a HTML file with yourFileName.html as your file name in your IDE.

<html>
<head>

    <title> Google homepage | 5th Aug </title>
    <!-- external links -->
    <link rel="stylesheet" href="style.css">
    <link rel="icon" href="https://www.shareicon.net/download/2015/09/26/107420_new.ico" sizes="16x16" type="image/png">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

</head>
<body>
    <div class="header">
        <!-- header contents -->
        <span class="menuItems"><a href="https://www.gmail.com" alt="gmail">Gmail</a></span>
        <span class="menuItems"><a href="https://www.google.co.ke/imghp?hl=en&tab=wi&authuser=0&ogbl" alt="image">Images</a></span>
        <span class="menuItems">
            <span class="menu">
                <i style = "vertical-align: middle;"id="dropdown-menu" class="material-icons" alt="apps">apps</i>
            </span>
            <div class="dropdown-content">
                <!-- google app logo -->
                <div class="appLogo">
                    <a href="#"> <img class="menuItemLogo" src="http://pluspng.com/img-png/google-logo-png-open-2000.png"> </a>
                    <div class="caption" alt="search"> Search </div>
                </div>
                <!-- google map -->
                <div class="appLogo">
                    <a href="#"> <img class="menuItemLogo" src="http://pluspng.com/img-png/google-maps-png-google-maps-icon-1600.png"> </a>
                    <div class="caption"> Maps </div>
                </div>
                <!-- google drive -->
                <div class="appLogo">
                    <a href="#"> <img class="menuItemLogo" src="https://upload.wikimedia.org/wikipedia/commons/d/da/Google_Drive_logo.png"> </a>
                    <div class="caption"> Drive </div>
                </div>
                <!-- google calender -->
                <div class="appLogo">
                    <a href="#"> <img class="menuItemLogo" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Google-calendar.svg/1024px-Google-calendar.svg.png"> </a>
                    <div class="caption"> Calender </div>
                </div>
                <!-- google photo -->
                <div class="appLogo">
                    <a href="#"> <img class="menuItemLogo" src="https://blogs.acu.edu/innovation_foundry/files/2017/06/google_photos1600.png"> </a>
                    <div class="caption"> Photo </div>
                </div>
                <!-- keep -->
                <div class="appLogo">
                    <a href="#"> <img class="menuItemLogo" src="https://i.pinimg.com/originals/09/96/92/099692d1d651d51b7caf3040fce0f748.png"> </a>
                    <div class="caption"> Keep </div>
                </div>
            </div>	
        </span>
        <span class="menuItems"><img class="userImage"src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxISEhUSEhIVFRUXFhcXGBUVFRUVFhUVGBUXFxUVFRcYHSggGBolHRUVITEhJSktLi4uFx8zODMtNygtLisBCgoKDQ0NFQ0NFSsZFR4rLSs3KysrKystKzcrKzcrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIAOEA4QMBIgACEQEDEQH/xAAcAAABBQEBAQAAAAAAAAAAAAABAAIDBAUGBwj/xABCEAABAwIEAwUFBgMFCQEAAAABAAIRAyEEEjFBBSJRBhNhcYEHMpGx8BQjQqHB0VLh8TNigpKyNDVTcnN0orPSFf/EABUBAQEAAAAAAAAAAAAAAAAAAAAB/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8A8fDjcdUWoJBBJTqluaI5mlpkA2OsTobaqpV1Vl4I1BHnZV6g5kE7ESUqYQcgBSy6X/l4IJ4agjKKfTpF1gJPT9l2XCPZrxCsR9zkkZvvZYA06SY/IXQcTlVj7MWwXDbNEwYzFpt5iCvVcL7JmUyDi8dSp3n7sD4AvsEOJYbheBBpvJxDHBrge8Y6YAgFjIgabmYQeTvBdzHc3Ou908UJDiCDlvFwS2QMw9XNt4rvOIV+G1ajSxgaDlgBxYBNhcTeReQNb9VrVfZ9QrURVoVm3lwFUwR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QrUngNcRDXzlncN5SY6TN/BZ9QXQRotTUQgc1B6IQcgLCpGvVeUWOkoLDRMmQIE338AmEqMmEiEE1FzZGeS3cCxjwUbXJkpA3QS1HWFv5qvCleUx6BNQRCCCSUiUAkEBSKRKBQJJJAu6IHJKNJBaapAgkg3fZ1/vTC/9V3/revVvat/slPzPyakkoPPe0v8AujA/9xif9RXEtSSVGpxLWl/0WfqsqpqUkkETtkQkkgIScikgickEEkD6iISSQBJJJAXIBJJA1EpJICEkUkCKRSSQAJiSSAJJJIP/2Q=="></span>
    </div>

    <!-- google image with search box and buttons -->
    <div class="container" style="text-align: center;">
        <img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">

        <!-- search box -->
        <div class="search">
            <input type="text" class="input"name="SearchBox">
            <img class="voiceSearch" src="https://www.gstatic.com/images/branding/googlemic/2x/googlemic_color_24dp.png">
        </div>
        <!-- buttons -->
        <div class="btn">
            <button class="btns">Google Search</button>
            <button class="btns">I'm Feeeling Lucky</button>
        </div>
    </div>
    
</body>
</html>

Step 2: Create a separate CSS file with the name style.css and link it in the <head> of the html file using the link tag. As there are two separate files for his project we need to connect them and this is how we do it. We have also used the icons from Font-awesome, so you need to use the CDN link for our Fontawesome.

50+ Html ,Css & Javascript Projects With Source Code

<link rel="stylesheet" href="style.css"> 
<link rel="icon" href="https://www.shareicon.net/download/2015/09/26/107420_new.ico" sizes="16x16" type="image/png"> 
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Now let’s begin adding structure for our google homepage.

  • Create a container for the header of our page using the div tag and add class=”header” to it.
  • In the header portion we will add our menu items using the span tag to add an inline container used to mark up a part of a text, or a part of a document. The span tag is used to add two button in the header- Gmail and Images. Add class=”menuItems” to both the span tags.

5+ HTML CSS Projects With Source Code

  • Inside the header, next to Images we will create an app section using span tag with class=”menuItems” which will show the the following icons when the mouse is hovered on it- Search, Maps, Drive, Calendar, Photo and Keep. You can use Fontawesome to add the icons.
  • All the icons of the app section are contained in separate div tags with class=”appLogo”. If some sources for the app logo do not work then you can download the app logos and store them in your project folder to directly add its source name into you project.
  • Create a span with class=”menuItems” and add the user image source to be displayed at the right side of the app section.

We have now added the basic structure of the header of our google homepage.

OUTPUT:

Without adding style to our header it looks like this-

Google Homepage Clone Using HTML and CSS
Google Homepage Clone Using HTML and CSS

 

After we add style to our header using CSS which will be explained below, the header will look like this-

Google Homepage Clone Using HTML and CSS
Google Homepage Clone Using HTML and CSS

 

Let us now complete the basic structure of our google homepage by making the center part which will include logo, search bar and buttons.

HTML code to add google image with search box and buttons is as follows:-

<div class="container" style="text-align: center;">
        <img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">

        <!-- search box -->
        <div class="search">
            <input type="text" class="input"name="SearchBox">
            <img class="voiceSearch" src="https://www.gstatic.com/images/branding/googlemic/2x/googlemic_color_24dp.png">
        </div>
        <!-- buttons -->
        <div class="btn">
            <button class="btns">Google Search</button>
            <button class="btns">I'm Feeeling Lucky</button>
        </div>
</div>

Understanding how to add google image, search box and buttons for the center part of our google homepage clone:

  • Create a container using div tag and assign class=”container” to it. Add inline CSS using style attribute for the div tag and set text-alignment property to center so that all the elements inside the div appear at the center of our webpage.
  • Add the google image using image tag and and the image source using src attribute. This will display the google image at the center of our google homepage.
  • Inside the main div tag nest a div for the search box and give class=”search”. Use input tag for type=”text”. Then add image of voice search option which will be displayed inside the search box.
  • Nesting another div inside the main div, now create the last two buttons for ‘Google Search’ and ‘I’m Feeling Lucky’ using the button tag. Assign classes to both the buttons, class=”btns”. Close the respective div tags.

We have now added the basic structure for google search box, buttons along with the google image.

OUTPUT:

Google Homepage Clone Using HTML and CSS
Google Homepage Clone Using HTML and CSS

 

Step 3: Till now we created a basic structure for our google homepage clone but now lets add some styling to it to make it eye-catching using CSS. We already created a separate CSS file style.css above and linked it to our html file. Let’s open it and start the styling process step-by-step using the classes which we defined inside our html elements.

10+ Javascript Projects For Beginners With Source Code

CSS code for our google homepage clone is as follows:

body
{
    font-family: Arial,sans-serif;
}

.header
{
    font-size: 13px;
    text-align: right;
    padding-top: 22px;
    padding-right: 10px;
}

.menuItems
{
    font-size: 13px;
    padding-right: 10px;
    padding-left: 20px;
    display: inline-block;
}

.header a
{
    text-decoration: none;
    color: #000000;
}

.header a:hover
{
    text-decoration: underline;
}

.menu
{
    background-color: white;
    border:none;
    outline:none;
    box-shadow: none;
    padding-right: none;
}

.dropdown-content 
{
    width: 270px;
    padding: 28px;
    margin-right: 82px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
    display: none;
    z-index: 1;
    position: absolute;
    right: 0; 
}

.menuItems:hover .dropdown-content
{
    display: block;
}

.appLogo
{
    text-align: center;
    display: inline-block;
    width: 86px;
    padding-top: 5px;
    padding-bottom: 5px;
}

.dropdown-content .appLogo:hover 
{
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.menuItemLogo
{
    width: 50px;
    height: 50px;
    text-align: center;
    padding-top: 5px;
    padding-bottom: 5px;
}

.userImage
{
    border-radius: 50%;
    margin: -1px;
    overflow: hidden;
    position: relative;
    height: 32px;
    width: 32px;
    vertical-align: middle;
}

.container
{
    padding-top: 140px;
    padding-bottom: 160px;
}

.search
{
    font-size: 13px;
    margin: auto;
    margin-top: 30px;
    padding: 14px;
    width: 600px;
    color: #222;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    outline: none;
}

.container .search:hover
{
    box-shadow: 0 1px 6px 0 rgba(32,33,36,0.28);
    border-color: rgba(223,225,229,0);
}

.container .search:focus-within
{
    box-shadow: 0 1px 6px 0 rgba(32,33,36,0.28);
    border-color: rgba(223,225,229,0);
}

.input
{
    text-align: left;
    width:95%;
    border: none;
    outline: none;
}

.voiceSearch
{
    float: right;
    height: 24px;
    width: 24px;
}

.btn
{
    display: inline-block;
    padding-top: 33px;
    padding: 30px;
}

.btns
{
/*     padding: 18px; */
    margin-right: 7px;
    height: 36px;
    color: #5F6368;
    font-size: 14px;
} 

.btns:hover
{
    border: 1.5px solid lightslategray;
    color: black;
}

Understanding how to style the basic structure of our Google Homepage clone:

  • Using the body element add font-family of “Arial,sans-serif “.
  • Now we will target html elements with class=”header” which we gave for our menu items in the header section, using the dot selector, set the property values for the following attributes: font-size:13px, text-align: right, padding-top: 22px , padding-right: 10px.
  • Targeting the html elements with class “menuitems” using dot operator, style them by setting values of attributes, font-size: 13px, padding-right: 10px, padding left:20px, and display: inline-block which will display menu items horizontally instead of vertically.
  • Now we will style the links that are provided in the header by setting value of text-decoration attribute as none and adding color black (#000000) to the text.

100+ JavaScript Projects With Source Code ( Beginners to Advanced)

  • Now we will set the text-decoration attribute as underline on mouse-over for the links with class header.
  • Styling the html elements with class=”menu” , we will change the background color to white with no border, no outline, box-shadow as none and padding-right as none.
  • For the html elements with Class=”dropdown-content” , we will keep the width: 270px, padding: 28px, margin-right: 82px,
    border: 1px solid #ccc, box-shadow: 0 2px 10px rgba(0,0,0,.2) to add shadow to the box, display: none, z-index: 1 which defines the order of overlapping HTML elements, position: absolute and right: 0.

Let us take a look at the OUTPUT of our google homepage till now:-

Google Homepage Clone Using HTML and CSS
Google Homepage Clone Using HTML and CSS

As you can see there is still some styling left to do for our google homepage clone, lets move forward and add styling to our buttons, app logos in the app section, user-image and search bar.

Now we will add styling to our app logos in the following way:-

  • The text will be aligned at the center, display: inline-block which will allow us to set the width of the app logos, width:86px, padding-top: 5px, padding-bottom: 5px.
.appLogo
{
    text-align: center;
    display: inline-block;
    width: 86px;
    padding-top: 5px;
    padding-bottom: 5px;
}

OUTPUT for our app logos:-

Google Homepage Clone Using HTML and CSS

  • The image tags for the app logos with class=”menuItemLogo”, will have the following property values:- width: 50px, height: 50px, text-align: center, padding-top: 5px, padding-bottom: 5px.

 

The user image will be styled in this way:-

  • The border-radius property for the user image with class=”userImage” will be set to 50% along with margin: -1px, overflow: hidden, position: relative, which will place the user image relative to its current position without changing the layout around it, height: 32px, width: 32px, vertical-align, middle.
.userImage
{
    border-radius: 50%;
    margin: -1px;
    overflow: hidden;
    position: relative;
    height: 32px;
    width: 32px;
    vertical-align: middle;
}

Now to add further styling:

  • To style the search bar for our google homepage, we will set the font-size: 13px, margin: auto, margin-top: 30px, padding: 14px, width: 600px, color: #222, border: 1px solid #dfe1e5, border-radius: 24px, outline: none.
  • To style the google image with search box and buttons we will set the padding-top: 140px and padding-bottom: 160px.
  • When we hover over the search bar, the styling will be done by using the box-shadow property to add shadow behind the search bar. Set it as box-shadow: 0 1px 6px 0 rgba(32,33,36,0.28) and its border-color: rgba(223,225,229,0).
  • For the search bar input, we will set the styling as text-align: left as the text will start inputting from the left side in the search bar, width:95%, border: none and outline: none.
  • The voice search icon will have the following the styles set- float: right, height: 24px and width: 24px.

The buttons will be styled in the following way:-

  • HTML elements with class=”btn” will have display property as inline-block, padding-top: 33px and padding: 30px.
  • HTML elements with class=”btns” will be styled by setting property values as margin-right: 7px, height: 36px, color: #5F6368; font-size: 14px.
  • When mouse-over for the HTML elements with class=”btns”, style them by changing border: 1.5px solid lightslategray and color: black.
.btn
{
    display: inline-block;
    padding-top: 33px;
    padding: 30px;
}


.btns
{
     /*padding: 18px;  */
    margin-right: 7px;
    height: 36px;
    color: #5F6368;
    font-size: 14px;
} 

.btns:hover
{
    border: 1.5px solid lightslategray;
    color: black;
}

Our Google Homepage Clone has been successfully created and now let’s take a look at the output:

OUTPUT:

This is the outcome of our HTML and CSS combined to create a Google Homepage Clone.

Google Homepage Clone Using HTML and CSS
Google Homepage Clone Using HTML and CSS

 

I hope that this article was helpful and you understood the whole project. Now let’s take a look at the Live Preview of our Google Homepage Clone:-

Codepen preview of the Google Clone Homepage with HTML and CSS:

We have successfully created our Google Homepage Clone using HTML and CSS. You can use this project directly by copying into your  IDE. We hope you understood the project. If you have any doubts then feel free to comment them down!!

Follow: codeWithRandom

Written by: Cheshta Vohra

Code by: PS

Leave a Reply