sanderphp Posted February 16, 2009 Share Posted February 16, 2009 I'm using a simple script to display a quote on the screen. I added the table line to get the output to appear in the center, but its still at the top of the screen. How do I get it centered in the middle of the page vertically? <TABLE HEIGTH=75% WIDTH=75% BORDER="0" VALIGN="Middle" ALIGN="center"> <?php echo '<head>'; echo ' <link rel="stylesheet" href="styles.css" type="text/css">'; echo '</head>'; require( "config.php" ); $Quote = new CQuote; if( $Quote->Get( $strQuote ) == 0 ) echo $strQuote; ?> </table> Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/ Share on other sites More sharing options...
haku Posted February 16, 2009 Share Posted February 16, 2009 Height is spelled 'height'. Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763113 Share on other sites More sharing options...
sanderphp Posted February 16, 2009 Author Share Posted February 16, 2009 Other than that typo it should work correctly right? I can't get it to. Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763115 Share on other sites More sharing options...
sanderphp Posted February 16, 2009 Author Share Posted February 16, 2009 My table is appearing below the php script output. How do I return the value if the script inside the table? Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763117 Share on other sites More sharing options...
haku Posted February 16, 2009 Share Posted February 16, 2009 You are outputting 'head' tags and a css link in the middle of your table. Those have to go before any HTML output. Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763123 Share on other sites More sharing options...
sanderphp Posted February 16, 2009 Author Share Posted February 16, 2009 Even this way, the output is still displayed above the table. <head> <link rel="stylesheet" href="styles.css" type="text/css"> </head> <TABLE HEIGHT=75% WIDTH=75% BORDER="2" VALIGN="Middle" ALIGN="center"> <?php require( "config.php" ); $Quote = new CQuote; if( $Quote->Get( $strQuote ) == 0 ) echo $strQuote; ?> </table> Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763125 Share on other sites More sharing options...
haku Posted February 16, 2009 Share Posted February 16, 2009 Show us the output. Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763129 Share on other sites More sharing options...
sanderphp Posted February 16, 2009 Author Share Posted February 16, 2009 I don't want to post my public domain here, but it's just the text, with a table underneath it. I want the text to be inside the box. Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763132 Share on other sites More sharing options...
9three Posted February 16, 2009 Share Posted February 16, 2009 change the domain to xxxxxxxx.com Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763135 Share on other sites More sharing options...
sanderphp Posted February 16, 2009 Author Share Posted February 16, 2009 http://www.sanderandmeena.com/php/notes/examples/complete/quotes.php Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763136 Share on other sites More sharing options...
9three Posted February 16, 2009 Share Posted February 16, 2009 The HTML seems fine. It's inside the table. Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763137 Share on other sites More sharing options...
corbin Posted February 16, 2009 Share Posted February 16, 2009 Learn basic HTML before moving to PHP. Look up a table tutorial because you're doing it entirely wrong. Tables have rows and cells. Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763139 Share on other sites More sharing options...
9three Posted February 16, 2009 Share Posted February 16, 2009 /Agreed Although it *is* inside the table element but you need to add the <tr> and <td> to it. Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763140 Share on other sites More sharing options...
sanderphp Posted February 16, 2009 Author Share Posted February 16, 2009 What color font are you seeing? I just checked on another pc and this one shows white text while the other shows black text and not table box Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763141 Share on other sites More sharing options...
9three Posted February 16, 2009 Share Posted February 16, 2009 red background. black text Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763142 Share on other sites More sharing options...
sanderphp Posted February 16, 2009 Author Share Posted February 16, 2009 Thanks, that's all I needed was the tr and td tags. I forgot that those were required for a table to function correctly. Link to comment https://forums.phpfreaks.com/topic/145365-vertically-centering-output/#findComment-763143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.