Two divs side by side, one with google map and second with fixed width

后端 未结 1 1315
南笙
南笙 2021-01-14 06:40

I want to use two DIVs, side by side. First DIV with responsive width and with google map inside... And second DIV with fixed width.

jsFiddle example

HTML

相关标签:
1条回答
  • 2021-01-14 07:05

    EDIT delete js resize / correct css +fiddle

    http://jsfiddle.net/FXk4x/10/

    JS

    var map;
    var elevator;
    var myOptions = {
        zoom: 4,
        center: new google.maps.LatLng(50, 10),
        mapTypeId: 'terrain'
    };
    map = new google.maps.Map($('#map')[0], myOptions);
    var markers = [];
    

    Use css position :

    CSS

    *{
      margin:0;
      padding:0;  
    }
    
    .wrapper{
        margin-top:10px;
        border:solid 1px red;
        position :relative;
        width: 90%;
        margin: 0px auto;
        height:300px;
    }
    #map {
    
        position :absolute;
        top:0;
        left:0;
        bottom:0;
        right:250px;
    
      border: 1px solid;
    }
    .right {
      position : absolute;
      top:0;
      right:0;
      background: orange;
      width: 250px;    
      height: 300px;
    }
    

    FAQ CSS position here

    0 讨论(0)
提交回复
热议问题