[thelist] Forcing horizontal scroll instead of wrap.

Hugh Miller hmiller at cfpress.co.uk
Tue Aug 17 10:14:13 CDT 2010


  Would something like this work?:

CSS
.container { width:100%;height:100px }
.record     { width:100px;height:100px;margin-left:10px;float:left; }


Get the total number of records you are going to display and multiply 
these by the width (including padding,border,margins etc. as per this 
dummy = 110;

PHP (assuming mySQL) would be simply:

$total_records = mysql_num_rows($your_query_to_get_records);
$container_width_required = ($total_records * 110);

HTML

<div class="container" style="width:<?php $container_width_required; ?>px">
<div id="r1" class="record">Content of Record 1</div>
<div id="r2" class="record">Content of Record 2</div>
<div id="r3" class="record">Content of Record 3</div>
</div>

Although I think browser limitations will cause it to die at stupidly 
large widths.




On 17/08/2010 05:11, Edward McCarroll wrote:
> I have a database-driven web app that displays one div for each record, in a
> situation where I need the divs to stay on the same horizontal plane,
> regardless of window size or how many divs there are.
>
> Can somebody clue me in to a CSS (or whatever) trick that forces a div
> scroll instead of wrapping?
>
> Regards,
>
>    Ed
>
> "Every man is guilty of all the good he didn't do." (Voltaire)
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Edward McCarroll
> 310.904.3651
> Ed at ComSimplicity.com
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>

-- 
Hugh Miller
Web Developer
Clyde&  Forth Press Ltd

Tel:   +44-01475-726511
Fax:   +44-01475-783734
Email: hmiller at cfpress.co.uk


This e-mail and any attachments are confidential and intended solely for the addressee. If you have received it in error, please inform the sender and delete it immediately. The views or opinions contained within this email may not be those of Clyde&  Forth Press Ltd, which accepts no liability for any damage caused by the transmission of any viruses. E-mail traffic is monitored within Clyde&  Forth Press Ltd and messages may be viewed.

Clyde&  Forth Press Ltd is a company registered in Scotland (SC132609) with its registered office at Pitreavie Business Park, Dunfermline, Fife, KY11 8QS.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the thelist mailing list