Wrap content in a <tr> tag to a new line

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • earthrat
    New Member
    • Nov 2011
    • 1

    Wrap content in a <tr> tag to a new line

    I cant figure out how to wrap the content to a new row when it exceeds the width of the page?

    Here is a link to what I have so far and the first question in this survey has more color swatches than is visible. I need these color chips to move to a new line so that they are all visible.

    http://www.colormatter s.com/component/surveys/1-color-survey/2/editsurvey?Item id=794

    Here is what I have:

    Code:
    $return .= '<table class="table_question">';
    		$return .= 	  '<tr>';
    		$return .= 	  	 '<td class="'.$question_class.'">';
    		$return .=           $question_details["0"]["title"];
    		if($question_details["0"]["required"] == "1"){
    			$return .= '<span class="question_required"> *</span>';
    			$javascript = ' onchange="setentertext(form.q'.$question_id.', this)" ';
    			$validation = $this->createValidation($question_id, $question_details["0"]["title"]);					
    		}
    		$return .= 	  	 '</td>';
    		$return .= 	  '</tr>';
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Create a row with one table data "<td>" element for where you want the wrapping to occur.

    Your items should wrap.

    -Frinny

    Comment

    • drhowarddrfine
      Recognized Expert Expert
      • Sep 2006
      • 7434

      #3
      I'd bet he wants it to wrap as the browser is resized and that's not going to happen. Reason #9736 why you should never use tables for layout.

      Comment

      • johny10151981
        Top Contributor
        • Jan 2010
        • 1059

        #4
        you should also take a look at css property overflow

        Comment

        • omerbutt
          Contributor
          • Nov 2006
          • 638

          #5
          hi ,
          you can use jquery to get the body / screen width on run time
          Code:
          var dimX	=	$(document.body).width();
          var dimY	=	$(document.body).height();
          and assign that width to the table or td to go on with the
          screen resolution , i dont think it is impossible to do drhowarddrfine that you go bet on it ;)
          regards,
          Omer Aslam

          Comment

          Working...