Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

Reza Zandi
seal-mask
.a{fill-rule:evenodd;}techdegree
Reza Zandi
Full Stack JavaScript Techdegree Student 1,599 Points

Getting 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

You 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>");

There 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.