Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 2nd, 2007, 1:22 AM   #1
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 420
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Question <td> height problem

Ok let me set up the problem:
<table>
	<tr>
		<td>
			<!-- Content 1 -->
		</td>
		<td rowspan="2">
			<!-- Content 2 -->
		</td>
	</tr>
	<tr>
		<td>
			<!-- Content 3 -->
		</td>
	</tr>
</table>
Alright so the problem here is that the section labelled as Content 3 should only be a single line in height (obviously this will change if the table's width on the page is adjusted due to a window resize or something). Content 1 and Content 2 are multiline. The problem I'm having is that I don't know how to keep Content 3 as a single line cell when the table height is changing. Suggestions? Whether they're HTML or CSS is fine, though CSS would be optimal. It would also be good if the solution were compatible across Opera/Firefox/IE.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old May 2nd, 2007, 1:35 AM   #2
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Ok, I think I see what you are getting at. Just give the td tag (of content 3) a height property. Seems simple I know, but is that the answer? If not I don't understand what you are saying.
Booooze is offline   Reply With Quote
Old May 2nd, 2007, 1:39 AM   #3
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 420
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Well this is currently what I'm doing in CSS:
td.timestamp {
	height: 1px;
	text-align: right;
	padding-right: 6px;
	vertical-align: bottom;
	border: 1px #444444 solid;
	border-left: none;
	width: 200px;
}
where the content 3 tag's would be identified as class timestamp
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old May 2nd, 2007, 1:47 AM   #4
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
Quote:
Originally Posted by grimpirate View Post
Ok let me set up the problem:
<table>
	<tr>
		<td>
			<!-- Content 1 -->
		</td>
		<td rowspan="2">
			<!-- Content 2 -->
		</td>
	</tr>
	<tr>
		<td>
			<!-- Content 3 -->
		</td>
	</tr>
</table>
Alright so the problem here is that the section labeled as Content 3 should only be a single line in height (obviously this will change if the table's width on the page is adjusted due to a window resize or something). Content 1 and Content 2 are multi line. The problem I'm having is that I don't know how to keep Content 3 as a single line cell when the table height is changing. Suggestions? Whether they're HTML or CSS is fine, though CSS would be optimal. It would also be good if the solution were compatible across Opera/Firefox/IE.
I'm not 100% sure on this but I know that if you have a table row (tr) and then a Table Data (td) in that, each row has to have the same number of tds you can't have 1 in the first row, 2 in the second and 3 in the third. At least that is my knowledge of HTML. You could set the height of cell as a static value. If that doesn't work you could also put in a visible statement with that. With the Visible statement you make it so that if it is multiline it will only show the first line, or put in a scroll bar, it's kinda like Iframes but a hell of lot better. Don't take what I am saying as 100% truth for I make mistakes all the time.
PhilBon is offline   Reply With Quote
Old May 2nd, 2007, 2:00 AM   #5
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 420
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Quote:
Originally Posted by PhilBon View Post
I'm not 100% sure on this but I know that if you have a table row (tr) and then a Table Data (td) in that, each row has to have the same number of tds
Note the rowspan attribute in the content 2 td tag
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old May 2nd, 2007, 8:52 AM   #6
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
my bad, I understand now. But who ever made the table setup (creator of HTML), I think they should have not aloud that since the whole idea of tables seems to be to make a uniformed setup and that isn't uniformed, at least IMO.
PhilBon is offline   Reply With Quote
Old May 2nd, 2007, 12:38 PM   #7
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Quote:
Originally Posted by PhilBon View Post
my bad, I understand now. But who ever made the table setup (creator of HTML), I think they should have not aloud that since the whole idea of tables seems to be to make a uniformed setup and that isn't uniformed, at least IMO.
I disagree with that. I can't think how many times I needed to span an extra cell or so. Remember that at one point in time, tables were used for layouts. That method has long since been scrutinized and is now no longer really "accepted" in today's society without being flamed.
Booooze is offline   Reply With Quote
Old May 2nd, 2007, 2:00 PM   #8
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 420
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
I figure a pictorial approach might help to understand what I'm trying to achieve.

IE produces this result (incorrect and it just arbitrarily size the cell heights):
IE Table
Opera produces this result (incorrect but it only uses as much as necessary to fit the first cell height and then the second takes up all the rest):
Opera Table
FireFox produces this result (which is correct and I would like to reproduce in the other browsers):
FireFox Table
Actual html:
http://grimbb.phpnet.us/row_h.html
Attached Images
File Type: gif ie_table.gif (10.8 KB, 24 views)
File Type: gif opera_table.gif (6.0 KB, 18 views)
File Type: gif ff_table.gif (5.8 KB, 16 views)
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis

Last edited by grimpirate; May 2nd, 2007 at 2:20 PM.
grimpirate is offline   Reply With Quote
Old May 2nd, 2007, 4:15 PM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
You are calling one result correct and others incorrect. What is your authority for that?

The fact that some container doesn't have some attribute supplied does not mean that the attribute is zero. Browser makers determine a set of default attributes that THEY think is suitable, even if another browser manufacturer thinks differently. Simply compare paragraph spacing in Firefox and IE to see what I mean.

One of the things you can do with table cells is specify the vertical and horizontal alignments. The defaults may not be what you want. Another thing you can do is specify heights.

It isn't at all clear what you expect, since you think Firefox is "right" by taking more room to display "lorem ipsum" than it is for "Suspendisse vitae".
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 2nd, 2007, 10:01 PM   #10
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 420
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
I'm not implying that one browser is doing things correctly as opposed to the other. I'm saying Firefox is right, based on the visual representation that I wish to achieve. It automatically/intrinsically achieves the single line cell height that I'm looking for and I'd like to know how to achieve that in the other browsers. As I stipulated in the original post I'm looking for a cross-browser solution. If I believed Firefox were correct I would simply dismiss the other browsers. My authority is defined by the parameters of the problem. I wasn't making any sort of stipulation that one browser is "superior" to the next.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
class problem brad sue C++ 0 Oct 21st, 2006 6:49 PM
100% Table Height using Firefox hoffmandirt ASP.NET 2 Jun 23rd, 2006 9:34 AM
Problem Associated with Vector Source code buggytoast Java 3 Apr 2nd, 2006 5:41 AM
cgi/perl script + IE problem joyceshee Perl 2 Jan 24th, 2006 11:10 AM
Variable array problem Hintshigen C 6 Apr 10th, 2005 2:35 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:27 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC