Skip to content

Instantly share code, notes, and snippets.

@hiba-machfej
Forked from tech-chieftain/DOM.md
Created August 8, 2023 08:30
Show Gist options
  • Save hiba-machfej/b9b662a84ed51cb04209dd5e7acc7df1 to your computer and use it in GitHub Desktop.
Save hiba-machfej/b9b662a84ed51cb04209dd5e7acc7df1 to your computer and use it in GitHub Desktop.

Questions: Frontend File Setup

Answer the following questions with your group:

  • How do you link a JavaScript file to an HTML document?
  • How do you link a CSS file to an HTML document?
  • What are the roles of HTML, CSS, and JavaScript on a webpage?
  • What is the DOM? How is it related to HTML, CSS, and JavaScript?
  • How does HTML get rendered into DOM?
  • What are elements?
  • What are attributes in HTML?
  • How can we interact with HTML?
@liliumorion
Copy link

1- we link a JavaScript file to an HTML document using the <script> element: <script src="index.js"></script>.
2- we link a CSS file to an HTML document using the element: <link href="style.css"rel="stylesheet" >
3- the roles of HTML, CSS & JavaScript are as follows:
- HTML offers the core skeleton of a webpage.
-CSS controls the presentation and styling of it.
-JavaScript enables interactivity & dynamic behavior on it as well.
4- The DOM is a programming interface. it's a way web browsers organize & represent web pages in a structured hierarchical tree, allowing scripts like JS to access and modify the page in real time.
5- HTML gets rendered into the DOM by going through a process that we can simplify to the following:
-Parsing HTML, which means breaking down the HTML code into a structured format that the browser can understand.
-Creating the DOM Tree, in a hierarchical tree-like structure, where each HTML element becomes a node in this tree, and text within it becomes text nodes, while still respecting the order and the parent-child hierarchy.
-Styling, by applying CSS styles associated with the HTML elements.
-Rendering, which happens once the DOM tree is made, and that's when the browser uses the information from HTML, CSS & JS to render the web page on the screen.
6- an HTML element is a section that's enclosed within start and end tags and contains content between them.
7- HTML attributes are additional information that modifies the behavior or provides additional information about our elements.
8- interacting with HTML can occur in different ways, mainly using JS, frameworks, libraries etc..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment