CSS - Div Expand To Size Of Table Stretched Webpage.
I have a simple question that has been driving me insane - I have a very simple website that has a header div, and a table that shows a lot of information (imagine an Excel spreadsheet).
The table stretches the website as long as the table is because it simply will not fit on any screen (I think it's about 4200px wide). This is the desired behaviour I want for this table. However, my header div, will only show 100% wide, the width of the screen before it scrolls. I need to extend it beyond the screen to however wide the website has been made from the dynamic table. Please advise, thank you. Similar TutorialsHi Trying to make a box (with a div and css to control it) that will fit around an image and some text. The image is 90 x 90 pixels and should have a margin of 10 pixels around it so I want my box to be a minimum of 110 pixels high - heres the catch, the text is never the same length its actually printed into the page from some php so the box needs to never go smaller than the image and its margins however if the text is of greater height than those the box needs to expand. This is what I have so far... <style> .floatimage { float: left; padding: 1px; margin-right: 10px; background-color: #CCCCCC; } .floatbox { width: 380px; padding: 10px; background-color: #ff0000; height: 112px; } </style> <div class="floatbox"> <div class="floatimage"><img alt="" src="image/icons/icon.php" /></div> <p> The float property allows other text to fit itself around a box. This is particularly useful with images, but it can be used in any way. </p> <p> I've created this example with enough text that it should wrap around the above floated paragraph. Let's keep going to see what happens. Does it really do what I think it should do? </p> </div> but when i give the box a height its fixed and when i don't it can go smaller than the image - is there a way to do this? Thanks in advance a+ gar How could I Force a parent div to vertically expand to size of its child div? Thanks in advance, Richard Carson hello guys,, I was wondering how to make a webpage take the full browser size and not over flow or be smaller than the browser window also atleast 800 x 600 thnx for ur time.. HMV Hello, I'm having an interesting dilemma. Hopefully I can get some advice. I have created a site using a 2 column liquid layout. The site is created using CSS. I have tested successfully in both FF & IE (which my client uses). In the content area, there is a data table that is generated dynamically. At times the table consists of many columns. If the table strecthes beyond the screen view (resulting in horizontal scrolling) the container/layout does not stretch with the table. Any thoughts? Any suggestions will be greatly appreciated! Below are snippets of code from the css code and html code: CSS Code: body { margin: 0px 20px 0px 20px; background-color: #069; background-image: url(../images/bkgd.gif); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 70%; color: #036; } #container { width: 100%; margin: 0px auto 0px auto; background-color: #DDD; } ... #content { background-color: #FFF; padding: 20px; margin-left: 190px; } ... #content_main table.data { margin: 0px 0px 0px 0px; border: 1px solid #369; background-color: #FFF; } #content_main table a.nobrdr { border-bottom: none; } #content_main table.data th { height: 20px; color: #E8E8E8; text-align: center; background-color: #369; border: 1px solid #2C537D; text-transform: uppercase; } #content_main table.data td { height: 25px; padding: 3px; border: 1px solid #CCC; vertical-align: top; line-height: 15px; } HTML Code: <table width="100%" border="0" cellpadding="0" cellspacing="0" class="data" summary="this table displays BDXT selected data"> <tr> <th scope="col" width="5%" nowrap>fund</th> <th scope="col" width="6%" nowrap>bsli</th> <th scope="col" width="4%" nowrap>reg</th> <th scope="col">title</th> <th scope="col" width="9%" nowrap>projcode</th> <th scope="col" width="7%" nowrap>cip</th> <th scope="col" width="4%" nowrap>afc</th> <th scope="col" width="10%" nowrap>avail</th> <th width="10%" nowrap scope="col">oblig</th> <th width="10%" nowrap scope="col">oblig</th> <th width="10%" nowrap scope="col">oblig</th> <th width="10%" nowrap scope="col">oblig</th> <th scope="col" width="10%" nowrap>unoblig</th> <th scope="col" width="5%" nowrap> </th> </tr> <tr> <td scope="row" align="center" nowrap>682A</td> <td align="center" nowrap>1A01A1</td> <td align="center" nowrap>HQ</td> <td>NEXT GENERATION WEATHER RADAR (NEXRAD) </td> <td align="center" nowrap><a href="#">25570427</a></td> <td align="center" nowrap>W020200</td> <td align="center" nowrap>140</td> <td align="right" nowrap>000,000</td> <td align="right" nowrap>000,000,000</td> <td align="right" nowrap>000,000,000</td> <td align="right" nowrap>000,000,000</td> <td align="right" nowrap>000,000,000</td> <td align="right" nowrap>000,000</td> <td align="center" nowrap><a href="#" class="nobrdr"><img src="images/icon_view.gif" alt="view detail" width="15" height="13" border="0"></a></td> </tr> <tr> <td scope="row" align="center" nowrap>682A</td> <td align="center" nowrap>1A01A1</td> <td align="center" nowrap>HQ</td> <td>NEXT GENERATION WEATHER RADAR (NEXRAD)</td> <td align="center" nowrap><a href="#">25570427</a></td> <td align="center" nowrap>W020200</td> <td align="center" nowrap>3J0</td> <td align="right" nowrap>000,000</td> <td align="right" nowrap>000,000</td> <td align="right" nowrap>000,000</td> <td align="right" nowrap>000,000</td> <td align="right" nowrap>000,000</td> <td align="right" nowrap>000,000,000</td> <td align="center" nowrap><a href="#" class="nobrdr"><img src="images/icon_view.gif" alt="view detail" width="15" height="13" border="0"></a></td> </tr> <tr> <td scope="row" align="center" nowrap>682A</td> <td align="center" nowrap>1A01A1</td> <td align="center" nowrap>TC</td> <td>NEXT GENERATION WEATHER RADAR (NEXRAD)</td> <td align="center" nowrap><a href="#">25570427</a></td> <td align="center" nowrap>W020200</td> <td align="center" nowrap>4C0</td> <td align="right" nowrap>000,000</td> <td align="right" nowrap>000,000,000</td> <td align="right" nowrap>000,000,000</td> <td align="right" nowrap>000,000,000</td> <td align="right" nowrap>000,000,000</td> <td align="right" nowrap>000,000</td> <td align="center" nowrap><a href="#" class="nobrdr"><img src="images/icon_view.gif" alt="view detail" width="15" height="13" border="0"></a></td> </tr> </table> Alright, this is probably a simple fix but I can not find the solution anywhere. I'm trying to highlight a table cell with a 2px solid red border when it is clicked. Is there a way to get this to happen with out changing the size of the cell? I hope this makes sense. Basically the cell is expanding by 1 px causing movement in the table. hello, well im try to make three columns, left,center,right. the left and the right have fixed width,but the center colums should be stretched, so if the left and right each is 200px the center should be the space left in the browser screen in the center. Is it possible to do this using CSS divs? Please this is urgent. Thanks in Adanved Samer please see following code. (i want myHeight becomes dynamis, that mean when user resize the browser, it will be changed automatic w/o refresh the page). thank you. waitting online for the answer. <html> <head> </head> <body > <table> <tr><td>tasd</td></tr> <tr><td> <script type="text/javascript"> var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } //var height = myHeight *.8; document.writeln("<div style='HEIGHT:" + myHeight *.8 + "; WIDTH:100%; OVERFLOW:auto'>"); //return height; </script> <table> <tr><td> msg </td></tr> </table> </div> <td> msg </td> </table> </body> </html> I'm trying to reduce the amount of real estate that a form and button are taking up in my table. They are expanding the whole row and lining them up with the other contents isn't working in the CSS methods I've tried. Finally I tried reduce the font-size of the cell containing the form and button (all the way down to 1px) which gives the desired result... but I'm a bit concerned about implementing it into all the tables in the site because it seems a bit 'hacky'. Is there a better way to do this? My Webpage You'll see in the first table, final column containing the button, that the button and form and pushed up against the top of the cell and the other cells now have more padding. In the second table, my "font-size:1px" has been applied and gives the desired result. Just curious if there is a better way to do this or if this is will be fine. Hi there, I'm completely new to CSS. I'm trying to do this more than one hour but can't get it right. Code: <font color='white'><font size='1' face=verdana size=1> I couldn't find the equivalent of this in CSS This is my last experiment but it doesn't seem to work either Code: fontstyle { color : #FFFFFF; font-family : verdana ; font-size :1;} Thanks So when using Netscape 7.2 & Opera 7.5 and MSIE 6.0, How do you get a simple tag like body { font-size:small; } to be equal in all browsers? Setting IE Text Size to Medium, and Opera's Zoom to 100% (both defaults) and Netscape 7.2 to 120% (not the default) is one way, but is there a CSS way? By the way, the child element hack "body>div {property}" wasn't working no matter what I tried, by not working I mean to say Netscape never would read it or apply it. It appeared to be that Opera & IE need to read the same value while Netscape needs to apply a larger size to be equal to IE's and Opera's rendering. B I could see this as potentially being really easy to do or really hard to do. I'm hoping for the former. Suppose I have 3 divs, A, B, C and that I want the total width of A + B + C to equal the width of the screen. Suppose also that I want them to be inline. How can I have B to be a fixed width while A and C expand depending on the screen width (such that the width of A = the width of C)? Hi, Is there any way to set a DIV that starts at 500px height but can grow if the content inside is longer than that? Thanks. I'm trying to get the footer to dynamically expand with the content in the box 1, 2, 3. How can i do this? The HTML Code: <div id="footer"> <div id="box1">Content</div> <div id="box2">Content</div> <div id="box3">Content</div> </div> The CSS Code: #footer { min-height:150px height:auto; } #box1 { float:left; min-height:150px height:auto; } #box2 { float:left; min-height:150px height:auto; } #box3 { float:left; min-height:150px height:auto; } I have a page that uses CSS to handle layout. I also use a combination of CSS and javascript to create an expandable menu. I have a simplified version of this page he http://www.stringersites.com/csstest/index.htm Users of Dreamweaver will recognize this as being based on the HaloNavLeft template. As you can see, the page displays fine until you start expanding the menu items contained in <div id="mainMenu">. If you expand enough, the mainMenu box extends beyond the borders of the <div id="pagecell1"> in which it's contained. My primary question to the group is how to get the pagecell div to autoexpand along with the mainMenu div. My secondary question is how to stretch a vertical column to the height of the containing div. Specifically, this is <div class="relatedLinks">, which is contained in pageNav, which, in turn, is contained in pagecell1. The relevant pieces of CSS are included below, but you can link to the entire CSS sheet from the test doc above. Thanks in advance for the help. -Steve Stringer Code: #pagecell1{ position:absolute; top: 112px; left: 2%; right: 2%; width:95.6%; background-color: #ffffff; } #mainMenu { background-color: #EEE; border: 1px solid #CCC; color: #000; width: 350px; position: absolute; margin-left: 10px; margin-top: 20px; } #pageNav{ float: left; width:178px; padding: 0px; background-color: #F5f7f7; border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; font: small Verdana,sans-serif; } .relatedLinks{ margin: 0px; padding: 0px 0px 10px 10px; border-bottom: 1px solid #cccccc; } God, this is really simple but I have forgotten how to get the containing box to expand Basically the text div expands but the containing div doesn't PHP Code: <div style="width: 300px; min-height: 200px; border: 1px dashed red;"> <div style="border: 0; width: 110px; height: 110px; float: left;"> <img src="#" width="100" height="80" border="0" align="left" /> </div> <div style="border: 0; width: 190px; min-height: 200px; float: right;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In odio nibh, interdum eget, mollis quis, imperdiet non, risus. Curabitur laoreet vehicula massa. Curabitur consequat dui vitae lectus. Nam rutrum sapien id quam. Pellentesque aliquet nulla dignissim ante. Fusce metus libero, vehicula hendrerit, condimentum id, malesuada in, elit. Nam fermentum, metus in varius scelerisque, diam purus tristique tortor, vitae suscipit elit ipsum eu dolor. Ut dictum porttitor velit. Pellentesque cursus purus elementum dui. Phasellus aliquet ante vitae pede. </div> </div> I have an absolutely position <div> with some content positioned within it. I do not always know the size of the inner content so my problem is getting the outer div to expand to the height of the inner div. Is there a solution for this with absolutely positioned items that wil work in IE/Firefox/Safari? I'm attaching a simple html file which mimics what i am trying to accomplish and the code is below: Code: <div id="detailBlock" style="position: absolute; width: 250px; height: 35px; z-index: 3; border: 1px solid #000; overflow: visible; background-color: #fff5d9; font-size: 8pt; top: 50px; left: 100px;"> <div id="closeBlock" style="position: absolute; width: 40px; height: 8px; left: 210px; top: 3px; font-size: 7pt;"><a href="javascript: closeDetail();">CLOSE</a></div> <div id="detailContent" style="position: relative; width: 240px; top: 15px; left: 5px; border: 1px solid #F00;">Content whose size i do not know...So if I write anything substantial in here it will go over the edge</div> Thanks in advance for your help. I searched for something I want but I didn't find exactly that, or maibe something is wrong but in IE the page does not look ok. What I want is to have my page looks identical in IE as in FF or OPERA. I will explain here how I done the code PHP Code: <td rowspan="2" width="600" align="left" height="100%" valign="top" > <div class="brand_list_big"> <div class="box_header" style="background-color:#79B602;">CARS LISTED BY BRANDS</div> <div class="box_content" style="width:560px;"> <div class="brand_list_header"><span style="float:left;"><strong>Audi</strong></span><span style="float: right;">Total Cars : 2</span></div> <div class="car_list"> <span class="fleft"><a href="#">audi tt</a></span><span class="fright"><img 1><img 2></span><br> <span class="fleft"><a href="#">Saturn Sky Roadster</a></span><span class="fright"><img 1><img 2></span><br> </div> ... <div class="brand_list_header"><span style="float:left;"><strong>Alfa-Romeo</strong></span><span style="float: right;">Total Cars : 0</span></div> ... div.box_header { width: 99,5%; margin: 1px 1px 1px 1px; padding: 5px 0 5px 0; font-weight:bold; font-size: 12px; font-family:Verdana, Arial, Helvetica, sans-serif; } div.box_content { margin: 0 1px 1px 1px; padding: 5px 5px 5px 5px; height: 100%; scrollbar-face-color:#7098DF; scrollbar-highlight-color:#7098DF; scrollbar-3dlight-color:#FFFFFF; scrollbar-darkshadow-color:#FFFFFF; scrollbar-shadow-color:#919AA4; scrollbar-arrow-color:#FFCC00; scrollbar-track-color:#FFFFFF; } .brand_list_header { width: 99,5%; padding: 2px 0 2px 5px; background-color:#E3FEB1; border: 1px solid #CCCCCC; border-bottom: 0 solid #CCCCCC; margin-top: 10px; overflow:auto; /* I added this now and in ff and Opera everithing is ok, but not in IE*/ } .car_list { border: 1px solid #CCCCCC; background-color:#FFFFFF; clear:both; overflow:auto; } .fleft { float: left; margin: 2px 2px 2px 10px; clear:left; } .fright { float: right; } img.new_img { margin: 2px 10px 0 0 ; /*the img from my code( <img 1>, <img 2> ) have this class*/ } Any Ideea why in IE the divs are not ok ? First I tried to list the cars from a brand using <li> elements but I didn't know how to align the images ( icons ) at the right side, like are now. 10x in advance, waiting for a response see ya Hey all, the test page is here. Notice when you expand the "view more details" in IE8 to the point where it is supposed to push the page down, it doesn't! But it does in FF/Safari. HTML CSS Potentially relevant CSS: Code: body { margin: 0; padding: 0; min-height:0; } div.container { width:100px; } div.outerBody { width:100%; min-height:0; } div.innerBody { width:100%; background-image:url("../../images/artist_center/body_bg.jpg"); background-repeat:repeat-x; min-height:0px; height:auto !important; background-color:#cedce5; text-align:center; margin: 0; position:absolute; } div.tabContent { width:945px; min-height:596px; border:solid 1px #cccccc; float:left; position:relative; margin-left:14px; padding-bottom:14px; margin-bottom:14px; } I'm using clearfix to make things work in IE7, but clearly there's some kind of other problem going on. Thanks for any help! Hey guys, I have been working on this for weeks and it is driving me nuts. I am trying to get the wrapper to expand to accomodate the content, but for some reason it wont expand. Any ideas? Here is the link: h$$p://digitallife.us/tutorials-t.html Thanks, Daniel |