Results 1 to 23 of 23

Thread: CSS - forcing text at top of cell [resolved]

  1. #1

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090

    CSS - forcing text at top of cell [resolved]

    I have a table with two columns and one row.
    If the text in the right hand side column is very long and the text in the left hand column is very short, then the column with little text will move that text halfway down the column.
    Is there anyone to stop this? I think CSS is the way to go, but I've not managed to figure this out.
    Last edited by Acidic; Apr 27th, 2004 at 03:47 PM.
    Have I helped you? Please Rate my posts.

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Are thes cells fixed with a pixel size or in %?


    You could try to set the the vertical alignment to "center" in the <td> tag, even if it's not CSS, it might work.


    BTW is it in all browsers or just one or two?

    I had the same problem yesterday in FireFOx or was it IE, can't remember, but not both...

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Set the td's valign to top.

    I don't approve of designing with tables at all, btw
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    valign did the trick. thank you both.

    CB. I find tables very handy as it helps you keep all the information where you want it. I find it better than having DIVs everywhere. Why don't you like tables?

    oh, note: I was havinf the problem in IE and FX, but now both work fine.
    Have I helped you? Please Rate my posts.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Just compare some source, ok?
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//HTML 4.01 Strict//EN"
    	"http://www.w3.org/TR/1999/html401/strict.dtd">
    <html lang="de">
    <head>
    <link href="style/core.css" media="all" rel="stylesheet" charset="utf-8">
    <title>Fingerprothesenregister Login</title>
    </head>
    <body>
    <h1>Willkommen zum Fingerprothesenregister</h1>
    <form action="login.php" id="loginbox" method="post">
    <p>Bitte geben Sie Ihre Login-Daten an.</p>
    <div class="controlassoc">
    <label for="user">Benutzername</label>
    <input id="user" name="user" type="text">
    
    <br class="clearer">
    </div>
    <div class="controlassoc">
    <label for="passw">Passwort</label>
    <input id="passw" name="passw" type="password">
    <br class="clearer">
    </div>
    <input type="submit" value="Abschicken">
    </form>
    </body>
    </html>
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    
    name="doctitle" -->
    <title>Untitled Document</title>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <link href="styles/oegu_hpr.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" language="JavaScript" src="javascript/util.js"></script>
    </head>
    
    <body>
    
    <table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td><table width="600" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="145"><img src="graphics/logo.gif" width="126" height="41"></td>
    <td width="455" class="Header1">&Ouml;GU - H&uuml;ftprothesen Registers</td>
    </tr>
    </table></td>
    </tr>
    <tr>
    
    <td height="140">
    <form name="login" id="login" method="post" action="login2.php">
    <fieldset>
    <legend>Login</legend>
    
    <table width="600" border="0" cellspacing="0" cellpadding="0"><tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td width="10">&nbsp;</td>
    <td width="590">
    <table width="400" border="0" align="left" cellpadding="0" cellspacing="0">
    <tr><td>Benutzername</td><td><input type="text" id="username" name="username" value=""></td></tr>
    <tr><td><img src="graphics/leer.gif" width="1" height="1"></td><td><img src="graphics/leer.gif" width="1" height="1"></td></tr>
    <tr><td>Passwort</td><td><input type="password" name="password" id="password"></td></tr>
    </table>
    &nbsp;</td>
    </tr>
    <tr>
    
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    </table>
    </fieldset>
    <br>
    <input type="button" name="" value="&lt; Zur&uuml;ck" disabled="1">
    <input type="submit" name="" value="Login &gt;">
    </form>
    </td>
    </tr>
    </table>
    
    <script language="JavaScript" type="text/javascript">
    if(document.getElementById)
    	document.getElementById('username').focus();
    </script>
    </body>
    </html>
    Not posted are the style sheets, but I assure you, the pages look almost the same.


    What do you mean by "keeping all the information where you want it"? Does "where" relate to the layout or the source code? And what about having divs everywhere - there's usually far fewer divs than tds.

    I don't like tables because you need a WYSIWYG editor to be able to work with them, because the source is many times as long and because they're outdated.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I have to agree with Acidic a bit here...like for a head line over my articles I want the headline to be aligned left, and the date to be aligned on the right side. Using a two celled table, looks much better in the code then having the 4th and 5th div inside 3 other divs...

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I can do it without a single unnecessary div and a single br.

    Code:
    <h1>Headline</h1><div class="date">Date here</div><br class="clearer">
    Code:
    h1 {float: left; }
    div.date {float: right; }
    br.clearer {clear: both; display: inline; visibility: hidden; }
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Originally posted by CornedBee
    Does "where" relate to the layout or the source code?
    yes, that's what I meant.
    Originally posted by CornedBee

    I don't like tables because you need a WYSIWYG editor to be able to work with them, because the source is many times as long and because they're outdated.
    I used to need a WYSIWYG, but I can do it fine without one now.
    I find the source is the same length. OK your post proves otherwise, but i seem to find it not too long with tables. Of course DIVs are useful. I use them a lot for when I want information at a specific point on the page, by point I meant x and y co ord).

    Are they really outdated? I know you're very up to date on these things, but I find it difficult to believe that tables are becoming obsolete. I don't want to start an argument though, so how about you keep to using DIVs (I wouldn't manage to try to convert you even if I tried anyways) and I'll keep to using tables until I see why I really shouldn't be.
    Have I helped you? Please Rate my posts.

  9. #9

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    OK, looking at your CSS I see that once I'm better at that, I might move over to not using tables.
    Have I helped you? Please Rate my posts.

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Here, this might help you make the right decision
    http://www.hotdesign.com/seybold/
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  11. #11
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by CornedBee
    I can do it without a single unnecessary div and a single br.

    Code:
    <h1>Headline</h1><div class="date">Date here</div><br class="clearer">
    Code:
    h1 {float: left; }
    div.date {float: right; }
    br.clearer {clear: both; display: inline; visibility: hidden; }

    But you are still using one div, H1 and a br, I still can't see that it's easier then just using a two cell table. But maybe you are right,

    BTW is it slow to go out an in of PHP mode all the time? Have been wondering a bit about this for a while, because I am printing the table in PHP, and if it is slow it isn't a good idea to do it your way.

  12. #12
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I doubt it's slow to switch mode. In fact, I think the switches take almost no time and the parser is a lot faster in no-php mode.

    So? I use h1, div and br. You use table, tr and 2xtd. 3 tags for me, 4 for you.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  13. #13

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    exactly same question here. And I'll try learning more CSS so I can at least see what the code is like when not using tables.

    edit: I see you just answered the question.
    Have I helped you? Please Rate my posts.

  14. #14
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by CornedBee

    So? I use h1, div and br. You use table, tr and 2xtd. 3 tags for me, 4 for you.

    Hehe....ok...I give up......I belive you......will have a look at it to see if I can rewrite that. At least remember it to next time.

    PS: When am I ever going to be right in a discusion with CornedBee..

  15. #15
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    When I've got a bad hit in the head?

    I try to stay out of discussions where I'm not right, it hurts my image
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  16. #16
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Hehe....I am not affraid about getting a hit, someone always corrects me, so no damage is ever done anyway. Only my "image", but I can only blame that I am young, and still have much to learn, but in 3-4 years when I have finished my education, then I never will be wrong. Just have to get that job at ATI first...


    BTW now when I have the oppertunity, thanks for all help the last year or so. You have done a lot to help me.

  17. #17

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Yeah, I was about to thank CB too, but though he might think I'm a big softy. And I haven't quite been here long enough anyways. but here's goes anyways. Thank for all the help from me and everyone who has ever been helped by you. you really make a great addition to this forum.
    Have I helped you? Please Rate my posts.

  18. #18
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Thanks

    Oh, and I'm only 19...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  19. #19

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Originally posted by CornedBee
    Oh, and I'm only 19...
    seriously?? I'm 18, now that just makes me look bad.
    Have I helped you? Please Rate my posts.

  20. #20
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Me and Acidic can't win on age either......well....there is probably something I know more about then you. ......I waithed to long before starting to explore anything else then VB. I hate my self for that now. I will never get those years back. Well....thats probably why I have more or less stoped to eat and sleep the last year to get back on top of everything. But there is to much to learn, to little time. I always have 5-6 projects that I am doing simultaneously........well well...as I said, waith 4-5 years and I am there..


    Why couldn't it be a check box to not make this post count as a post count.....I hate that...

  21. #21
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Ah, but this way you get a chance to catch up to my 7000 posts
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  22. #22
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I actually don't care about the post count. It doesn't say anything about your skills. I have seen persons here that are way more skilled then me with a lot fewer posts, and persons that are that have more or less the same post count as me in only a few months that have only asked silly questions.

    I am not saying that non of my posts are silly, but I like to think that I have sometihing to teach away, at least in the game/graphics section.

  23. #23
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Originally posted by NoteMe
    But you are still using one div, H1 and a br, I still can't see that it's easier then just using a two cell table. But maybe you are right,
    I like to hook up on that.
    What you´re saying in that sentence is actually the big advantage of using proper html. The fact that you use a H1 for a heading is the point of this ´new-school´ html coding. It actually used to be that way since the beginning but nobody (including me a while ago) cared as long as it looked good in the browser you were designing for.

    I can talk about this for hours, but Doug Bowman already wrote a great article on why this new style coding is good:
    http://www.stopdesign.com/articles/throwing_tables/

    Try http://www.alistapart.com for more information.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width