HTML - Extreme Dynamic Table Widths?
Is it possible to set a table's width as something like this?
HTML Code: <table width="100%-100px"> Similar TutorialsWhy the "R w50" text is not on the right?? And why the widths on the top table are not correct? How can I fix it? Code: <table border=1 cellpadding=5 cellspacing=0> <tr> <td style=\"width:30px;\">w30</td> <td>n</td> <td style=\"text-align:right; width:50px;\">R w50</td> </tr> <tr> <td colspan=3> <table border=1 cellpadding=5 cellspacing=0 bordercolor=red width=100%> <td style=\"width:30px;\">w30</td> <td>n n n n n n n n n n n n n n n n n n n</td> <td style=\"text-align:right; width:50px;\">R w50</td> </table> </td> </tr> </table> Hi Guys, I'm having major problems with setting the widths of columns on my page. As per attached pic, I'm trying to get the three main columns to be exactly 300 however it is putting it as 300 (308) in the design view which means the backgrounds in some of the table cells are repeating as shown in box and the text is spreading across the table cell width of what the figure is in brackets and not the 300 I want it to be. Any one got any ideas - its driving me nuts ! Hi all, thank you in advance to anyone that can help. I'm sure this is probably an issue that has been covered in the past however I have had no luck finding it. I have a 2 column table with an iframe the left column. Firefox shows this correctly, the edge of the cell meets with the iframe etc, but when viewed in IE, the table widths change dramatically. I have inserted two images (firefox v IE) to show what is happening. If anyone can find what I have done wrong, I would greatly appreciated. Please, keep the replies in simple terms, I'm a bit of a n00b... [IMG][img=http://img2.freeimagehosting.net/uploads/36b3e47e84.jpg][/IMG] Hi all, thank you in advance to anyone that can help. I'm sure this is probably an issue that has been covered in the past however I have had no luck finding it. I have a 2 column table with an iframe the left column. Firefox shows this correctly, the edge of the cell meets with the iframe etc, but when viewed in IE, the table widths change dramatically. I have inserted two images (firefox v IE) to show what is happening. If anyone can find what I have done wrong, I would greatly appreciated. Please, keep the replies in simple terms, I'm a bit of a n00b... As you can see, the gray table background has overlapped over the iframe. Hi guys, I have a problem with table widths used to arrange content on a website. Why am I not using DIVs? Because it's too time consuming at the moment to convert it over, and my client is not familiar with DIVs and has no time to learn it. So I have to stick to using tables for him to maintain on his own. Here's a quick rundown on my table layout. ----------------------------- |TD1-------------|TD1a****| ------------------ |TD2-------------|********| ------------------ |TD3-------------|********| ------------------ |TD4-------------|********| |Table 2----------|********| ------------------------------ |TD5-------------|********| ------------------------------ That's my attempt to illustrate my layout. I'm using * and - as fillers, the editor removes all the empty spaces... My problem is, TD1 to TD3 and TD5 aligns nicely vertically - they all have the same / correct width. However, TD4 with a table inside is slight shorter in width than it should. About 1 or 2 px. The following shows the screenshots. zoomed in.... I need to get that TD4 with the table inside to have the same width as the others. I have tried removing all BORDER and BORDERCOLOR codes from all the table tags, no use. I tried using both CSS and the table tag WIDTH to control it, still doesn't work. Need suggestions!! Please click here to see my code. It's a little messy... http://www.thienkaiwei.com/index7.html why the table i have dont expand over browser borders when sum of td widths is bigger than screen width? How can i overcome this problem? First I am not sure if this is the right place to post this, it might need to be in a different language section. Sorry for that if it is. I need to create a set of drop down boxes, most likely 6. Each box needs to have 4-5 different options in it. There is no order in which they need to be set up because the user HAS TO be able to start with whatever box they want. From their choice in the first box, certain selections in the other drop down boxes would have to be eliminated. Same with the second, third and so on. There can be no predetermined order of what one they start with because not all the boxes will apply to every user. Another way to imagine the basic concept if I am not clear enough is go to any car website like kbb.com. When you first select the company who makes your car, Honda for example, the next box over will bring up a list of all the cars Honda makes. Then when you choose the car, Accord for example, the next box will give you the option of the manual or automatic and so on. I am kind of looking for this functionally, but I need it to be where you can start with any box and no matter what you choose in the first box, it does not eliminate all other choices, just 1 or 2 from each box (based on the selection). I know this is kind of hard to understand, it is even harder for me to describe. lol. If you can give me any help that would be wonderful, even if it is just a language this would be able to be accomplished in. I would really like there to be a web version for a website as well as a stand alone program to run on computers (this will probably be done in C# I am guessing). Thank you so much, Brian Stoiber Alright, well, I have been redesigning my website, and what I usually do when designing a website is design it, clean it up, then optimize it as best as I can. Well, usually my trusty little web page speed test, apparently my new design is SUPER slow. It failed 4/7 areas for speed. Note: This is the first time that I've designed all of the images and coding for my site, I used to just find a template, then redesign it to fit my needs. Anywho, here's my page: www.letarde.com/new Can someone tell me why it is failing the speed test? PS: After looking closer at the speed test, apparently my entire page is almost 300KB!!!!!! What the heck! Hello, I have a simple problem and tried to google but did not get anything much. I want a simple HTML page which had a image aligned absolutely to the right in the middle and touching the scrollbar. Now, I can achieve this by having the image as the body background. However, when I use it in a image tag, it is aligned to the right ut there is space between the scrollbar and image. about a centimeter. Can anyone help.? Please note that there is no text just a image which has a map tag. I just need to align it to the extreme left or right touching the browser. this works great. if I put the no repeat option Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>S</title> </head> <body background ="6.jpg"> </body> </html> however when I use as a regular image there is a gap. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>S</title> </head> <body> <img src = "6.jpg" align = right> </body> </html> Thanks, Sunil I have 10 rows compose of 3 textbox per row. After pressing submit button, they are post to the next page to a table. But my problem is if only 3 rows have data the other rows is still shown in a table but blank with borders. So I want my table to show the rows who only have data I want to dynamically hide column in table. There's many working examples on the web, such as http://www.ahfb2000.com/webmaster_he...ead.php?t=3356 But I lack one feature. When I hide column (all cells in column) via style.visibility="hidden", the remaining column (cells) doesn't adjust its width. I would like to somewhat make the table adjust all cells widths (push together), as if the hidden column (cells) wasn't there at all. Is it possible ? Thanks. I've searched around quite a bit, read various articles and so-on and only really come to the conclusion that this is a lot harder than it should be! What I have is a simple page for a PHP script, it has a little form for entering keywords, and displays an image above this form. Now, what I want to do is place these in a table, and have that table resize to fit the viewable area of the user's browser-window. So, what I have is a table with three-rows: The title of the image The image itself The form for entering image keywords Now, what I would like to do is have the image scale to fill the middle cell, which by default eats up all available space leftover by the form and title cells. However, this isn't happening, I enter a height of 100% for the image but it seems to be using some other container to get its height. I'm generally well-versed in HTML, but this one has me stumped! Any help is appreciated, here is the basic HTML I'm using for what I had thought would be a simple page Code: <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1" /> <meta name="author" content="Haravikk.com" /> <title>Add keywords</title> <style type="text/css"> body, html { height: 100%; margin: 0; text-align: center; } tr, td, textarea { width: 100%; } table { width: 99%; height: 100%; margin: 0 auto 0 auto; } table, td { border-width: 0; border-spacing: 0; padding: 0; } #image { height: 100%; } #tdTitle { height: 5%; } #tdImg { height: 75%; } #tdForm { height: 20%; } #formText { width: 100%; height: 75%; } </style> </head> <body> <table> <tr> <td id="tdTitle"><b>placeholder.png</b></td> </tr> <tr> <td id="tdImg"> <img id="image" src="http://haravikk.com/placeholder.png" alt="" /> </td> </tr> <tr> <td id="tdForm"> <form action="keywords.php" method="post"> <textarea name="keywords" id="fmrText"></textarea><br /> <input type="submit" /> </form> </td> </tr> </table> </body> </html> Now, I don't know if I could eliminate the table in favour of divs and do this, any suggestions to make the above html work, or to re-write it are welcome! The image provided is just to illustrate the problem Just getting my feet wet. using XMLSpy stylesheet designer to help guide. I'm converting XML to HTML, which is Microsoft's recommended way of controlling the import of XML into Excel. I've got the stylesheet below in productive use. However, I want to make one key change. I want the name of XML elements to become the text column headings so I can deal with files that have dynamic column names. Suggestions appreciated. Here is typical XML: <NewDataSet> <Table> <Name>Linda Britt</Name> <RFQCount>324</RFQCount> <RFQResponseCount>556</RFQResponseCount> </Table> </NewDataSet> Here is the stylesheet. See comments regarding what I'm trying to change. <xsl:template match="/"> <html> <head></head> <body> <xsl:for-each select="NewDataSet"> <xsl:for-each select="Table"> <xsl:if test="position()=1"> <xsl:text disable-output-escaping="yes"><table border="0"></xsl:text> </xsl:if> <xsl:if test="position()=1"> <thead> <tr> <td > <span>Buyer Name</span> COMMENT: I want this to be "Name" from element name. </td> <td > <span># RFQs</span> COMMENT: I want this to be "RFQCount" from element name. </td> <td > <span># Responses</span> </td> </tr> </thead> </xsl:if> <xsl:if test="position()=1"> <xsl:text disable-output-escaping="yes"><tbody></xsl:text> </xsl:if> <tr> <td> <xsl:for-each select="Name"> <xsl:apply-templates/> </xsl:for-each> </td> <td> <xsl:for-each select="RFQCount"> <xsl:apply-templates/> </xsl:for-each> </td> <td> <xsl:for-each select="RFQResponseCount"> <xsl:apply-templates/> </xsl:for-each> </td> </tr> <xsl:if test="position()=last()"> <xsl:text disable-output-escaping="yes"></tbody></xsl:text> </xsl:if> <xsl:if test="position()=last()"> <xsl:text disable-output-escaping="yes"></table></xsl:text> </xsl:if> </xsl:for-each> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> Hi Can anyone solve this problem. Here is my code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Hide/Show Test!</title> <style> .myclass1 { background-color:#CCCCCC; display:block; } .myclass2 { display:none; } </style> </head> <body> <script> function hideNshow(){ var e1=document.getElementById('A1C1_1'); if(e1.className=="myclass1") { e1.className="myclass2"; } else { e1.className="myclass1"; } e1=document.getElementById('A1C1_2'); if(e1.className=="myclass1") { e1.className="myclass2"; } else { e1.className="myclass1"; } } </script> <!-- <input type="button" name="myBtn" value="Click Me!" onclick=" hideNshow();"/>--> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td><a href="#" onclick=" hideNshow();">Row1/Cell1</a></td> <td >Row1/Cell2</td> <td>Row1/Cell3</td> </tr> <tr id="A1C1_1" class="myclass2"> <td>Row2/Cell1</td> <td>Row2/Cell2</td> <td>Row2/Cell3</td> </tr> <tr id="A1C1_2" class="myclass2"> <td>Row2/Cell1</td> <td>Row2/Cell2</td> <td>Row2/Cell3</td> </tr> <tr> <td>Row3/Cell1</td> <td>Row3/Cell2</td> <td>Row3/Cell3</td> </tr> <tr> <td>Row4/Cell1</td> <td>Row4/Cell2</td> <td>Row4/Cell3</td> </tr> <tr> <td>Row5/Cell1</td> <td>Row5/Cell2</td> <td>Row5/Cell3</td> </tr> </table> </body> </html> It is working fine in IE. When I click the link It displays the hidden rows and hides when I click the link agian. But in Firefox it is giving error. It is adding empty rows. How to prevent that. Thanks in advance. I am trying to slowly put together a very simple content management site for a footy club i run, the data is stored in a mysql database and lined to the web page using a dynamic table from within dreamweaver, it displays all the info except one thing it appears in one huge paragraph, take a look at my page Link is at: http://itdesignz.co.uk/Clients/RTFC/cms/home.php The Data in the mysql has the spaces and enters breaks in it, but these are not reflected in my page. I am really new to dreamweaver and am not sure how to overcome this problem, Please help Andy Hello, I have a table (with one cell). The table can be quite big (200 items) so I would like the user to be able to scroll it up and down... and I want the user to be able to add and delete an item. I have done something with javascript but it is not complete.. the delete does not work correctly ... the scroll up and down shown the same table. I don't have a clue on how to do the add button. Could you help me please? Here is what I have done so far.... Code: <html> <head> <title>Insert/Delete Table Row using DOM</title> <link rel="stylesheet" type="text/css" href="style.css"> <style type="text/ccs"> <!-- form {border:1px solid blue;} div {border:1px solid red; width:150px; overflow:auto;} .selectBox { font-size:xx-small;overflow:auto;} #tblSample td,th {padding:0.5em;} .classy0 { background-color: #234567; color:#89abcd;} .classy1 {background-color: #89abcd; color:@234567;} --> </style> <%@ include file="javascriptLib.html" %> <script language="JavaScript" type="text/JavaScript"> <!--- oculta el script para navegadores antiguos var INPUT_NAME_PREFIX = 'inputName'; // this is being set via script var TABLE_NAME = 'items_list'; // this should be named in the HTML var LABEL_NAME = 'label_list'; var ROW_BASE = 1; // first number (for display) var MAXLENGTH=5; function myRowObject(one,two) { this.one = one; // text object this.two = two; // input text object } function deleteCurrentRow(obj) { var delRow = obj.parentNode.parentNode; var tbl = delRow.parentNode.parentNode; var rIndex = delRow.sectionRowIndex; var rowArray = new Array(delRow); deleteRows(rowArray); reorderRows(tbl, rIndex); } function deleteRows(rowObjArray) { for (var i=0; i<rowObjArray.length; i++) { var rIndex = rowObjArray[i].sectionRowIndex; rowObjArray[i].parentNode.deleteRow(rIndex); } } function reorderRows(tbl, startingIndex) { if (tbl.tBodies[0].rows[startingIndex]) { var count = startingIndex + ROW_BASE; for (var i=startingIndex; i<tbl.tBodies[0].rows.length; i++) { // CONFIG: next line is affected by myRowObject settings tbl.tBodies[0].rows[i].myRow.one.data = count; // text // CONFIG: next line is affected by myRowObject settings tbl.tBodies[0].rows[i].myRow.two.name = INPUT_NAME_PREFIX + count; var tempVal = tbl.tBodies[0].rows[i].myRow.two.value.split(' '); tbl.tBodies[0].rows[i].className = 'classy' + (count % 2); count++; } } } function clearTable(option) { var tbl = document.getElementById(TABLE_NAME); if (option != 0) tbl= document.getElementById(LABEL_NAME); //var lastRow = tbl.tBodies[0].rows.length; var lastRow = tbl.rows.length; var i=lastRow-1; while (i>=0) { tbl.deleteRow(i); i--; } } function showRow (val) { var tbl = document.getElementById(TABLE_NAME); var nextRow = tbl.tBodies[0].rows.length; //var nextRow=tbl.rows.length; var iteration = nextRow + ROW_BASE; var row = tbl.tBodies[0].insertRow(nextRow); row.className = 'classy' + (iteration % 2); var cell0 = row.insertCell(0); var textNode = document.createTextNode(iteration); cell0.appendChild(textNode); var cell1 = row.insertCell(1); var txtInp = document.createElement('input'); txtInp.setAttribute('type', 'text'); txtInp.setAttribute('name', INPUT_NAME_PREFIX + iteration); txtInp.setAttribute('size', '77'); txtInp.setAttribute('value', val); txtInp.readOnly = true; cell1.appendChild(txtInp); } function addRowToTable(val,num) { var tbl = document.getElementById(TABLE_NAME); var nextRow = tbl.tBodies[0].rows.length; var iteration = nextRow + ROW_BASE; if (num == null) // appends to the end of the table { num = nextRow; } else // Insert at row num { iteration = num + ROW_BASE; } // add the row var row = tbl.tBodies[0].insertRow(num); // CONFIG: requires classes named classy0 and classy1 row.className = 'classy' + (iteration % 2); // CONFIG: This whole section can be configured // cell 0 - index var cell0 = row.insertCell(0); var textNode = document.createTextNode(iteration); cell0.appendChild(textNode); // cell 1 - input text var cell1 = row.insertCell(1); var txtInp = document.createElement('input'); txtInp.setAttribute('type', 'text'); txtInp.setAttribute('name', INPUT_NAME_PREFIX + iteration); txtInp.setAttribute('size', '62'); txtInp.setAttribute('value', val); // iteration included for debug purposes txtInp.readOnly = true; cell1.appendChild(txtInp); // cell 2 - delete button //----------------------- var cell2 = row.insertCell(2); var btnEl = document.createElement('input'); btnEl.setAttribute('type', 'button'); btnEl.setAttribute('value', 'Delete'); btnEl.onclick = function () {deleteCurrentRow(this)}; cell2.appendChild(btnEl); // Store the myRow object in each row row.myRow = new myRowObject(textNode,txtInp); } function paintTable(index) { var maxLine=index+MAXLENGTH; clearTable(0); // add Row with delete and insert options //---------------------------------------- services=document.forms[0].items.value; if ((services != null) && (services != "")) { var services_array=services.split("|"); sLength=services_array.length ; if (services_array.length < maxLine) maxLine=sLength; // add Row with delete options //----------------------------- for (var i=index; i < maxLine; i++) { val=services_array[i]; //showRow(1,val); addRowToTable(val); } showLabel(index,sLength); } } function showLabel(index,max) { clearTable(1); next_val=index+MAXLENGTH; prev_val=index-MAXLENGTH; var tbl = document.getElementById(LABEL_NAME); var nextRow = tbl.tBodies[0].rows.length; // add Previous and/or Next buttons //--------------------------------- var row = tbl.tBodies[0].insertRow(nextRow); var celNo=0; if (index !=0) { var cell0 = row.insertCell(celNo); var btnEl0 = document.createElement('input'); btnEl0.setAttribute('type', 'button'); btnEl0.setAttribute('value', 'Previous'); btnEl0.onclick = function () {paintTable(prev_val)}; cell0.appendChild(btnEl0); celNo++; } if (next_val <= max) { var cell1 = row.insertCell(celNo); var btnEl1 = document.createElement('input'); btnEl1.setAttribute('type', 'button'); btnEl1.setAttribute('value', 'Next'); btnEl1.onclick = function () {paintTable(next_val)}; cell1.appendChild(btnEl1); } } // end hiding from old browsers --> </script> </script> </head> <body onLoad=paintTable(0)> <form onSubmit="return false" method="post" name="my_form" action=""> <table border= "2" cellspacing="0" id="items_list" > <tbody></tbody> <input type=hidden name="items" value="1|2|3|4|5|6|7|8|9|10|11"> </table> <P><P><table border="1" id="label_list"> <tbody></tbody> </form> </body> </html> Please, help me! Thanks Hello all, Just quick question: 1.) I am on Blogger and I want the layout to be centered (not the text). How can I achieve this? 2.) I have 4 containers (navigation at top, main for posts, sidebar for more navigation, and a footer), what is the best way to have a width that looks great/compatible on IE-FF as well as smaller CRT's to widescreen LCD's? 3.) Any other tips/suggestions/clean up on my coding would be much appreciated. Thanks in advance, I apologize if this is a bit much... Code: body { background:$bgcolor; background-image: url(); background-repeat: repeat; background-attachment: fixed; margin:0; color:$textcolor; font:x-small Georgia Serif; font-size/* */:/**/small; font-size: /**/small; text-align: center; } a:link { color:$linkcolor; text-decoration:none; } a:visited { color:$visitedlinkcolor; text-decoration:none; } a:hover { color:$titlecolor; text-decoration:underline; } a img { border-width:0; } /* Header ----------------------------------------------- */ #header-wrapper { margin:0 2% 10px; border:0px solid $bordercolor; width: 1072px; } #header-inner { background-position: center; margin-$startSide: auto; margin-$endSide: auto; } #header { margin: 5px; border: 0px solid $bordercolor; text-align: center; color:$pagetitlecolor; } #header h1 { margin:5px 5px 0; padding:15px 20px .25em; line-height:1.2em; text-transform:uppercase; letter-spacing:.2em; font: $pagetitlefont; } #header a { color:$pagetitlecolor; text-decoration:none; } #header a:hover { color:$pagetitlecolor; } #header .description { margin:0 5px 5px; padding:0 20px 15px; text-transform:uppercase; letter-spacing:.2em; line-height: 1.4em; font: $descriptionfont; color: $descriptioncolor; } #header img { margin-$startSide: auto; margin-$endSide: auto; } #newnavbar { position: absolute; width: 1072px; height: 50px; margin: 0 auto; margin-top: 0px; font-weight: normal; background: url("")no-repeat; } #newnavbar a{ color:#000000; } #newnavbar a:hover{ color:#ff9900; } /* Outer-Wrapper ----------------------------------------------- */ #outer-wrapper { position: absolute; margin: 0 auto; padding:10px; width: 1072px; text-align:$startSide; font: $bodyfont; } #wrap2 { width: 1072px; } #main-wrapper { background:#000000; margin: 0 auto; width: 672px; float: left; display: inline; /* fix for doubling margin in IE */ word-wrap: break-word; /* fix for long text breaking sidebar float in IE */ overflow: hidden; /* fix for long non-text content breaking IE sidebar float */ } #sidebar-wrapper { background:#000000; margin: 0 auto; width: 400px; float: right; display: inline; /* fix for doubling margin in IE */ word-wrap: break-word; /* fix for long text breaking sidebar float in IE */ overflow: hidden; /* fix for long non-text content breaking IE sidebar float */ } /* Headings ----------------------------------------------- */ h2 { margin:1.5em 0 .75em; font:$headerfont; line-height: 1.4em; text-transform:uppercase; letter-spacing:.2em; color:$sidebarcolor; } /* Posts ----------------------------------------------- */ h2.date-header { margin:1.5em 0 .5em; } .post { margin:.5em 0 1.5em; border-bottom:1px dotted $bordercolor; padding-bottom:1.5em; } .post h3 { margin:.25em 0 0; padding:0 0 4px; font-size:140%; font-weight:normal; line-height:1.4em; color:$titlecolor; } .post h3 a, .post h3 a:visited, .post h3 strong { display:block; text-decoration:none; color:$titlecolor; font-weight:normal; } .post h3 strong, .post h3 a:hover { color:$textcolor; } .post p { margin:0 0 .75em; line-height:1.6em; } .post-footer { margin: .75em 0; color:$sidebarcolor; text-transform:uppercase; letter-spacing:.1em; font: $postfooterfont; line-height: 1.4em; } .comment-link { margin-$startSide:.6em; } .post img { padding:4px; border:1px solid $bordercolor; } .post blockquote { margin:1em 20px; } .post blockquote p { margin:.75em 0; } /* Comments ----------------------------------------------- */ #comments h4 { margin:1em 0; font-weight: bold; line-height: 1.4em; text-transform:uppercase; letter-spacing:.2em; color: $sidebarcolor; } #comments-block { margin:1em 0 1.5em; line-height:1.6em; } #comments-block .comment-author { margin:.5em 0; } #comments-block .comment-body { margin:.25em 0 0; } #comments-block .comment-footer { margin:-.25em 0 2em; line-height: 1.4em; text-transform:uppercase; letter-spacing:.1em; } #comments-block .comment-body p { margin:0 0 .75em; } .deleted-comment { font-style:italic; color:gray; } .feed-links { clear: both; line-height: 2.5em; } #blog-pager-newer-link { float: $startSide; } #blog-pager-older-link { float: $endSide; } #blog-pager { text-align: center; } /* Sidebar Content ----------------------------------------------- */ .sidebar { color: $sidebartextcolor; line-height: 1.5em; } .sidebar ul { list-style:none; margin:0 0 0; padding:0 0 0; } .sidebar li { margin:0; padding-top:0; padding-$endSide:0; padding-bottom:.25em; padding-$startSide:15px; text-indent:-15px; line-height:1.5em; } .sidebar .widget, .main .widget { border-bottom:1px dotted $bordercolor; margin:0 0 1.5em; padding:0 0 1.5em; } .main .Blog { border-bottom-width: 0; } /* Profile ----------------------------------------------- */ .profile-img { float: $startSide; margin-top: 0; margin-$endSide: 5px; margin-bottom: 5px; margin-$startSide: 0; padding: 4px; border: 1px solid $bordercolor; } .profile-data { margin:0; text-transform:uppercase; letter-spacing:.1em; font: $postfooterfont; color: $sidebarcolor; font-weight: bold; line-height: 1.6em; } .profile-datablock { margin:.5em 0 .5em; } .profile-textblock { margin: 0.5em 0; line-height: 1.6em; } .profile-link { font: $postfooterfont; text-transform: uppercase; letter-spacing: .1em; } /* Footer ----------------------------------------------- */ #footer { width: 1072px; clear:both; margin:0 auto; padding-top:15px; line-height: 1.6em; text-transform:uppercase; letter-spacing:.1em; text-align: center; } #rec{ width: 400px; height: 35px; background: url("")no-repeat; } #cat{ width: 400px; height: 30px; background: url("")no-repeat; } #aut{ width: 400px; height: 35px; background: url("")no-repeat; } #new{ width: 400px; height: 35px; background: url("")no-repeat; } #bar{ width: 400px; height: 22px; background: url("")no-repeat; } /** Page structure tweaks for layout editor wireframe */ } body#layout #header { margin-$startSide: 0px; margin-$endSide: 0px; } ]]></b:skin> </head> <body> <div id='outer-wrapper'><div id='wrap2'> <!-- skip links for text browsers --> <span id='skiplinks' style='display:none;'> <a href='#main'>skip to main </a> | <a href='#sidebar'>skip to sidebar</a> </span> <div id='header-wrapper'> <b:section class='header' id='header' maxwidgets='5' showaddelement='yes'> <b:widget id='Header1' locked='true' title=' (Header)' type='Header'/> <b:widget id='HTML6' locked='false' title='Navigation' type='HTML'/> </b:section> </div> <div id='content-wrapper'> <div id='crosscol-wrapper' style='text-align:center'> <b:section class='crosscol' id='crosscol' showaddelement='yes'/> </div> <div id='sidebar-wrapper'> <b:section class='sidebar' id='sidebar' preferred='yes'> <b:widget id='HTML2' locked='false' title='WELCOME' type='HTML'/> <b:widget id='HTML3' locked='false' title='MEMBERS' type='HTML'/> </b:section> </div> <div id='main-wrapper'> <b:section class='main' id='main' showaddelement='yes'> <b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/> </b:section> </div> <!-- spacer for skins that want sidebar and main to be the same height--> <div class='clear'> </div> </div> <!-- end content-wrapper --> <div id='footer-wrapper'> <b:section class='footer' id='footer'> <b:widget id='HTML1' locked='false' title='Content' type='HTML'/> </b:section> </div> </div></div> <!-- end outer-wrapper --> </body> </html> Code: <table border="0" width="900" cellspacing="0" cellpadding="0"> <tr> <td> Text part 1</td> <td> Text Part 2</td> </tr> </table> Hi All i have the above piece of code which shows a 2 colum table. How can i set the widths of my cols to match the width of the text that is in it? I.e set col 1 to the width of text that is in it ( will not always be same length) and have cols 2 start as soon as this finishes. Im assuming this is a simple thing to do but im just not sure. Basically what I want is a floating table head that follows you around when you scroll the table. Did all that, but the problem is that you need to cut out the head of the table to make it float. The problem comes where you have a table that has no column width set so the column width is determined by the content of tbody. I'm trying to make the browsers keep rendering the entire table, but hide the tbody so the columns won't loose their widths. It works fine in Mozilla and Opera, but IE has problems. Here is the code: HTML Code: <html> <head> <style type="text/css"> table { border-collapse: collapse; } tbody td { line-height: 0px; visibility: hidden; } </style> </head> <body> <table id="table_test" border="0" cellpadding="0" cellspacing="0" style="background-color: red;"> <thead> <tr> <th>column1</th> <th>column2</th> <th>column3</th> <th>column4</th> <th>column5</th> <th>column6</th> <th>column7</th> </tr> </thead> <tbody> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>jaz sem pa daljsi tekst jaz sem pa daljsi tekst jaz sem pa daljsi tekst</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> <tr> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>nekaj</td> <td>pac</td> <td>mora</td> <td>mora</td> </tr> </tbody> </table> </body> </html> And the result can be seen in the attached picture. Any ideas how to solve this or another way to preserve the thead column widths? I will be brief in hoping that the issue does not require a thesis to properly fix. I'm dealing with tables within tables..within tables. In one instance, I have a 2x1 (row by column) table inside another table. So, we'll call the inside table "B" and the outside table "A". Table B is centered inside a column in Table A. I'm trying to maximize the space, but nearly nothing works. Setting Table B height=100% does nothing. The only thing that works is setting the height=N px, where N is a number. This is no good, as I want to the site to work on all resolutions. I want it to be proportional. How can I fix this? Here's what I'm dealing with, visually: Any help would be welcome. Thanks. |