CSS - Absoulte Positioning Breaks Up Table
When i use the css to position an table absoultly it "breaks apart" the table.
I tried placing the style in the <table> tag and in a <div> wrapped around the table. If anyone knows how to fix this let me know. I just tried it in internet explorer and it looks good. so it is only breaking apart in firefox Here is the css class I am using. .nav { position: absolute; top: 70px; left: 770px; z-index: 5; } Thanks for any help Similar TutorialsI have a dynamic table that is in the cell of another table. For the life of me I cant get it to stick to the top of the cell. It wants to sit at the midline of it vertically. Thanks for reading. After much trial and error, I have the following: Code: <form> <div1> <table1> </table> <table2> </table> <table3> </table> </div> <div2> <table4> </table> <table5> </table> <table6> </table> </div> </form> div1 is has relative positioning and a bottom margin of 50px. All tables have a bottom margin keeping them apart. Regardless of how many tables there are in div1, div2 is always 50px below it. All tables in Div1 and the first table in div2 are generated by the system, subsequent tables in div2 are generated by the user clicking a button. If the user creates a new table, how do I position below table1? Will any newly created tables automatically appear below the bottom table in div2? Any guidance on this would be great. I have an HTML table and I am trying to use a CSS repeating vertical background for part of the table. It looks fine, but there is some small spacing that appears in IE (Not in Firefox) between image "links_background_top.png" and the div element. There is no spacing between the div element and the bottom image "links_background_bottom.png" Any ideas why this is and how to fix this? Thanks, Luis Code: <html> <head> <style> #links_background_repeat { background-image: url(links_background_repeat.png); background-repeat: repeat-y; height: 4px; width: 705px; border-width: 0px; margin: 0px; top-margin:0px; bottom-margin:0px; padding: 0px;} </style> </head> <body> <table cellpadding="0" cellspacing="0" border="0" vspace="0" hspace="0"> <tr> <td> <img src="links_background_top.png" width="705" height="37" hspace="0" vspace="0" border="0" /> <div id="links_background_repeat">blah blah blah<BR />blah blah blah</div> <img vspace="0" hspace="0" src="links_background_bottom.png" width="705" height="18" border="0" /> </td> </tr> </table> </body> </html> Hi, Have a problem with a left-hand table, the content of which is dragged down the page when the right-hand table grows in the same direction, say when filling it with content. I need to anchor that left-hand table in place but allow the right-hand table to stretch vertically. Have tried absolute CSS positioning, spacers, extra tables, 100% height - nothing seems to work. I've simplified the HTML code for readability, but the general layout is pretty much intact: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table width="668" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="49" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="667" height="49"> </td> </tr> </table></td> <td width="1"></td> </tr> <tr> <td width="147" rowspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="147" height="147"> </td> </tr> </table></td> <td width="520" height="32" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="520" height="32"> </td> </tr> </table></td> <td></td> </tr> <tr> <td height="24" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="520" height="24"> </td> </tr> </table></td> <td></td> </tr> <tr> <td rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="517" height="419" valign="top"><div align="center">RIGHT-HAND TABLE </div></td> </tr> </table></td> <td height="91"></td> </tr> <tr> <td height="328" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="146" height="328" valign="top"><div align="center">LEFT-HAND TABLE </div></td> </tr> </table></td> <td></td> </tr> <tr> <td height="482"> </td> <td> </td> <td></td> </tr> </table> </body> </html> Thanks, Dyb I am trying to set a table to sit on the bottom of the browser at all times, like a hovered BG image. Anyone know how to do this? I've tried this but I obliviously don't know what i'm doing #grass { position:absolute; bottom:100% background-repeat: no-repeat; background-position: 0px -0px; } (it's a landscaping website, i want grass on the bottom on the screen) Hello, I am very new to CSS, having only used stylesheets for basic formatting of text, etc. I have created a site where the layout is based on tables (I know ... when I have spare time, I will start learning CSS for this). I have a main table with 1 row and 1 column, height 95%, width 100%. Within this I have a table with a fixed layout (set height, width) for the table elements. This table is centre and middle aligned. Unfortunately the text provided for one of the cells in the table is exceeding the amount expected and the cell height has increased to accommodate for this. I thought of creating a layer and placing it over the cell and inserting the text here and setting the overflow to scroll. However, depending on screen resolution, browser the layer is not always positioned where I want it. Can I somehow position the layer relative to the table cell ? If not, do you have any suggestions as to what I can do to fix this. I do not have the option to rewrite the site using CSS, due to deadlines. Thanks in advance for your help. Bea Hi everyone- I'm a rank beginner at CSS and am trying to figure out the whole positioning thing -- you know, the stuff that was generally a no-brainer using tables back in the day. :-) For learning purposes, I'm trying to do this with only CSS and no tables. So, here's my problem. I'm creating a simple two-row layout. The first row contains two columns, and the second/bottom row contains only one. I'm trying to make sure the bottom row always remains below the longest of the two columns in the row above it. With the code below, I can cut text from the left column and the bottom row maintains position. If I cut from the right, however, the bottom row moves up and is partially hidden under the left column. I've tried using both absolute and relative positioning for the bottomRow DIV, but no luck. I'm sure this is probably something simple that I'm just not getting. Any thoughts? Thanks in advance... - Tom Tedeschi Code: <style type="text/css" title="theStyle" media="screen"> /* <![CDATA[ */ #leftCol { background: #c0c0c0; position: absolute; top: 1px; width: 250px; height: auto; border-top-style: solid; border-top-width: 1px; border-right-style: solid; border-right-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; border-left-style: solid; border-left-width: 1px; } #centerCol { background: #f7f7f7; position: relative; top: 1px; left: 250px; width: 250px; height: auto; border-top-style: solid; border-top-width: 1px; border-right-style: solid; border-right-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; border-left-style: solid; border-left-width: 1px; } #bottomRow { background: #929292; height: auto; border-top-style: solid; border-top-width: 1px; border-right-style: solid; border-right-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; border-left-style: solid; border-left-width: 1px; } /* ]]> */ </style> </head> <body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"> <div id="bigBox"> <div id="topRow"> <div id="leftCol"> <b>TopRow/LEFTCOL here </b>Si quid est in me ingeni, judices, quod sentio quam sit exiguum, aut si qua exercitatio dicendi, in qua me non infitior mediocriter esse versatum, aut si hujusce rei ratio aliqua ab optimarum artium studiis ac disciplina profecta, a qua ego nullum confiteor aetatis meae tempus abhorruisse, earum rerum omnium vel in primis hic A. </div> <div id="centerCol"> <b>TopRow/CENTERCOL here </b>Si quid est in me ingeni, judices, quod sentio quam sit exiguum, aut si qua exercitatio dicendi, in qua me non infitior mediocriter esse versatum, aut si hujusce rei ratio aliqua ab optimarum artium studiis ac disciplina profecta, a qua ego nullum confiteor aetatis meae tempus abhorruisse, earum rerum omnium vel in primis hic A. </div> </div> <div id="bottomRow"> <b>BottomRow here </b>Si quid est in me ingeni, judices, quod sentio quam sit exiguum, aut si qua exercitatio dicendi, in qua me non infitior mediocriter esse versatum, aut si hujusce rei ratio aliqua ab optimarum artium studiis ac disciplina profecta, a qua ego nullum confiteor aetatis meae tempus abhorruisse, earum rerum omnium vel in primis hic A. </div> </div> </body> </html> I'm trying to vertically align two divs inside a table cell. I have the cell's vertical-align property set to text-top because I want the first div to be aligned at the top of the td but I can't, no matter what I try, get the second div to align to the bottom. Is there a better way to accomplish this without nesting tables or is this the right way and I'm just missing something? I want to set up a table so that error messages appear directly above specific table columns in the form of a div tag with a red background and the same width as the column. To do this I've added a div tag inside the <th> element of the table, with the display property set to 'none'. Code: <th> <nobr>Header Content</nobr> <div id="error_message">Error Message</div> </th> When I want to display an error message above the table I use the following styles on the div tag Code: background-color: #ffcccc; width: 100%; position: relative; left: 0px; top: -100px; z-index: 1; display: block; It displays the div tag above the header like I want, but it still stretches the height of the <th> element as if it was still contained inside of it. How do I do this without stretching the cell height? Hello, I recently started creating websites again and I have been pulling my hair out on this Firefox compatibility issue. The site navigation looks great in IE but in Firefox a couple of the background images are skewed down and to the left. Since all my tricks from years ago are so outdated now, I decided to try CSS for a simplified navigation setup. The code is probably pretty messy since I chopped it together from numerous sources and still am not completely sure how it works. Background: I created a large 794x1200 PNG image that contains two complete border and navigation sets. I am using CSS to both position the appropriate portion in each table/cell as well as switching to a slice on the 2nd image set for rollover purposes. An example of the current test is he (URL address blocked: See forum rules) *not sure if this is okay but would be best to see the example. If it is not allowed as a non-clickable then feel free to delete. It is here - classtime . org / test6 . htm and the navigation image is he (URL address blocked: See forum rules) *classtime . org / navigate . png I would be eternally grateful to anyone that can help me figure out why the site works great in IE but is coming up skewed in Firefox. As a side note, when I pull up the site in Frontpage, it shows the left-most cell as being larger than it is supposed to be even though it is hardcoded. To get my left image bar to show up in the correct place I had to use a value of "left: -40px;" I'm not sure why that is but I suspect it has something to do with the problem. Thank you very much for taking a look. My jumbled code is as follows: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "(URL address blocked: See forum rules)"> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <title>Ultrasonic Blind Company - Elk Grove Village, Illinois</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <style type="text/css" media="screen"> a:link {color: #FFF4D1;} a:visited {color: #FFF4D1;} a:hover {color: #74060c;} a:active {color: #FFF4D1;} .top a { display: block; width: 794px; height: 120px; background-image: url('navigate.png'); } .top a:hover { background-position: 0px -601px; } #left { left: -40px; width: 150px; height: 460px; display: block; background: url('navigate.png'); background-repeat: no-repeat; background-position: 0px -120px; position: relative; } #left li {margin: 0px; padding: 0px; list-style: none; position: absolute; text-align: center; font: bold 18px Batang; line-height: 50px; } #left li, #left a {height: 50px; width: 146px; display: block;} #panel1b {top: 10px;} #panel2b {top: 63px;} #panel3b {top: 116px;} #panel4b {top: 169px;} #panel5b {top: 223px;} #panel1b a:hover {background: transparent url('navigate.png') 0px -730px no-repeat} #panel2b a:hover {background: transparent url('navigate.png') 0px -785px no-repeat} #panel3b a:hover {background: transparent url('navigate.png') 0px -839px no-repeat} #panel4b a:hover {background: transparent url('navigate.png') 0px -890px no-repeat} #panel5b a:hover {background: transparent url('navigate.png') 0px -945px no-repeat} #right { width: 154px; height: 460px; display: block; background: url('navigate.png'); background-repeat: no-repeat; background-position: -640px -120px; position: relative; } #right li {margin: 0px; padding: 0px; list-style: none; position: absolute; text-align: right; font: bold 18px Batang; } #right li, #right a {height: 85px; width: 154px; display: block;} #panel1r {top: 0px;} #panel2r {top: 100px;} #panel3r {top: 200px;} #panel4r {top: 300px;} #panel1r a:hover {background: transparent url('navigate.png') -640px -721px no-repeat} #panel2r a:hover {background: transparent url('navigate.png') -640px -821px no-repeat} #panel3r a:hover {background: transparent url('navigate.png') -640px -921px no-repeat} #panel4r a:hover {background: transparent url('navigate.png') -640px -1021px no-repeat} </style> </head> <body bgcolor=#74060c> <div align=center> <table id="Table_01" width=794px height=600px border=0 cellpadding=0 cellspacing=0> <tr> <td colspan="3" height="120" width="794" bgcolor="#FFF4D1"> <div class="top"> <a href="(URL address blocked: See forum rules)"></a> </div> </td> </tr> <tr> <td align=left valign=top height=674px width=150px bgcolor="#FFF4D1"> <ul id="left"> <li id="panel1b"><a href="(URL address blocked: See forum rules)" style="text-decoration: none">Contact</a></li> <li id="panel2b"><a href="(URL address blocked: See forum rules)" style="text-decoration: none">Residential</a></li> <li id="panel3b"><a href="(URL address blocked: See forum rules)" style="text-decoration: none">Commercial</a></li> <li id="panel4b"><a href="(URL address blocked: See forum rules)" style="text-decoration: none">Coupons</a></li> <li id="panel5b"><a href="(URL address blocked: See forum rules)" style="text-decoration: none">Questions</a></li> </ul> </td> <td align=left valign=top width=490px height=674px bgcolor="#FFF4D1"> aaa</td> <td align=left valign=top width=154px height=674px bgcolor="#FFF4D1"> <p align=right> <ul id="right"> <li id="panel1r"><a href="(URL address blocked: See forum rules)" style="text-decoration: none"></a></li> <li id="panel2r"><a href="(URL address blocked: See forum rules)" style="text-decoration: none"></a></li> <li id="panel3r"><a href="(URL address blocked: See forum rules)" style="text-decoration: none"></a></li> <li id="panel4r"><a href="(URL address blocked: See forum rules)" style="text-decoration: none"></a></li> </ul> </td> </tr> </table> </div> </body> </html> I have a positioning puzzle for you. It's as part of a web design assignment, so broad accessibility is not required. even working on IE is not required. YES! here is the problem, explained by means of an image. because a picture speaks a thousand words. so they say. [IMG](URL address blocked: See forum rules)[/IMG] Any assistance or suggestions are welcome. Thanks in advance. Hi, I have centered a table horizontally and vertically. To do this I put a table inside a table. so i don't want to use absolute positioning, as the position would change if the window size changes... My problem, with relative positioning, is that I can't figure out how to put my "some text" over an image -which is inside the table cell- in the exact position i want, without "collateral damage"... The collateral damage is that if I put the <div> tag inside the table (see example 1), it will occupy the space and as result the image wll be moved down and layout won't be centered vertically anymore... If I put the <div> tag outside the table (see example 2), as result there will be more occupied space at the top, and the layout isn't centered anymore... Here you can see the code i used for both example 1 and example 2: example 1: <html> <head> <title>relative problem - example 1</title> </head> <body> <table width="100%" height=100% border="1"> <tr> <td width="100%" height="100%" align="center" valign="middle"> <table border=1> <tr> <td width="640" height="480"> <div id="Layer1" style="position:relative; left:50px; top:50px; width:50px; height:200px; text-align:left; overflow: auto; z-index:1;"> some text some text some text some text some text some text some text some text some text some text some text some text </div> <img src="http://www.pbworks.net/images/help.jpg" width="640" height="480"> </td> </tr> </table> </td> </tr> </table> </body> </html> example 2: <html> <head> <title>relative problem - example 2</title> </head> <body> <table width="100%" height=100% border="1"> <tr> <td width="100%" height="100%" align="center" valign="middle"> <div id="Layer1" style="position:relative; left:0px; top:200px; width:50px; height:200px; text-align:left; overflow: auto; z-index:1;"> some text some text some text some text some text some text some text some text some text some text some text some text </div> <table border=1> <tr> <td width="640" height="480"> <img src="http://www.pbworks.net/images/help.jpg" width="640" height="480"> </td> </tr> </table> </td> </tr> </table> </body> </html> thx for letting me know... I am desperate. I think I found a bug in Firefox, and I'm not sure how to work around it. The following code works in everything (IE 8, Chrome, Safari, Opera) except Firefox (version 3.6.3). Am I doing something wrong, or is this a bug in Firefox? You can look what happens to the drop-down menu's on Menu 2 and 3 live by going to my site (deenfoxx dot com slash firefox-bug dot html). css Code: Original - css Code #main-nav { background-color: black; height: 40px; } #nav { position: relative; margin: 0; padding: 0; } #nav li { position: relative; float: left; display: table; width: 99px; height: 40px; border-right: 1px solid white; text-align: center; font-size: 10px; } #nav li:hover { background-color: darkred; } #nav a { display: table-cell; vertical-align: middle; line-height: 11px; font-weight: bold; text-decoration: none; color: #fff; } #nav li ul { position: absolute; padding: 0; background-color: gray; top: 40px; left: 0px; } #nav li ul li { width: 98px; border: 0; border-top: 1px solid white; } #main-nav html4strict Code: Original - html4strict Code <div id="main-nav"> <ul id="nav"> <li id="m1"><a href="#1">Main Menu 1</a></li> <li> <a href="#2">Main Menu 2</a> <ul> <li><a href="#2a">Sub-Category 1</a></li> <li><a href="#2b">Sub-Category<br/>with multiple lines</a></li> </ul> </li> <li> <a href="#3">Main Menu 3 with multiple lines</a> <ul> <li><a href="#3a">Sub-Category 2</a></li> </ul> </li> <li><a href="#4">Main Menu item which has a really long name on it</a></li> </ul> </div> <div id="main-nav"> The problem appears to be that "#nav li" happens to have position:relative; and a display:table; and "#nav li ul" is position:absolute;. Normally, absolute positioning requires its parent or ancestor position to be set, but when used with the table display, it doesn't work normally on Firefox--but it does on other browsers. Can someone help me with a workaround that does not involve altering the HTML? If I must, I will accept a workaround that requires changing the HTML, but I'll have to do some heavy duty recoding of Magento's core menu generation. Anyone that knows Magento knows I want to avoid that like the plague--my example is a very simplified version of the problem. I've been working on putting a css/js text navigation together which thus far has seemed to work as intended on a PC. This morning when I checked it on a mac, it broke down. Technically it breaks down gracefully I suppose... All links are present and the nav is displayed fully expanded. The problem is that this nav is going to have hundreds of links, and having it fully expanded just isn't practical. If anyone could take a minute to look at my css & js to see if there's something simple that I'm missing, it'd be great. You can look at my example page he http://www.whitesagemedia.com/cssnav.html All css & js is included in the ssource - no attachements. Thank you, thank you, thank you, to anyone who can help me out. -Chet Hey there. Is it possible to add a line break so that the following markup... html Code: Original - html Code <dl> <dt>Posts:</dt> <dd>33</dd> <dt>Topics:</dt> <dd>4</dd> </dl> <dl> <dt>Posts:</dt> <dd>33</dd> <dt>Topics:</dt> <dd>4</dd> </dl> ...looks like this? Posts: 33 Topics: 4 Basically, I want it to be like display: block, but only to the RIGHT of the text. Does that make sense? Just like adding a <br />, but with different HTML. Ok people, I have a page that contains 2 tables, one beneath the other... The table at the top can vary in height, but the table at the bottom is of fixed height... What I want to do is put some sort of "page break" in, so that the second table is always printed on a second piece of paper... Any ideas anyone? Hi: I have a MySQL/PHP generated form letter which gets printed and mailed. I have extablished a CSS font (class?) with a "page-break after" parameter as shown he PHP Code: h4 { font-family: Arial, Sans-serif; font-size: 14px; font-weight: 500; text-align: left; page-break-after: always;} This works great on a PC running IE. However, On a Mac, running OSX, the page breaks are entirely ignored and it is printed as a single long page. I have tried using other Browsers (Opera, Netscape, and Safari) and they all heve the same problem. Does anyone have a suggestion? Thanks Sean There must be a better way to accomplish this... I need a line break between the two headers in the page below. As it stands it works in Firefox and IE with <br> tags but this seems sloppy.....Is this what the clear element is for? Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <style> * { margin: 0; padding: 0; } body { margin:0; padding:0; background-color:#cccccc; } #wrapper { width: 700px; height: 565px; margin-left:auto; margin-right:auto; margin-top:10px; border: 1px solid #808080; background-color:#ffffff; } #sidebar { width: 123px; height: 565px; float: left; background-image:url(images/sidebar.jpg); } #content { margin-left: 125px; height: auto; width:auto; padding: 30px; font:Arial, Helvetica, sans-serif; font-size: 24px; font-style:oblique; color: #444444; } #01 { position:relative; } #02 { position:relative; margin-top:100px; } #b1w, #b2w, #b3w { position:relative; float:left; height:35px; width:35px; border:1px solid; border-color: #808080; margin-top: 5px; margin-right: 5px; background-color:#ffffff; } </style> <body> <div id="wrapper"> <div id="sidebar"></div> <div id="content"> <div id="01">Header 1</div> <div id="b1w"></div> <div id="b2w"></div> <div id="b3w"></div> <br><br><br> <div id="02">Header 2</div> </div> </div> </body> </html> The following is how I have always done my navigation. But in IE7 when I zoom above 100% the links seem to squash up and the hit area move away from the link! You can see this at www.stephaniedubois.co.uk What can I do to stop this? Thanks div id="topnavbar" class="navTextTop"> <ul> <li><a href="index.html">HOME</a></li> <li><a href="about.html">ABOUT</a></li> <li><a href="gallery.html">GALLERIES</a></li> <li><a href="exhibit.html">EXHIBIT</a></li> <li><a href="contact.html">CONTACT</a></li> </ul> </div> CSS #topnavbar { text-align: center; position: relative; top: -25px; margin: 0px; padding: 0px; } #topnavbar li { display: inline; } #topnavbar ul { list-style:none; } .navTextTop a:link, .navTextTop a:visited { font:11px/20px Verdana, Arial, Helvetica, sans-serif; color: #000000; text-decoration:none; letter-spacing: 0.13em; padding-left: 10px; padding-right: 10px; } .navTextTop a:hover { color: #000000; text-decoration:underline; } |