Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
166
rated 0 times [  168] [ 2]  / answers: 1 / hits: 21887  / 9 Years ago, fri, may 1, 2015, 12:00:00

really simple question and cant figure it out. I am trying to add a line break here on my table header



var text = <table id='test' class='test'>;
text += <tr><th> style='font-size:16px'>Cool nStuff</th></tr>;


I have tried to add a line break using <br> and n and no luck, can anyone help me


More From » html

 Answers
40

n puts a newline in the string, but HTML treats newlines as spaces. To put in a line break, you:




  1. Use a <br> (break) element:



    var text = <table id='test' class='test'>;
    text += <tr><th style='font-size:16px'>Cool<br>Stuff</th></tr>;


    or,


  2. Put the first line in one block element, the second in another:



    var text = <table id='test' class='test'>;
    text += <tr><th style='font-size:16px'> +
    <div>Cool</div> +
    <div>Stuff</div> +
    </th></tr>;



That sort of thing.


[#66794] Wednesday, April 29, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yosefleod

Total Points: 113
Total Questions: 100
Total Answers: 115

Location: Egypt
Member since Tue, May 3, 2022
2 Years ago
;