The map fills the entire vertical space of the page

I'm striving to make my map occupy the entire height of the page, while still staying beneath the navigation bar.

The screenshot below shows what I'm aiming for. How can I achieve this so that regardless of the device, it always fills the full height of the page?

Currently, I am setting the height manually, but is there a specific class that can help me achieve this?

HTML

<div class="column right">
            <div id="map"></div>
        </div>
    </div>

CSS

#map {
   width: 100%;
   float: right;
   height: 600px; 
}


.column {
   padding: 10px;
 }
 
 .left {
   width: 55%;
   padding-left: 50px;
   float:left
 }

 .right {
   width: 45%;
   float: right;

 }

https://i.sstatic.net/a4ems.png

Answer №1

To adjust the height of your viewport excluding the header, you can use height: 100vh and subtract the height of the header like this:

height: calc(100vh - 50px); if your header is 50px in height.

* {
  margin:0;
  box-sizing: border-box;
}

.navigation  {
  width: 100%;
  height: 50px;
  background-color: grey;
}

#map {
   width: 100%;
   float: right;
   height: calc(100vh - 50px);
   background-color: red;
}

 
 .left {
   width: 55%;
   padding-left: 50px;
   float:left
 }

 .right {
   width: 45%;
   float: right;

 }
<div class="navigation">navigation / logo</div>
<div class="column right">
  <div id="map"></div>
</div>

If you want the map to take up the full height with the navigation above it, consider adding position: absolute to the logo bar and setting the map to height: 100vh

* {
  margin:0;
  box-sizing: border-box;
}

.navigation  {
  width: 100%;
  height: 50px;
  background-color: rgba(0,0,0,0.5);
  
  position: absolute;
  top: 0;
  left: 0;
}

#map {
   width: 100%;
   float: right;
   height: 100vh;
   background-color: red;
}

 
 .left {
   width: 55%;
   padding-left: 50px;
   float:left
 }

 .right {
   width: 45%;
   float: right;

 }
<div class="navigation">navigation / logo</div>
<div class="column right">
  <div id="map"></div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to shift footer lower if there is a floating element in the div above it

Trying to move my footer to the bottom of the page, regardless of the amount of content above it. After researching online, I came across a solution on this website: However, everything was fine until I added "float: left" to the content div. Suddenly, th ...

The overlay is larger in size compared to the video positioned beneath it

I'm having trouble placing a video underneath a purple layer as the overlay isn't aligning properly with my video. https://i.sstatic.net/DCzWy.jpg After removing the background-size: cover; in the home section, it appears like this: https://i. ...

paragraph containing various divs

I am struggling to align my text properly and looking for a solution similar to this example http://jsfiddle.net/xKSUH/. The issue I am facing is that my text is not centered and there seems to be an extra space on the second line... Here is my HTML code: ...

Dawn Break Alarm Timepiece - Online Platform

My buddy recently purchased a "sunrise alarm clock" that gradually brightens to mimic a sunrise and make waking up easier. I had the thought of replicating this effect with my laptop, but I've been facing issues with getting the JavaScript time funct ...

"Looking to add some flair to your website with a

I am trying to figure out how to place a 30x30px no-repeat background image in the top left corner of a 200px by 200px div, positioned 120px from the left and 50px from the top. However, I also want to ensure that the text inside the div is displayed on to ...

Exploring the world of flexbox and experimenting with implementing flex-wrap at a specific breakpoint

I am working on a layout that includes a module containing various content. My goal is to have the progress bar, along with the labels "parts" and "projects," positioned underneath an image and expand to the full width of the module when the window size go ...

Ways to incorporate dropdown menus using Bootstrap

Information regarding the inquiries ........................................................................................... <!DOCTYPE html> <html lang="en" xmlns:th="https://www.thymeleaf.org"> <head> <meta charset="UTF-8"&g ...

Ensuring the correct width for a .png image in an email newsletter for Outlook 2013

After creating an email newsletter that works perfectly on all email clients except Outlook 2013, I realized that the image I included is not adhering to the table width specified. Instead, it is defaulting to its own width of 658px. View image here Below ...

Dynamic list choices determined by prior selections

As someone new to Wordpress, I am working on a car platform theme but facing some challenges with the car-selling functionalities. One specific issue is the need to show or hide options based on previous selections made with dropdown lists. For instance, ...

How can Material UI React handle long strings in menu text wrapping for both mobile and desktop devices?

Is there a way to ensure that long strings in an MUI Select component do not exceed the width and get cut off on mobile devices? How can I add a text-wrap or similar feature? Desktop: https://i.sstatic.net/lo8zM.png Mobile: https://i.sstatic.net/8xoW6. ...

Update a Div, Table, or TR element without the need for a page reload or Ajax usage

How can I refresh a div, table or <tr>? The data displayed is not coming from a database, it's just a simple error block and the value comes from Java-script. The issue arises when a user inputs a value in a textbox, the value gets stored in th ...

Do we always need to use eval() when parsing JSON objects?

<!DOCTYPE html> <html> <body> <h2>Creating a JSON Object in JavaScript</h2> <p> Name: <span id="jname"></span><br /> Evaluated Name: <span id="evalname"></span><br /> <p> <s ...

What are some creative ways to customize the background of a full component?

Is there a way to modify the background color of an entire component? I want the color to cover the full width and height of the component. I attempted using the body tag, but it was ineffective. Do I need to enclose all components in a div and then appl ...

Compatibility of image maps with browsers and the usage of imagemapster

Currently, I am utilizing ImageMapster to make adjustments to an image map while hovering. However, I am facing challenges with both the image map itself and the ImageMapster plugin. The issues I am encountering are: 1) Despite specifying a height and wid ...

The expand/collapse feature is limited to the initial item

Currently, I am working on developing an accordion/panel with expand/collapse functionality. While the data from the model is being displayed correctly, the only issue I am facing is that the expand/collapse feature only works for the first item. How can I ...

How to implement hover effects using CSS classes for mouse enter and mouse leave functionality

I have a CSS class called "box" that I am utilizing in my project. .box { margin: 5px; padding: 5px; display: inline-block; width: 240px; height: 290px!important; background-color:#FDFEFE; text-align: center; vertical-align ...

The styling of section and small elements appears differently in Internet Explorer compared to Chrome

I am working on an HTML code to showcase a list of individuals, including their names and statuses. <section class="box-time"> <ul class="group"> <li> <a class="fancybox fancybox.ajax" href="../loadFancybox.php ...

What is the best way to restrict the number of iterations in ngFor within Angular HTML

I want to use ngFor to display a maximum of 4 items, but if the data is less than 4, I need to repeat the loop until there are a total of 4 items. Check out this example <img *ngFor="let item of [1,2,3,4]" src="assets/images/no-image.jpg" styl ...

Components are colliding with one another in the realm of Bootstrap 5

I am in the process of developing a website using Bootstrap. However, I am facing an issue where certain elements are overlapping when I switch my website to a mobile responsive view, similar to the image here. This is how the site appears in the large ve ...

<p> The box is massive, and its size is a mystery to me

https://i.sstatic.net/xPoDz.png Why is the box around my paragraph tag so large? I suspect this could be why I am unable to move the <p> tag down with margin-top: 50px; .train p { margin: 0; font-size: 2.5vw; } <div class="train"> < ...