SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Measuring column height and dynamically adding content

    Hi all,

    I've got the following dilemma.

    I have a 3 column CSS layout design. The page length is dynamic depending on how much content gets fed into each respective column. For this reason one column might be considerably longer than the other two, as a result the page length opens us white space in some columns.

    Given the white space that appears if some content in columns is longer than in others, how could I measure the white space and depending on its height dynamically add in further content providing it fits (say additional side banners)?

    I'm told this is possible in JS? I guess PHP is also a viable option?

    Thanks a lot,

  2. #2
    SitePoint Member
    Join Date
    Sep 2006
    Location
    Belgium
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could use strlen function in php.

  3. #3
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Avenir View Post
    You could use strlen function in php.
    I've studied the examples shown for strlen() at the source below but can't see how I would pass the DIV of the column as a parameter?
    http://pl2.php.net/manual/en/function.strlen.php

    What also strikes me is that the longest column contains more than just text in <p> <h1>, <h2>'s, for example both a vertical and horizontal accordion which dynamically grows/shrinks - determining its height purely by counting chars won't work.

    Maybe there's a way to measure the container height which holds all columns? It's height will always be whatever the tallest column is plus whatever padding/margin it has in there. Right or wrong? On the other hand even if this is workable then it won't reveal how much whitespace is available in the column where the banners get displayed, given this it won't be possible to determine if there's enough whitespace to dynamically squeeze in another banner.

    Anyone have any ideas?

    Thanks in advance.

  4. #4
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Everyone as equally confused on this one as me?

    Haven't you come across this problem when working for your clients?

    Thanks,


Bookmarks

Posting Permissions

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