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

JavaScript

Hello World

Hello World

1 Answer

Graham Tonelli
Graham Tonelli
11,968 Points

Hi there,

When you post code remember to follow these instructions:

Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

      ```html
      <p>This is code!</p>
      ```

As it makes it much easier to read and to show to others :). It will look like this:

<!DOCTYPE html> <html> <head> <title>Page Title</title> <style> body > div{position:relative; height:56px; overflow:hidden; width:256px; border:3px solid #000; }

@keyframes move{ 0%{ opacity:1; transform:scale(0);

} 100%{ transform:scale(1);} }

span{

transform:translate(-50%,-50%);height: 100%;border-radius:50%; opacity:0; cursor:pointer; background: rgba(0, 0, 0, 1); width: 100%;

pointer-events:none; position: absolute; }

.blue{animation:2.5s move; }

::before,*::after{ margin:0; padding:0; box-sizing:border-box; }

</style> </head> <body> <div tabindex="0"> <div class="red"></div> </div> <script> const parent = document.querySelector('div');

parent.addEventListener('click',function(e){

let y = e.clientY - e.target.offsetTop

let x = e.clientX - e.target.offsetLeft; const ripple = document.createElement('span')

ripple.classList.add('blue') ripple.style.top= y + "px" ripple.style.left=x + "px" parent.appendChild(ripple)

}) </script> </body> </html>

Also remember to use coding best practices! Make use of white space and comments to make your code more readable :).

I see a number of places where you have missed semicolons. Remember to include a semi-colon after each line of code! This is a classic mistake and everyone makes it - from coding veterans to learners :)