jackpf Posted May 1, 2009 Share Posted May 1, 2009 Good evening all, Ok, this a bit of a weird question. If there's a really simple answer (which there probably is) I will bow down in shame. Basically, I want to align half of a table cell to the top, and the other half to the bottom. So, like this: _____________________________________ Some text on the top. | | | | | Some text on the bottom | _____________________________________| The only way I can think of doing this is creating another table within that table cell, but that's a pretty stupid solution. I try and use as few tables as possible. Any help is appreciated. Thanks, Jack. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/ Share on other sites More sharing options...
gnawz Posted May 1, 2009 Share Posted May 1, 2009 Check valign properties or use align = absbottom/ abstop, etc Hope it helps Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-823795 Share on other sites More sharing options...
Ken2k7 Posted May 1, 2009 Share Posted May 1, 2009 I believe valign is deprecated. It's vertical-align. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-823796 Share on other sites More sharing options...
jackpf Posted May 1, 2009 Author Share Posted May 1, 2009 Yeah...but the thing is, aligning the cell will result in everything within that cell becoming aligned. I need to align some text to the top, and some to the bottom, which is the problem. Thanks for your suggestions though. There surely must be a way to do this... Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-823806 Share on other sites More sharing options...
gnawz Posted May 1, 2009 Share Posted May 1, 2009 Use What i gave you to align some text top and others bottom Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-823830 Share on other sites More sharing options...
TheFilmGod Posted May 1, 2009 Share Posted May 1, 2009 Use absolute positioning. Make the table cell relative? - Or add a wrapper div. My question - why? If this is tabular data, you should only have one piece of data in one cell. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-823840 Share on other sites More sharing options...
jackpf Posted May 1, 2009 Author Share Posted May 1, 2009 Yeah, I tried that. The text that is positioned absolute is all displayed on top of eachother, even though the cells have a relative position. And it's for my forum Much like this one, there are edit (not for this particular forum) and delete links underneath your post. However, if your image/name that is displayed next to your post is taller than the actual post, the edit/delete links will be floating around in the middle of the table cell. I was just trying to figure out how to force it to the bottom of the cell. Here's one of the pages I was trying this on - http://www.jackpf.co.uk/index.php?action=profile&status=profile&profile=message&alias=jackpf Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-823845 Share on other sites More sharing options...
Ken2k7 Posted May 1, 2009 Share Posted May 1, 2009 Oh, do you know why it does that? In a table row, if one cell is longer than the others in the row, then they all auto adjust to that height. If you look at the left, where the name etc are, then you can see that it usually extends well beyond the post. That's why. Most forums have this layout, like here on PHPFreaks. But most forums use tables. Here on PHPFreaks, they use DIVs, which is fine. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-823846 Share on other sites More sharing options...
jackpf Posted May 1, 2009 Author Share Posted May 1, 2009 Yeah...that's why I want to force the edit/delete etc to the bottom on posts/messages with the left cell longer than the content. There must be a way. Wow, I thought this forum used tables. I don't think I quite have that kind of skill yet Maybe one day. EDIT: Oh...they only use tables for the topic views or whatever. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-823851 Share on other sites More sharing options...
Axeia Posted May 1, 2009 Share Posted May 1, 2009 Not quite sure what you're trying to do, but position: relative on the container and position: absolute; bottom: 0; on a wrapper around the links? Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-823856 Share on other sites More sharing options...
jackpf Posted May 2, 2009 Author Share Posted May 2, 2009 Yeah, that doesn't work. I don't know if it's something about table cells, but it doesn't hold its relative position. And if I do it with a div, the div doesn't expand to the full height of the table cell, so it's pretty pointless. Urgh, this is so frustrating. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-823897 Share on other sites More sharing options...
perrij3 Posted May 4, 2009 Share Posted May 4, 2009 I'm no where near an expect on this topic, but this may or may not be valid. I was just wondering if when you use the relative positions with divs, if you could use the clear="both" in CSS or add it to a <br clear="all"> after your div. Maybe that would stop them from appearing on top of each other. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-825303 Share on other sites More sharing options...
jackpf Posted May 4, 2009 Author Share Posted May 4, 2009 No...can't seem to get that to work either. Thanks for the suggestion though. I'm starting to think this is actually impossible... Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-825461 Share on other sites More sharing options...
TheFilmGod Posted May 4, 2009 Share Posted May 4, 2009 The solution is simple. Don't use tables. Obviously the data is not tabular, and therefore there should be no reason why you would use such primitive ways to relay your information. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-826222 Share on other sites More sharing options...
Ken2k7 Posted May 4, 2009 Share Posted May 4, 2009 Well he can use a table. <table id="something"> <tr> <td class="row1" rowspan="2">SOME VERY LONG INFORMATION LIKE A FORUM'S MINI-PROFILE AT THE LEFT. YOU MAY WANT A TABLE INSIDE HERE.</td> <td class="row2">SOME SHORT TEXT. YOU MAY WANT A TABLE IN HERE.</td> </tr> <tr> <td class="row3">SIGNATURE. YOU MAY WANT A TABLE IN HERE.</td> </tr> </table> CSS: #something { table-layout: fixed; width: 150px; } .row1 { overflow: hidden; vertical-align: top; width: 150px; } .row2 { vertical-align: top; width: 80%; height: 100%; } .row3 { vertical-align: bottom; width: 80%; } Is there rowspan for CSS? Would that not generate the result? Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-826252 Share on other sites More sharing options...
jackpf Posted May 5, 2009 Author Share Posted May 5, 2009 I probably will eventually one day switch over to divs. However, using tables requires much less code, and is more suited to the way the contents should be displayed. And Ken2k7...couldn't quite get that code to work. Cheers though. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-826600 Share on other sites More sharing options...
Ken2k7 Posted May 5, 2009 Share Posted May 5, 2009 Can you post what you have? Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-826729 Share on other sites More sharing options...
TheFilmGod Posted May 5, 2009 Share Posted May 5, 2009 However, using tables requires much less code, and is more suited to the way the contents should be displayed. Less code? You are 100% wrong on this one. Tables will always require more code. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-826872 Share on other sites More sharing options...
Ken2k7 Posted May 5, 2009 Share Posted May 5, 2009 Less code? You are 100% wrong on this one. Tables will always require more code. jackpf - that's not to say that you shouldn't ever use tables. There are situations where tables are needed. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-826874 Share on other sites More sharing options...
TheFilmGod Posted May 5, 2009 Share Posted May 5, 2009 Less code? You are 100% wrong on this one. Tables will always require more code. jackpf - that's not to say that you shouldn't ever use tables. There are situations where tables are needed. That's true. I'm no discouraging the use of tables. You should never use css/divs to emulate tables: tabular data should always be in a data. However, tables should rarely be used. Even a calendar - tabular-like data - could be placed in an unordered list - better yet, a definition list. In nearly all cases, properly coded tables will always require more code than pure css. You need to explicately specify tr td and don't forgot the tbody or thead for semantics. In css, you can control how individual elements are positioned. Jackpf - this is a good time to start studying css! I'm more than willing to help you code the html/css. I hope to convert all table designers to the realm of pure css design. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-826887 Share on other sites More sharing options...
jackpf Posted May 6, 2009 Author Share Posted May 6, 2009 Ok...well probably the thing that discouraged me the most from switching my forum over to divs, is the fact that floats cannot have a percentage width. The design of my site now uses a width of 100% as the container, so I can't define what the actual width of the forum will be on all screens (with different resolutions and stuff). Table cells allow you to define stuff like width: 25% or whatever, but with floated divs, it only seems that you can set a wisth in px, not %. So I don't really see how it's possible to use divs for my forum... However, if you know a way round this I'd be ecstatic to hear it I would happily switch over to divs. I just don't see how it's possible... Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-827371 Share on other sites More sharing options...
jackpf Posted May 12, 2009 Author Share Posted May 12, 2009 Hey, I forgot about this. And no, IDK, no joy anyway. I had a go at redesigning my forum with pure CSS...didn't go too well. Might have another go later. Quote Link to comment https://forums.phpfreaks.com/topic/156446-table-aligns/#findComment-832440 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.