Skip to content

Commit 385c3e2

Browse files
committed
Linking
1 parent 504062f commit 385c3e2

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

Linking/home.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title> My Website </title>
5+
6+
</head>
7+
<body>
8+
<div class="header">This is a header</div>
9+
<div class="menu">
10+
<a href = "homepage.html">Home</a><br>
11+
<a href = "aboutpage.html">About</a><br>
12+
<a href = "contactpage.html">Contact</a><br>
13+
</div>
14+
<div class="content">
15+
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
16+
</div>
17+
<div class="footer"></div>
18+
</body>
19+
</html>

Linking/main.css

Whitespace-only changes.

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,22 @@ Duh.
10301030

10311031
###The `<link>` Tag, Comments, and other Developer Joys
10321032

1033+
Let's just say you want to reuse your styles across your website on every page. It makes sense. It'd be kind of annoying to have drastic changes on every page.
1034+
1035+
That's where the `<link>` tag comes in! The `<link>` tag is an empty tag (like <br> and <img>), so it has no end tag, and it's used to link to external stylesheets!
1036+
1037+
What the heck is an external stylesheet? Well, put simply, it's CSS, in its own file.
1038+
1039+
You write the `<link>` tag like this:
1040+
1041+
<link rel="stylesheet" type="text/css" href="main.css">
1042+
1043+
Let's take a look at those attributes. The `rel` attribute is for *relationship*. It specifies the relationship between the current document and the linked document, which will almost always be `stylesheet`. I've never actually seen it in action with anything other than `stylesheet`, but if you really want to know other values you can look it up.
1044+
The `type` attribute will also pretty much always be `text/css`. If it's ever anything else when you want to use it with CSS, I will be quite surprised.
1045+
And finally, `href`. You remember this one, I hope! It's just like our `<a>` tag. It is the URL of the stylesheet.
1046+
1047+
Let's check out this `<link>` tag in action. Open up the Linking folder and open home.html, and paste the `<link>` line above on the line below the `<title>` tags in the `<head>`. Voila! That's it. Refresh your browser and check out the magic.
1048+
10331049
Psh like I'm going to write this before I eat another cookie. Break time.
10341050

10351051
## Wut

0 commit comments

Comments
 (0)