Open In App

How to Create Browsers Window using HTML and CSS ?

Improve
Improve
Like Article
Like
Save
Share
Report

The browser window is a tool to view the pages from the internet. It is used to search the content on the internet and get relevant information from the internet.

Creating Structure: In this section, we will create a basic site structure and also attach the CDN link of the Font-Awesome for the icons which will be used as a menu icon.

CDN links for the Icons from the Font Awesome:

<link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css”>

HTML code:  

html




<!DOCTYPE html>
<html>
 
<head>
    <meta name="viewport"
          content="width=device-width, initial-scale=1">
    <link rel="stylesheet"
          href=
</head>
 
<body>
 
    <div class="container">
        <div class="geeks">
            <div class="gfg left">
                <i class="fa fa-google"
                   aria-hidden="true">
                      oogle
                  </i>
 
            </div>
 
            <!-- Google icon from font awesome-->
            <div class="gfg middle">
                <input type="text"
                       value=
                <i class="fa fa-search"
                   aria-hidden="true">
                  </i>
            </div>
            <div class="gfg right">
                <div style="float:right">
                    <span class="bar"></span>
                    <span class="bar"></span>
                    <span class="bar"></span>
                </div>
            </div>
        </div>
 
        <div class="body">
            <h3>GeeksforGeeks</h3>
            <p>A Computer Science Portal for Geeks</p>
        </div>
    </div>
 
</body>
 
</html>


Designing Structure: In the previous section, we created the structure of the basic website that we are going to use as browser window. In this section, we will design the structure for the browser window. 

CSS Code: 

CSS




<style>
    * {
    box-sizing: border-box;
    }
     
    /* Container Design */
    .container {
    border: 2px solid #bdc3c7;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    }
     
    .geeks {
    padding: 10px;
    background: #f1f1f1;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    }
     
    /* Input field design */
    input[type=text] {
    width: 100%;
    border-radius: 3px;
    border: none;
    background-color: white;
    margin-top: -8px;
    height: 25px;
    color: gray;
    padding: 5px;
    }
     
    .gfg {
    float: left;
    }
     
    .middle {
    width: 75%;
    position: relative;
    }
     
    .left {
    width: 15%;
    }
     
    .right {
    width: 10%;
    }
     
    .middle i {
    position: absolute;
    left: 430px;
    top: 2px;
    color: gray;
    }
     
    .geeks:after {
    content: "";
    display: table;
    clear: both;
    }
     
    /* Address bar design */
    .bar {
    width: 15px;
    height: 3px;
    margin: 3px 0;
    display: block;
    background-color: #aaa;
    }
     
    .body {
    padding: 15px;
    }
</style>


Final Solution: This is the final code after combining the above sections. It will the browsers window. 

html




<!DOCTYPE html>
<html>
 
<head>
    <meta name="viewport"
          content="width=device-width, initial-scale=1">
    <link rel="stylesheet"
          href=
    <style>
        * {
            box-sizing: border-box;
        }
 
        /* Container Design */
        .container {
            border: 2px solid #bdc3c7;
            border-top-left-radius: 6px;
            border-top-right-radius: 6px;
        }
 
        .geeks {
            padding: 10px;
            background: #f1f1f1;
            border-top-left-radius: 4px;
            border-top-right-radius: 4px;
        }
 
        /* Input field design */
        input[type=text] {
            width: 100%;
            border-radius: 3px;
            border: none;
            background-color: white;
            margin-top: -8px;
            height: 25px;
            color: gray;
            padding: 5px;
        }
 
        .gfg {
            float: left;
        }
 
        .middle {
            width: 75%;
            position: relative;
        }
 
        .left {
            width: 15%;
        }
 
        .right {
            width: 10%;
        }
 
        .middle i {
            position: absolute;
            left: 430px;
            top: 2px;
            color: gray;
        }
 
        .geeks:after {
            content: "";
            display: table;
            clear: both;
        }
 
        /* Address bar design */
        .bar {
            width: 15px;
            height: 3px;
            margin: 3px 0;
            display: block;
            background-color: #aaa;
        }
 
        .body {
            padding: 15px;
        }
    </style>
</head>
 
<body>
 
    <div class="container">
        <div class="geeks">
            <div class="gfg left">
                <i class="fa fa-google"
                   aria-hidden="true">
                  oogle
                  </i>
 
            </div>
 
            <!-- Google icon from font awesome-->
            <div class="gfg middle">
                <input type="text"
                       value="https://www.geeksforgeeks.org/">
                <i class="fa fa-search"
                   aria-hidden="true">
                  </i>
            </div>
            <div class="gfg right">
                <div style="float:right">
                    <span class="bar"></span>
                    <span class="bar"></span>
                    <span class="bar"></span>
                </div>
            </div>
        </div>
 
        <div class="body">
            <h3>GeeksforGeeks</h3>
            <p>A Computer Science Portal for Geeks</p>
        </div>
    </div>
 
</body>
 
</html>


Output: 

Supported Browser:

  • Google Chrome
  • Microsoft Edge
  • Firefox
  • Opera
  • Safari


Last Updated : 12 Jul, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads