Warren Warren - 1 year ago 58
CSS Question

Extend DIV beyond WordPress page container

I've seen a lot of questions like this, but specifically I want to extend one div in a WordPress beyond the page content.

I have a Contact Us page, and I just want my google map to take up all of the bottom of the browser just above the footer. I want to be able to do this (if possible) within the CMS and not by creating a specific page template.

Current code is simply:

<div id='gmap_canvas' style='height:440px;width:100%;'></div>

I'm using a theme (Sydney) built in Bootstrap if that helps.

Answer Source

Something like this?

.gmaps {
  background: url(https://www.somersethouse.org.uk/images/mi/visit/map.jpg);
  height: 200px; /*might not be needed by you*/
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
<!DOCTYPE html>

  <script src="https://code.jquery.com/jquery.min.js"></script>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>

  <div class="container">
    some content
    <div class="gmaps">



Note: This assumes that the parent in which gmaps div is gonna be placed in, doesn't have any positioning context applied. That is it's position is static.