The Wayback Machine - https://web.archive.org/web/20240910043321/https://www.geeksforgeeks.org/how-to-create-browsers-window-using-html-and-css/
Open In App

How to Create Browsers Window using HTML and CSS ?

Last Updated : 12 Jul, 2023
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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


Previous Article
Next Article

Similar Reads

Difference between window.location.href, window.location.replace and window.location.assign in JavaScript
Window.location is a property that returns a Location object with information about the document's current location. This Location object represents the location (URL) of the object it is linked to i.e. holds all the information about the current document location (host, href, port, protocol, etc.) All three commands are used to redirect the page t
4 min read
How to align checkboxes and their labels on cross-browsers using CSS ?
For aligning the checkboxes or radio buttons with their labels can be achieved in many ways. Some of the simplest methods to achieve this are described below with proper code and output in different browsers. Now styling can be done in various ways to align the checkboxes and their labels. For this article, we are using internal stylesheet which is
2 min read
How to change text selection color in the browsers using CSS ?
Most of the browsers by default highlight the selected text in a blue background. This can be changed by using the ::selection pseudo selector in CSS. The ::selectionselector is used for setting the CSS property to the part of the document that is selected by the user (such as clicking and dragging the mouse across text). Only some CSS properties a
1 min read
Why do browsers match CSS selectors from right to left ?
Cascading Style Sheets fondly referred to as CSS, is a simply designed language intended to simplify the process of making web pages presentable. CSS allows you to apply styles to web pages. More importantly, CSS enables you to do this independently of the HTML that makes up each web page. It describes how a webpage should look: it prescribes color
3 min read
What are different video formats supported by browsers in HTML ?
In this article, we will see what are the different video formats that are supported by the browser, along with understanding their implementation. Browsers support text in different colors with different fonts and along with supporting various media which includes images, music, videos, animations, etc. A video exists in different formats such as
3 min read
How to Configure Mouse Wheel Speed Across Browsers using JavaScript ?
The mouse wheel's scrolling speed varies with the choice of the web browser, even the DOM events and methods to change the scrolling speed are not the same. To provide zoom and animation on a web page, it is generally required to configure mouse speed. The speed of the wheel can be controlled by normalizing the distance the wheel has traveled. Ther
3 min read
How to detect page zoom level in all modern browsers using JavaScript ?
In this article, we will discuss how the current amount of Zoom can be found on a webpage. These are the following methods: Table of Content Using outerWidth and innerWidth PropertiesUsing clientWidth and clientHeight PropertiesUsing the window.devicePixelRatio PropertyMethod 1: Using outerWidth and innerWidth PropertiesIt is easier to detect the z
3 min read
Difference between window.onkeypress and window.document.body.onkeypress
The onkeypress event can be triggered in JavaScript using both: window.onkeypresswindow.document.body.onkeypress To understand the difference between the two we need to have a look at the HTML DOM (Document Object Model): DOM is a model that represents the HTML document as a tree structure.The tree structure has the root node as a Document object.O
2 min read
Javascript Window Blur() and Window Focus() Method
JavaScript provides various methods to manipulate browser windows, two of which are window.blur() and window.focus(). These methods are particularly useful when managing the user interface and enhancing the user experience by controlling window focus. Javascript Window Blur()Javascript Window Blur() method is used to remove focus from the current w
3 min read
Web Window API | Window locationbar property
In Web API Window.locationbar property returns the object of locationbar, for which we can check the visibility. Syntax: objectReference = window.locationbar Example: Check the visibility. &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; Window locationbar property &lt;/title&gt; &lt;style&gt; a:focus { background-color: magenta; }
1 min read
Web Window API | Window scrollbars property
In Web APIWindow.scrollbars property returns the object of scrollbars, for which we can check the visibility. Syntax : objectReference = window.scrollbars Example : Check the visibility &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; Window scrollbars property &lt;/title&gt; &lt;style&gt; a:focus { background-color: magenta; } &lt;/st
1 min read
Web Window API | DOM Window fullscreen property
The Window interface has a fullscreen property which tells whether the window is displayed in fullscreen mode or not. Syntax: BoolVal = windowReference.fullScreen; Return value: Boolean True: If windows is in fullscreen mode. False: If windows are not in fullscreen mode. Example : &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; Window
1 min read
Web Window API | Window personalbar property
In Web API Window.personalbar property returns the object of personalbar, for which we can check the visibility. Syntax: objectReference = window.personalbar Example: Check the visibility &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; Window personalbar property &lt;/title&gt; &lt;script type=&quot;text/javascript&quot;&gt; function
1 min read
Web Window API | Window statusbar property
In Web API Window.statusbar property returns the object of statusbar, for which we can check the visibility. Syntax: objectReference = window.statusbar Example: Check the visibility &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; Window statusbar property &lt;/title&gt; &lt;script type=&quot;text/javascript&quot;&gt; function getvisib
1 min read
Web Window API | Window toolbar property
In HTML Window.toolbar property returns the object of toolbar, for which we can check the visibility. Syntax: objectReference = window.toolbar Example: Check the visibility C/C++ Code &amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html&amp;gt; &amp;lt;head&amp;gt; &amp;lt;title&amp;gt; Window toolbar property &amp;lt;/title&amp;gt; &amp;lt;script type=&amp;
1 min read
Web Window API | Window menubar property
In HTML Window.menubar property returns the object of menubar, for which we can check the visibility. Syntax: objectReference = window.menubar Example: This example uses Window.menubar property to check the visibility of menubar object. C/C++ Code &amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html&amp;gt; &amp;lt;head&amp;gt; &amp;lt;title&amp;gt; Window m
1 min read
Window | Window.requestAnimationFrame() Method
Nowadays, various web development technologies are introduced to create elegant web pages. While talking about elegant web pages, one of the most important things that come to mind is animation. There are many ways to generate them, modern CSS is one of them but JavaScript has always been a power-packed option to do so. The requestAnimationFrame()
3 min read
Javascript Window Open() &amp; Window Close() Method
The Javascript Window.Open() method is used to open the web pages into a new window or a new tab. It depends on the browser settings and the values assigned to the parameter. Syntax: window.open(URL, name, specs, replace)Parameters: This method accepts four parameters as mentioned above and described below: URL: It is an optional parameter. It is u
3 min read
Next.js Supported Browsers and Features
NextJs is a popular JavaScript library that helps developers create server-side rendered React applications. It’s one of the most popular frameworks for creating React applications, and it’s used by some of the biggest companies in the world, such as Airbnb, Netflix, and Reddit. In this blog post, we will explore what NextJs is, what browsers it su
4 min read
How to style scrollbar thumb for the webkit browsers and what are components of scrollbar ?
We use the scrollbar daily while using the web. Scrollbars are tools with the help of which we can scroll the content of our webpage. The problem with the default scrollbars is that they always appear in the same dull gray color. But then how to make them look good? In this article, we will learn how to make a scrollbar look good. What are the comp
2 min read
Sliding Window Visualizer using HTML CSS and JavaScript
Window sliding technique is used extensively in array problems and used a lot in subarray-related problems like subarray sum etc. In this article, we will understand how Sliding Window Visualizer works along with knowing the basic implementation of the visualizer. Window sliding technique is an efficient way to calculate and solve problems with con
8 min read
Maximum length of a URL in different browsers
In this article, we will discuss the overview of URL and Browser with examples of both of them. And finally will conclude with the Maximum length of a URL in different browsers. Let's discuss it one by one. URL Overview :URL stands for Uniform Resource Locator. URLs were defined in RFC 1738 in 1994. In this, it gives the specific location over the
3 min read
How can JavaScript codes be hidden from old browsers that do not support JavaScript ?
Nowadays all modern browsers support JavaScript, however, older browsers did not support JavaScript. In this article, we will learn how we can hide JavaScript code from running in older browsers. Approach: After opening the &lt;script&gt; tag, we will use a one-line HTML style comment without any closing character ( &lt;!-- ). We will then write th
2 min read
Why can't browsers read JSX ?
React, a JavaScript library for web applications utilizes JSX—a syntax extension allowing JavaScript objects within HTML elements, enhancing code clarity. JSX isn't directly supported by browsers, requiring conversion by tools like Babel to transform JSX into valid JavaScript. This transpilation ensures browsers can interpret and execute the JSX-em
2 min read
How to use .otf fonts on web browsers ?
OpenType Font (.otf) is a font format that was developed by Microsoft and Adobe. It is an extended version of the TrueType font format and it supports advanced typographic features like ligatures, small caps, and many more. It is more widely preferred over another font format because it is over better cross-platform compactness and includes a wider
2 min read
How to Access Localhost on Mobile Browsers?
Accessing localhost on a mobile browser is a useful skill for developers who need to test and debug their web applications on different devices. Whether you're developing a responsive website or a mobile app, being able to view localhost from your smartphone can significantly streamline your testing process. In this guide, we will show you how to a
3 min read
How To Create a Popup Chat Window With CSS?
One of the many ways to assist your users actively is by adding a popup chat window on your website. This tutorial will walk you through the process of building a basic but useful popup chat box with HTML, CSS, and JavaScript. Approach:Design the layout with the "Open Chat," header, message input, and "Send" button.Set up the HTML structure and pos
3 min read
How to create a dialog box or window in HTML ?
In this article, we will create a dialog box or window using the &lt;dialog&gt; tag in the document. This tag is used to create popup dialog and models on a web page. This tag is new in HTML5. Syntax: &lt;dialog open&gt; Contents... &lt;/dialog&gt; Example 1: &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; How to define a dialog box o
1 min read
Create a CSS Fireflies background using HTML/CSS
In this article, we will see how to create the CSS Fireflies background using HTML &amp; CSS, along with understanding its implementation through the illustration. The CSS fireflies effect can be created by utilizing the CSS animation and we will implement 3 animations to achieve the fireflies effect. To create randomness, we used different animati
7 min read
How to Stretch Elements to Fit the Whole Height of the Browser Window Using CSS?
To stretch elements to fit the whole height of the browser window using CSS, you can use "vh" units, where "1vh" equals 1% of the viewport height, so setting the height to "100vh" spans the entire height. Approach: Using CSS height PropertyIn this approach, we are using the Height property to fit the whole height of the browser. The height does not
1 min read