| | |
resizing the div element with window size
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2008
Posts: 10
Reputation:
Solved Threads: 0
given below is the css, html, script of my page
want to adjust div as per page resize and need to have scroll bars for the div
css for div
script for getting the width /height of browser
want to adjust div as per page resize and need to have scroll bars for the div
html Syntax (Toggle Plain Text)
<table style="width: 96%; height: 40px;" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="left"> <img alt="" src="images/silver/btn-login.gif" /><a href="stockregister.aspx"><img alt="" src="images/silver/btn-reorder.gif" /></a> </td> <td> </td> <td style="color: #FFFFFF" align="left"> </td> <td align="right"> image image</td> </tr> <tr style="height: 4px; background-color: Black;"> <td colspan="4"> </td> </tr> <tr> <td align="left" colspan="4"> <table border="0" cellpadding="0" cellspacing="1"> <tr> <td id="help" class="tdmain" align="center"> help></td> <td id="email" class="tdmain"> email</td> <td class="tdmain"> to excel</td> <td class="tdmain"> reset</td> <td class="tdmain"> search</td> <td class="tdmain"> advance search</td> <td class="tdmain"> Back </td> <td class="tdmain"> first</td> <td class="tdmain"> prev</td> <td class="tdmain"> </td> <td class="tdmain"> next</td> <td class="tdmain"> last</td> <td class="tdmain"> ....................... </td> <td valign="bottom"> <img alt="" src="images/silver/btn-login.gif" /></td> <td valign="bottom"> <img alt="" src="images/silver/btn-login.gif" /></td> <td valign="bottom"> <img alt="" src="images/silver/btn-login.gif" /></td> <td valign="bottom"> <img alt="" src="images/silver/btn-login.gif" runat="server" /></td> </tr> </table> </td> </tr> <tr style="height: 4px; background-color: Black;"> <td colspan="3"> </td> </tr> </table> <div id="div1" > <asp:gridview id="gridview1" runat="server"> </asp:gridview> </div>
css for div
css Syntax (Toggle Plain Text)
background-color:Gray; text-align:center; position: static; overflow: auto; left: 0; top:0;
script for getting the width /height of browser
JavaScript Syntax (Toggle Plain Text)
<script type="text/javascript"> <!-- var viewportwidth; var viewportheight; if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth; viewportheight = window.innerHeight } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewportwidth = document.documentElement.clientWidth; viewportheight = document.documentElement.clientHeight } // older versions of IE else { viewportwidth = document.getElementsByTagName('body')[0].clientWidth; viewportheight = document.getElementsByTagName('body')[0].clientHeight; } var width= viewportwidth; var height=viewportheight; document.getElementById("div1").style.width =width + "px"; document.getElementById("div1").style.height = height + "px"; </script>
Last edited by peter_budo; Jan 22nd, 2009 at 7:17 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
There is no browser-independent way to do this, because there is no standard on how the screen size is stored in the browser.
The web is not designed to size things to the browser window. It is NOT like designing a windows program. The web is designed to expand downward as necessary.
Just use the body, and let the scrollbar appear when the content is too large.
The web is not designed to size things to the browser window. It is NOT like designing a windows program. The web is designed to expand downward as necessary.
Just use the body, and let the scrollbar appear when the content is too large.
Daylight-saving time uses more gasoline
Iagree with midimagic, and at the other end of the scale
a blackberry
footer 100px high, and a
header 100px high,
20px of useful data and ya cant get that **expletive deleted** off the screen,
a blackberry
footer 100px high, and a
header 100px high,
20px of useful data and ya cant get that **expletive deleted** off the screen,
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Other Threads in the HTML and CSS Forum
- Previous Thread: Problem in identifying an image in a layout
- Next Thread: Creating HTML structure using lists
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






