suess0r Posted May 31, 2007 Share Posted May 31, 2007 Here's my problemo, could use an extra set of eyes on this... easiest way to explain: http://www.clublevelvip.com/home.php - Type in Playboy for the Venue Name and on the bottom of the next page you'll see the result set. Notice that the alignment isn't all there, because i'm trying to avoid using a table. Here's my echo for the result sets echo '<strong><a href="#">'.$ename.'</a></strong><img alt="" src="images/spacer.gif" width="131px" height="1px">'.$date.'<br><br style="line-height:11px"><img src="images/1_line.gif" style="margin-left:-11px " alt="" border="0"><br><br style="line-height:10px">'; Now, if I manually type in the E-Name I can increase the width of the spacer to be aligned correctly. So i was wondering if I could add up the characters in ename and then add the width accordingly so example of the characters vs pix 1 characters = 210 3 chars = 194px 7 characters = 178px 11 characters = 162px 13 characters = 131px 24 characters = 78px I know this is a crazy way to do it, does anyone else have any insights that would be better? Maybe a different way of alignment or something? I would still like to know how to calculate the chars in the $enum, let me know thanks! Quote Link to comment https://forums.phpfreaks.com/topic/53752-result-set-alignment-problem-possible-char-calculation/ Share on other sites More sharing options...
suess0r Posted June 1, 2007 Author Share Posted June 1, 2007 anything? Quote Link to comment https://forums.phpfreaks.com/topic/53752-result-set-alignment-problem-possible-char-calculation/#findComment-266344 Share on other sites More sharing options...
AndyB Posted June 1, 2007 Share Posted June 1, 2007 It's not going to work (except see below). You can't control how a user manages font size when they display something. Also, most fonts are proportional spaced: wwww is much longer than iiii - no matter how many pixels you add, those are not going to be the same length overall. If it's mission-critical (as if) you could generate the text as an image using gd - and you can calculate the width of the text and adjust the overall size of the displayed output. Yes, it could be done. Is it sensible design? Nope. Quote Link to comment https://forums.phpfreaks.com/topic/53752-result-set-alignment-problem-possible-char-calculation/#findComment-266398 Share on other sites More sharing options...
dough boy Posted June 1, 2007 Share Posted June 1, 2007 Is it always going to a date in that column? If so just use CSS to create 2 floating divs (left and right) and set the width of each div (since the date will always be the same length). Then it will not matter how many characters are in the text. Quote Link to comment https://forums.phpfreaks.com/topic/53752-result-set-alignment-problem-possible-char-calculation/#findComment-266404 Share on other sites More sharing options...
suess0r Posted June 4, 2007 Author Share Posted June 4, 2007 Thanks doughboy, here's what I tried but having a minor CSS problem.. <div class="dimg"><strong><a href="#">Happy Try</a> </strong> <div style="float:right">Thu, 07/13/06</div></div> It's not printing on the same line, for some reaosn it's not staying within the dimg div tag, here's what i got for dimg .dimg { padding: 5px 0px 0px 20px; } Cany anyone help me keep them on the same line and not go to a newline to print the date? Quote Link to comment https://forums.phpfreaks.com/topic/53752-result-set-alignment-problem-possible-char-calculation/#findComment-267585 Share on other sites More sharing options...
dough boy Posted June 4, 2007 Share Posted June 4, 2007 Try something like: <div> <span style="width:325px;">Link</span> <span style="width:25px;">Date</span> </div> Quote Link to comment https://forums.phpfreaks.com/topic/53752-result-set-alignment-problem-possible-char-calculation/#findComment-267590 Share on other sites More sharing options...
suess0r Posted June 4, 2007 Author Share Posted June 4, 2007 perfect, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/53752-result-set-alignment-problem-possible-char-calculation/#findComment-267599 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.