Script element is same as div element?

Tell us what’s happening:

I made css like this.

div{
border: solid 5px;
margin: 20px auto;
}

and in the html, there was script element on the top.

I saw that in the editor view the css is applied for the script element.

Your code so far

<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

<body>
  <div>
  
  </div>

  <div>
  
  </div>

  <div>
  
  </div>
   
  <div>
  
  </div>
</body>
div{
  border: solid 5px;
  margin: 10px auto;
}

Your browser information:
google chrome.

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36.

Challenge: Build a Personal Portfolio Webpage

Link to the challenge:

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

thank you very much.

1 Like

Hey there,

nice to meet you.

I currently have a hard time to understand your issue,
can you show us some code on codepen.io?

When I add your code example to an empty codepen,
the CSS works for the div as expected.

hi. nice to meet you.

this is the code.

the first script element is applied by css for div element.

check and tell me some difference from your end, thank you.

I see!

So when we have a look at the first div in the dev tools (the one under script), we will see that it has an id of fcc_test_suite_wrapper.

So my best guess is that is has something to do with the code of the script, that’s why I go to the URL of the script and search for fcc_test_suite_wrapper, we’ll see that the script actually adds a div with this id as a wrapper for the test suite to our codepen.

And because it is a div, the custom div CSS also works for this div.

So great question!

1 Like

yeah I found that id fcc_test_suite_wrapper in the js script URL.
Thank you for the guess!
Now I got the answer from what happened from CSS and HTML.