How to Create Browsers Window using HTML and CSS ?

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 the relevant information from 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:
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!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="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>                    

    chevron_right

    
    

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

  • CSS Code:
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <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>

    chevron_right

    
    

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

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


Output:




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.