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 trial

Dontre Waggoner
9,748 Pointswhy are my divs displaying diagonally, I followed exactly as you did in the video. is it the css?
My code works, but my divs display diagonally. I used workspace and a personal text editor of my choice but I'm still seeing the same result. Is it the CSS that is broken?

Dontre Waggoner
9,748 PointsHi Terran,
Thanks for the fast reply. I didn't touch the CSS but here's what my Javascript looks like:
var html = '';
for (var i = 1; i <=10; i +=1){ html += '<div>' + i + '<div>'; } document.write(html);

Dontre Waggoner
9,748 PointsIts the For Loop Video: https://teamtreehouse.com/library/for-loops-2

Dontre Waggoner
9,748 PointsI'll give it a try, thanks for your help!
1 Answer

KRIS NIKOLAISEN
54,974 PointsYour divs are diagonal because your closing div tag is missing a slash in your Javascript.
This
html += '<div>' + i + '<div>';
should be
html += '<div>' + i + '</div>';

Dontre Waggoner
9,748 PointsIt works!! I'm a little embarrassed that's what it was haha. Thank you so much! =)
Tarran Prior
Courses Plus Student 3,169 PointsTarran Prior
Courses Plus Student 3,169 PointsHey Dontre.
If you're able to post the source code of your web page I'd be happy to take a look.