Iron Man Logo Lecture 1 Thumbnail Lecture 2 Thumbnail Lecture 3 Thumbnail Lecture 4 Thumbnail

Lecture 5 Thumbnail Lecture 6 Thumbnail html logo

The hidden part of html


The Problem of Locating Your Own Files

So far, we have only used images by linking to them from other websites (e.g., using a full https://... URL). But this raises a fundamental question:

Relative vs. Absolute Paths

Imagine you are in Dwarka, Delhi, and need to give someone directions to Chandni Chowk. You have two ways to do it:

  1. Relative Path: You give directions from your current location. "From here, go to CP, then from CP, go to Vikas Puri, and from there you'll reach Chandni Chowk." This path is relative to where you are right now.
  2. Absolute Path: You give directions from a universal starting point. "Go to Planet Earth, find the country India, then the city New Delhi, and inside it, find Chandni Chowk." This path is absolute because it starts from the ultimate root.
HTML file paths

This same logic applies to files in our project:

The Security Risk of Local Absolute Paths

Browsers blocking...

The Problem of a Standard Web Page Structure

We've seen that writing <h1>Hello</h1> in a file works. So why do we need all the extra "boilerplate" code that professional developers use?

The standard HTML boilerplate.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- Your content goes here -->
</body>
</html>

The Problem of Grouping and Selecting Elements

As pages get more complex, we run into new problems: How do we apply one style to a whole group of elements? And how do we target one very specific element and nothing else?



Sources: Internet. All copyrights © reserved #DarkProgrammer, Let's connect.