Jump to content


Photo

<Td> Tag Issue


  • Please log in to reply
2 replies to this topic

#1 Swarfega

Swarfega

    Advanced Member

  • Members
  • PipPipPip
  • 38 posts

Posted 28 December 2012 - 08:09 PM

Hi.


I've got another issue. Basically, I'm using a while loop to drag all the Data from the database to display on a page. Consider it a 'Guestbook', if you will, except for all users. (Chat)

The problem is that I can't find any legit way using <td> tag-attributes to lock the Message in its place (I have this issue on the normal GuestBook invidiual for each user as well). I'm better of just showing you what I'm talking about:


http://i49.tinypic.com/qoyd8l.png

I want the <td> Tag to display the whole message, but once it reaches the drawn-Red line, I want it to make a new line and keep the message flowing like that until the message has been fully printed.


I've tried the following:
- <td width='xx'> Tag
- <td class='xx' width='xx'> Tag (CSS)


And nothing thus far has worked out.


Any suggestions what to do to lock it in place?

#2 Swarfega

Swarfega

    Advanced Member

  • Members
  • PipPipPip
  • 38 posts

Posted 28 December 2012 - 08:17 PM

<td style='max-width: 600px; overflow:auto; word-wrap:break-word;'>

Fixed the issue by doing this, if someone else encounters this.

#3 Christian F.

Christian F.

    Advanced Member

  • Staff Alumni
  • 3,106 posts
  • LocationNorway

Posted 29 December 2012 - 08:55 AM

The better way would have been to use the proper HTML tags for this, as a guestbook isn't tabular data. This is quite easily done with a div-block, and a bit of CSS:
<div class="post">
    <img class="avatar" src="avatar.png">
    <h3>{$Name}</h3>
    <h4>{$Date}</h4>
    <p>{$Post}</p>
</div>

With that HTML you'll only need the following CSS:
div.post {
    width: 600px;
}

div.post:after {
    content: ".";
    height: 0px;
    display: block;
    visibility: hidden;
    clear: left;
}

div.post img {
    float: left;
}

div.post h3 {
    display: inline;
}

div.post h4 {
    display: inline;
}

div.post h4:before {
    content: " - ";
}

Not tested, but should work.

Edited by Christian F., 29 December 2012 - 08:56 AM.

Keeping it simple.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com