Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialReza Zandi
Full Stack JavaScript Techdegree Student 1,599 PointsGetting the printed story to be bigger
document.write("There once was a " + adjective + noun + " whom lived life soley to " + verb + ".");
Can I add something like an <h3> tag in between the parenthesis to make this bigger? How does one manipulate the size of the text that's being printed that way. I know this is beyond the scope for this video, but just wondering . Also, I tried to save the documents.write to a variable, just as 'var story = document.write("There once was a " + adjective + noun + " whom lived life soley to " + verb + ".");'
but that threw off an error. I was going to try to manipulate 'story'.
2 Answers
KRIS NIKOLAISEN
54,971 PointsYou could use the fontsize method
var story = "There once was a " + adjective + noun + " whom lived life soley to " + verb + "."
document.write("<p>" + story.fontsize(7) + "</p>");
I tested it and it worked in Chrome but note from the link:
The fontsize() method is not standard, and may not work as expected in all browsers. The <font> tag is not supported in HTML5. Use CSS instead.
SO with inline CSS
document.write("<p style='font-size:40px;'>" + story + "</p>");
Erika Reiman
3,316 PointsThere is also a css file included in the workspace, so you could just add <p> tags in the document.write line and then style the p element in the css file. In fact when I tried this the p elements were already styled to be a larger font size than just using document.write with no tags at all.