Results 1 to 5 of 5

Thread: Overflowing tables

  1. #1
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default Overflowing tables

    Hey, I want to make a table overflow so that elements within it just stop... so then I can add "..." to the end of them. I'm working in a limited <div> space so for example "This is some text and it's very long" just becomes "This is some text..." and overflow it like that. I'm just not sure how to go around it.

    Here's what I have so far:

    CSS:

    Code:
    .boxcontent table{
    	border-width: 1px 1px 1px 1px;
    	border-spacing: 2px;
    	border-style: none none none none;
    	border-collapse:collapse;
    	background-color:#458BDD;
    	width:100%;
    }
    .boxcontent table th {
    	border-width: 1px 1px 1px 1px;
    	padding: 4px 4px 4px 4px;
    	border-style: none none none none;
    }
    
    .boxcontent table tr.data{
    border-top:1px solid black;
    }
    
    .boxcontent table td {
    	border-width: 1px 1px 1px 1px;
    	padding: 8px 8px 8px 8px;
    	border-style: none none none none;
    }
    HTML (just ignore the PHP):

    PHP Code:
        <div id="appointments">
            <div class="title">
            Appointments
            </div>
            <br />
            <div class="hr"></div>
            <div class="boxcontent">
            <?php 
            $query 
    mysql_query("SELECT * FROM appointments WHERE date = '$datenow' ORDER BY date, time");
            
            if (
    mysql_num_rows($query))
            {
                echo 
    "<table><tr class=\"headings\"><td>Name</td><td>When</td><td>Where</td></tr>";
                while(
    $row mysql_fetch_array($query))
                {
                
    "<tr class=\"data\"><td>" $row['name'] . "</td><td>" $row['time'] . "</td><td>" $row['where'] . "</td></tr>";
                }
                echo 
    "</table>";
            }
            
            else{
            echo 
    "No appointments scheduled.";
            }
            
            
            
    ?>
            </div>
        </div>

  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Anyone? I need to get this done quickly

  3. #3
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    I'm not sure if this is able to be done with CSS, but possibly PHP. You can figure out the amount of characters in a string using strlen(). If it exceeds your character limit, you can cut the rest of the string off somehow and add a '...'. Do this with the DB information and it should be easy.

    Is this what you wanted?

  4. The Following User Says Thank You to magicyte For This Useful Post:

    Schmoopy (02-21-2009)

  5. #4
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    OMG what a fool I've been... of course, thanks!

  6. #5
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    You're welcome.

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
  •