Text of comments goes over boundary

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • puT3
    New Member
    • Jul 2008
    • 145

    Text of comments goes over boundary

    I have 3 column of css on my webpage, on the webpage user can enter their comments which will be saved in database. And then the comments from database is retrieve and displayed on the webpage.

    My problem is the comments is long and when displayed on the webpage it goes out of bound of the center column.I want it to go under as in paragraph How can this be solved? I think the code that retrieve and displayed the comments should be changed or the database.

    Code:
    sql2 = "SELECT * FROM Cadangan";
    			rs = Server.CreateObject("ADODB.Recordset");
    			rs.Open(sql2,Conn);
    
    			out ="<table width="200">";
    			
    			while(!(rs.EOF))
    			{
    				
    				out += "<tr><td>"
    				out += rs("Cadangan") + "</td></tr>"
    				out += "<tr><td>" + rs("Nama") + "</td>"
    				out += "<td>" + rs("Email")
    				out += "</td></tr>"
    				
    	            
    				rs.MoveNext();
    				
    				
    			}
    			
    			out += "</table>"
    			var line ="<hr>"
    			rs.Close();
    			Response.Write(out);
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    is RS("cadangan") the comments?

    Jared

    Comment

    • puT3
      New Member
      • Jul 2008
      • 145

      #3
      yes RS("cadangan") is the comments

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        without looking at the final, formatted page, I see two possibilities. 1- the rs("cadangan") contains HTML code that interfere with the rest of your formatting, or 2- your css code is restricting the size of the td element and allowing the content to spill out. Is it possible that #1 is happening?

        Jared

        Comment

        • puT3
          New Member
          • Jul 2008
          • 145

          #5
          i've tried delete the html code but the result is still the same and I do not define table element in css.

          I try another way, i put new code in my CSS and tried do it but the result still the same. Here is the code:

          CSS Code for comment:

          Code:
          div.comment.list{
              float:left;
              width:360px;}
          
          .comment_body{padding-top: 4px;}
          
          .comment_content{
              padding-left:2px;
              border-bottom: 1px solid #D6D6D6;
          }
          CSS code for column:

          Code:
          #content{
             width: 720px;
             margin: 0 auto;
          }
          
          #colOne{
              float: left;
              width: 160px;
          }
          
          #colTwo{
              float: left;
              width: 360px;
              padding: 0 20px;
          }
          
          #colThree{
              float: left;
              width: 160px;
          }
          ASP code:

          Code:
          out ="<div class='comment_list'>"; 
            
                      while(!(rs.EOF)) 
                      { 
            
                          out += "div class='comment_body'>" + rs("Cadangan")
                          out += "<p>" 
                          out += "div class='comment_content'>" + rs("Nama") + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + rs("Email")
                          out += "<p></div>" 
            
            
                          rs.MoveNext(); 
            
            
                      } 
            
                      out += "</div>" 
                      rs.Close(); 
                      Response.Write(out);
          Last edited by puT3; Jun 3 '10, 01:48 AM. Reason: Added new information

          Comment

          • puT3
            New Member
            • Jul 2008
            • 145

            #6
            I already figure out the solution.Thanks

            Comment

            Working...