Cjbon Bon
Cjbon Bon

Reputation: 45

Stretch height/width to fit screen in <Div> Tag

I have a map wrap in div tag, what can I do to make "map_canvas" stretch 100% for width/height below h1 tag?

CSS and javascript is possible?

<div data-role="page" id="gmap">
    <div data-role="header" data-theme="b">
        <a href="#map" data-icon="back" data-transition="none">Back</a>
        <h1>Google Map</h1>
    </div>
    <!--div id="map_canvas" style="width: 480px; height: 480px"></div-->
        <div id="map_canvas"></div>
</div>

Cheers.

Upvotes: 0

Views: 2089

Answers (1)

manny
manny

Reputation: 1948

First way, you may need to calculate what is the width and height through JS and apply to your div, this will be perfect one.

Second way 100% width will work through css ( margin: 0 auto; width:100%), but 100% height can not be possible through css.

Upvotes: 1

Related Questions