ondi Posted May 16, 2009 Share Posted May 16, 2009 Here's a snippet of my code. I can't for the life of me work out where to put the font size instruction, could someone point me in the right direction? Thanks $sort = isset($_GET['sort2']) ? $_GET['sort2'] : 'season_name'; if( !in_array($sort,array('season_name','games','won','lost','draw','winpct')) ) $sort = 'season_name'; $query .= " ORDER BY " . $sort . " ASC"; $rst = mysql_query($query); echo mysql_error(); $j=1; $tmp = "<b>%s</b>"; while( $r = mysql_fetch_array($rst) ) { if( ($j++) % 2 == 0) $temp = "$bg1"; else $temp = "$bg2"; echo" <tr> <td align=\"left\" valign=\"middle\" bgcolor=\"$temp\"> {$r[season_name]} </a> </td> <td align=\"center\" valign=\"middle\" font face=\"Arial\" size=\"1\" bgcolor=\"$temp\">"; printf( ($sort == 'games'?$tmp:"%s"), $r['games'] ); echo "</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; printf( ($sort == 'won'?$tmp:"%s"), $r['won'] ); echo "</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; printf( ($sort == 'draw'?$tmp:"%s"), $r['draw'] ); echo "</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; printf( ($sort == 'lost'?$tmp:"%s"), $r['lost'] ); echo "</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; printf( ($sort == 'winpct'?$tmp:"%s"), $r['winpct'] ); echo"</td> </tr> \n"; $games += $r['games']; $won += $r['won']; $draw += $r['draw']; $lost += $r['lost']; } ?> Here's the font code which i've been trying to use... font size=\"1\" Quote Link to comment https://forums.phpfreaks.com/topic/158398-cant-work-out-how-to-change-font-size/ Share on other sites More sharing options...
RussellReal Posted May 16, 2009 Share Posted May 16, 2009 don't use <font> its worthless, use <span style="font-size: 14px;">TEXT HERE</span> Quote Link to comment https://forums.phpfreaks.com/topic/158398-cant-work-out-how-to-change-font-size/#findComment-835352 Share on other sites More sharing options...
ondi Posted May 16, 2009 Author Share Posted May 16, 2009 How would i incorporate that into printf( ($sort == 'games'?$tmp:"%s"), $r['games'] ); echo "</td> Thanks Quote Link to comment https://forums.phpfreaks.com/topic/158398-cant-work-out-how-to-change-font-size/#findComment-835353 Share on other sites More sharing options...
wildteen88 Posted May 16, 2009 Share Posted May 16, 2009 You shouldn't use HTML to size fonts. You should be using CSS for that. Quote Link to comment https://forums.phpfreaks.com/topic/158398-cant-work-out-how-to-change-font-size/#findComment-835355 Share on other sites More sharing options...
ondi Posted May 16, 2009 Author Share Posted May 16, 2009 You shouldn't use HTML to size fonts. You should be using CSS for that. I know i should be using CSS, but creating an entire style sheet will take far too long, I'm just looking for a quick fix. Quote Link to comment https://forums.phpfreaks.com/topic/158398-cant-work-out-how-to-change-font-size/#findComment-835358 Share on other sites More sharing options...
RussellReal Posted May 16, 2009 Share Posted May 16, 2009 wildteen, either way, my 'html' is using css Quote Link to comment https://forums.phpfreaks.com/topic/158398-cant-work-out-how-to-change-font-size/#findComment-835362 Share on other sites More sharing options...
ondi Posted May 16, 2009 Author Share Posted May 16, 2009 well, either way, im no closer to solving my problem! tried using <span style="font-size: 14px;"> but all that did was change my font to times new roman, and teh size wouldn't change! Quote Link to comment https://forums.phpfreaks.com/topic/158398-cant-work-out-how-to-change-font-size/#findComment-835366 Share on other sites More sharing options...
ondi Posted May 17, 2009 Author Share Posted May 17, 2009 Can anyone shed some light on this please? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/158398-cant-work-out-how-to-change-font-size/#findComment-835782 Share on other sites More sharing options...
arcanine Posted May 18, 2009 Share Posted May 18, 2009 I would recommend using javascript if that helps, here is a snippet of code I've been using $(document).ready(function(){ // Reset Font Size var originalFontSize = $('div').css('font-size'); $(".resetFont").click(function(){ $('div').css('font-size', originalFontSize); }); // Incrementa Font Size $(".increaseFont").click(function(){ var currentFontSize = $('div').css('font-size'); var currentFontSizeNum = parseFloat(currentFontSize, 10); var newFontSize = currentFontSizeNum*1.2; $('div').css('font-size', newFontSize); return false; }); // Decrementa Font Size $(".decreaseFont").click(function(){ var currentFontSize = $('div').css('font-size'); var currentFontSizeNum = parseFloat(currentFontSize, 10); var newFontSize = currentFontSizeNum*0.8; $('div').css('font-size', newFontSize); return false; }); }); to change font size, just link that up to the correct classes and it works, some sort of modification of this might help you Quote Link to comment https://forums.phpfreaks.com/topic/158398-cant-work-out-how-to-change-font-size/#findComment-836598 Share on other sites More sharing options...
TheFilmGod Posted May 19, 2009 Share Posted May 19, 2009 Please post only the relevant html. PHP is serverside and does not affect the way a page "looks" for the average user. <span style="font-size: 14px;">TEXT HeRE</span> Doesn't that work? ... It doesn't work because you are using deprecated size="1"?? Use css! In web development there are no "quick fixes." You either fix it good or use deprecated, obsolete html back from 1998. Quote Link to comment https://forums.phpfreaks.com/topic/158398-cant-work-out-how-to-change-font-size/#findComment-836919 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.