Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
45
rated 0 times [  51] [ 6]  / answers: 1 / hits: 69743  / 10 Years ago, wed, november 12, 2014, 12:00:00

I'm trying to post an innerHTML table. Would like the font size in one cell to be bigger. Is it possible to include a style tag like so?



cell4.innerHTML = <style: font-size:40px> + John Doe + </style> +  </br>;


I tried the following fiddle, but it isn't working. http://jsfiddle.net/s1dj3x8e/


More From » stylesheet

 Answers
13

The <style> tag is meant to be a container for CSS code inside the head, so what you're trying to accomplish cannot be done with that element in this context.



Try replacing the following line:



cell4.innerHTML = <style: font-size:40px> + John Doe + </style> +  </br>;


With:



cell4.innerHTML = <span style='font-size:40px'>John Doe</span>;


Updated fiddle (now with span instead of div as correctly pointed out by Zach below):



http://jsfiddle.net/jbhw1qf0/


[#68829] Sunday, November 9, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pierre

Total Points: 716
Total Questions: 128
Total Answers: 102

Location: Djibouti
Member since Sun, Feb 27, 2022
2 Years ago
;