Click here to Skip to main content
14,384,769 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi see below link http://liveweave.com/I6JyFT

when i assign canvas width like 100% it takes 100px width why so ,

<canvas id="canvas" width="100%" height="100%">
become
<canvas id="canvas" width="100″ height="100″>

what to do to make canvas match width of parent width , i could not find how to solve it , think bit tricky css issue

html code

<table><tr valign="top"><td>
</td><td>
<table align="center">
<tr valign="top">
<td>
left
</td><td>
            <div id="content">
              <table border="1" width="100%">
                <tr  width="100%"><td style="border:1px solid red">
                    <canvas id="canvas" width="100%" height="100%" style="width: 100%; height: 100%; position: relative">
                    </canvas>
                <div id="canvas-drop-area"></div>
                </td></tr>
              <tr><td style="border:1px solid red">
                    <canvas id="canvas1" width="320" height="256">
                    </canvas>
                <div id="canvas-drop-area1"></div>
                </td></tr>
            </table>
            </div>
</td><td>
right
</td></tr>

</table>
css code below

body{
    background-color:#FBFBFB;
    width:800px;
}
#wrapper{
    margin: 0 auto;
    width: 100%;
    border: 1px solid #999;
    padding: 5px;
    overflow: hidden;
}
#content{
    float:left;
}
#canvas{
    width:320px;
    height:256px;
    overflow:hidden;
    float:left;
    border:1px solid #000000;
}
#canvas1{
    width:320px;
    height:256px;
    overflow:hidden;
    float:left;
    border:1px solid #000000;
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100