html - Defining percentual height for div (CSS) with Google Maps element -
i'm trying create "contact" section website, i'd have text on left side , google maps element on right side show our location. @ moment have managed divs next each other, problem can't seem map's height match div next it. have looked @ other questions , examples, , popular answer seems "add wrapper , define height , width 100% , define div's height 100%, too", hasn't worked me. don't want define fixed px height map, since won't adapt width of window in responsive way.
at moment have:
html
<!-- contact section --> <div class="third" id="contacts"> <div class="starter-template"> <h2>contact us</h2><br> <div class="basic-container"> <div class="contact"> <p class="lead">location</p> <p>the student team spaces can found @ urban mill, located between startup sauna , aalto design factory @ aalto university campus in otaniemi, espoo (street address: betonimiehenkuja 3, espoo, finland). of lectures held @ urban mill. accommodation of students @ forenom hostel (street address: kivimiehentie 2, espoo), 5-minute walk away urban mill.<br><br></p> <p class="lead">get in touch</p> startupsummerprogram@outlook.com</p> </div> <div class="contact"> <iframe id="map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d7936.021807966812!2d24.832175000000017!3d60.18064199999999!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x468df58d0b88505f%3a0xaacf6d4afeea4ebb!2surban+mill!5e0!3m2!1sfi!2sfi!4v1434351601478" frameborder="0" style="border:0"></iframe> </div> </div> </div> </div>
and css:
.third { position: relative; z-index: 100; width: 100%; background-color: #f7f7f7; } .basic-container { width: 70%; margin: 0 auto; text-align: justify; } .contact { width: 49%; height: 100%; display: inline-block; padding: 2%; } .contact p.lead { text-align: left; } #map { width: 100%; height: 100%; }
the starter-template seen in html code there because of starter bootstrap template i'm using. don't believe affects height issue, though :)
the code have creates this:
and i'd have (i achieved demo adding fixed px value map's height):
there must simple way handle this, reason brain doesn't want cooperate me on this. appreciated :)
joanna
maybe this? hope helps!
working code link: https://jsfiddle.net/jxfw0r16/8/
basically i've changed .contact , #map of css.
<div class="starter-template"> <h2>contact us</h2><br> <div class="basic-container"> <div class="contact"> <p class="lead">location</p> <p>the student team spaces can found @ urban mill, located between startup sauna , aalto design factory @ aalto university campus in otaniemi, espoo (street address: betonimiehenkuja 3, espoo, finland). of lectures held @ urban mill. accommodation of students @ forenom hostel (street address: kivimiehentie 2, espoo), 5-minute walk away urban mill.<br><br></p> <p class="lead">get in touch</p> startupsummerprogram@outlook.com</p> </div> <div class="contact"> <iframe id="map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d7936.021807966812!2d24.832175000000017!3d60.18064199999999!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x468df58d0b88505f%3a0xaacf6d4afeea4ebb!2surban+mill!5e0!3m2!1sfi!2sfi!4v1434351601478" frameborder="0" style="border:0"></iframe> </div> </div> </div>
.third { position: relative; z-index: 100; width: 100%; background-color: #f7f7f7; } .basic-container { width: 70%; margin: 0 auto; text-align: justify; } .contact { position: relative; width: 49%; height: 0; display: inline-block; padding-bottom: 60%; } .contact p.lead { text-align: left; } #map { position: absolute; top: 0; left: 0; width: 100%; height: 100% }
Comments
Post a Comment