Side panels positioned on both the left and right sides of an OpenLayers map in the center

I am in the process of creating an interactive game map using the powerful OpenLayers 3 API. My goal is to incorporate four panels into the layout - two on each side (right & left) with the map displayed in the center, positioned below the side panels. However, concepts such as float and z-index have always been a bit perplexing for me. Despite finding several solutions on this issue, I struggle to seamlessly combine them.

Here's the current CSS styling applied to the side panels and map:

.map {
  min-height: 100%;
  min-width: 100%;
  z-index: 0;   
  padding: 0px;
}
.sidebar {
  z-index: 9999;
  background-color: #f2f2f2;
  width: 20%;
  margin: 1%;
  padding: 1%;
  outline: none;
  border: 3px solid #9ecaed;
  border-radius: 2px;
  box-shadow: 0 0 10px #9ecaed;
}
.right { float: right; }
.left { float: left; }

Here's the HTML structure of the 3 DIVs:

<div id="map" class="map"></div> <!-- This is where the Map goes, situated in the middle -->

<!-- Left sidebars -->
    <div class="sidebar left">
        (Content removed for brevity)
    </div>

    <div class="sidebar left" style="padding-top: 0px; height: 50%;">
       (Content removed for brevity)
    </div>

<!-- Right sidebars -->
    <div class="sidebar right">
        (Content removed for brevity)
    </div>

    <div class="sidebar right" style="padding-top: 0px; height: 50%;">
        (Content removed for brevity)
    </div>

I've been dabbling with the solution provided in this answer, but unfortunately, the outcome has not been satisfactory.

Answer №1

Can you show me your html layout? Remember that using float: right/left only has an effect on nested html structures. This means:

<div class="outer" style="float:right;">
// The outer div applies the float attribute to its inner divs
 <div class="inner"> 
 // This inner div will float to the right!
 </div>
</div>

Answer №2

After revamping the website, I successfully resolved my issue by making a significant change. I decided to relocate the sidebars from outside of the map div to inside it. By applying position: relative; to the map and position: absolute; to the sidebars, I was able to achieve the desired layout. Though I still need help with float-related problems, I will create a separate post for that specific issue.

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

Navigate down the page until you reach the section that is set to display as a block

Is it possible to make the page automatically scroll to a specific element located in the middle of the page when changing its display property from none to block? ...

Troubleshooting issues with the 'date' input type feature on mobile devices

When I use the following code: <input type='month' ng-readonly='vm.isReadonly' required min="{{vm.threeMonthsAgo}}" max='{{vm.oneMonthAhead}}'/> I am experiencing some difficulties on mobile devices that do not occur o ...

Is it possible for the `position: fixed` property to interfere with mix-blend-mode, and if so, are there

Struggling to make box-shadows cooperate with different backgrounds? The traditional method involves using mix-blend-mode and adding a pseudo element behind the main one for the effect. You can see an example of this technique here (click the + icon in th ...

Tips on centering text within child elements of a flexbox using the align property

.cnt { display: flex; } .one { background: #ff0000; width: 300px; } .two { background: #00ff00; flex: 1; } <div class="cnt"> <div class="one"> Center me </div> <div class="two"> And me </div> </d ...

How to keep a div fixed while scrolling in an Angular application

My screen layout currently looks like this: https://i.sstatic.net/70DeL.png I am facing the challenge of rendering component 2 inside component 3 in the following manner: https://i.sstatic.net/gD9zF.png Unfortunately, due to certain restrictions, I can ...

Dynamic element substitution

Can you provide guidance on how to create a smooth transition in the height of a container based on the child element's height? Currently, my code does not include any animation effects. setTimeout(() => { document.getElementById("page1").st ...

Exploring the capabilities of Open Layers through selenium

We are facing a challenge with automating clicks on map elements that are svg nodes, as they do not have specific x-paths that selenium relies on. Even attempting to click on features has also proven unsuccessful since they are set as svg elements. Is th ...

Ensure only one button per group is clicked when dynamically generating buttons with Vue.js

I am looking to create multiple questions with 4 answers each on a single website. The goal is to allow only one button to be clickable per question. Any suggestions on how to achieve this? new Vue({ el: '#app', data: { // data here ...

Struggling with coding an array of images in Angular JS

I am having trouble displaying the images as thumbnails and full images for each "gem." The Angular tutorial I followed did not provide enough detail on how to do this. Here is my HTML code: <!DOCTYPE html> <html ng-app="store"> <head> ...

Are `<text>` nodes unable to utilize ligature fonts in CSS/SVG?

Check out this JsFiddle demo: http://jsfiddle.net/d0t3yggb/ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <div class="material-icons">add add add add</div> <svg width="100%" height="100% ...

Issue with JQuery event handlers becoming unresponsive upon resizing the window

JSBin link: http://jsbin.com/4QLDC/6 Here is the JS code snippet that I have written: var toggleContent = function (event) { $(event.target).siblings().toggle(); }; var showOrHidePanels = function () { var windowHeight = $(window).height(); v ...

Change the value of a boolean cell within my database table

I have a task where I need to dynamically update the status of the show_msg parameter based on user actions. When the submit button is pressed, I want to set it as TRUE if the checkbox is checked, and FALSE if not. The main HTML code includes a popup wind ...

A step-by-step guide to triggering a click event using CSS

This code snippet is working as expected: .rightone ul { list-style: none; padding: 0px; margin: 0px; } .rightone ul li { display: block; position: relative; float:right; } .rightone li ul { display: none; } .rightone ul li a ...

Wrapping elements with wrappers causes an incorrect offsetTop value to be retrieved

Previously, I used this approach for the target element and not the wrapper. However, it seems to be ineffective in this specific example. Upon running the code, some strange behaviors become apparent. The offsetTops of the sections are at 0 even before th ...

Using the not operator in Selenium IDE XPath for waitForElementNotPresent seems to be ineffective

I am facing an issue with an XPath in Selenium IDE. In a table, there are multiple records. Above the table headers, there are filtering dropdown menus and a funnel icon that triggers an AJAX function to retrieve filtered data. The problem is that Seleniu ...

What is the best way to maintain the same height for a textarea and input fields?

What is the best way to align the message input field with the name and phone input fields? I need the height of the message input field to match the combined height of the three inputs on the left. It's crucial that the borders line up perfectly. I ...

Progress Bar Modules

I am currently working on creating a customizable animated progress bar that can be utilized as follows: <bar [type]="'health'" [percentage]="'80'"></bar> It is functional up to the point where I need to adjust different p ...

Including hyperlink tags within a CSS file

Can you create internal links within a CSS file, like inserting a table of contents at the top where you can click on an item and immediately jump to that section in the CSS file similar to an anchor tag? This feature would be extremely handy for long CSS ...

The rendering of CSS is altered when being processed by IIS

It appears that this issue is not specific to any browser and generally affects styling in various webkit/gecko/mozilla styles. For instance, when I create a website mockup and implement a style like: element.class { border-radius: 5px; -moz-bor ...

Dynamic Resizing of Facebook Page Plugin for Responsive Design

I'm currently using the Page Plugin widget from Facebook. The Facebook page mentions: If you wish to adjust the widget's width when the window is resized, you must manually refresh the plugin. Is there a way to dynamically modify the width of ...