• IMPORTANT: Welcome to the re-opening of GameRebels! We are excited to be back and hope everyone has had a great time away. Everyone is welcome!

How to import a CSS Stylesheet into an HTML File

Burned Designs

Active Member
Joined
May 7, 2013
Messages
43
Reaction score
0
To import a CSS Stylesheet your first going to need to know how to work with CSS and HTML.

CSS : Cascading Style Sheets
HTML : Hyper Text Mark-up Language

Import Code:
Code:
<link rel="stylesheet" type="text/css" href="stylesheet.css">

How CSS Looks
Code:
.text{
color:black;
font-size:12px;
text-decoration:none;
}

How the HTML would look after CSS is imported
Code:
<html>
<head>
<title>title of site</title>
</head>
<body>
<div class="text">
This is the text with the style of the CSS
</div>
</body>
</html>
 

Ace

Well-Known Member
Joined
Jul 7, 2012
Messages
420
Reaction score
0
Right, i'm a complete n00b. How am I supposed to know <div class="text"> defines .text in the CSS? This isn't very n00b friendly, you made a HTML page, you should create more n00b friendly tutorials. :)
 
P

Piracy

Guest
Couple things, 1, you forgot to end the link tag, it's a single tag only so you would put
Code:
<link rel='stylesheet' type='text/css' href='stylesheet.css' />

You also forgot to include it in the HTML file, just saying.


 

Toxique

Well-Known Member
MOTM
Joined
Jan 27, 2012
Messages
3,910
Reaction score
11
Nice to see some tutorials being posted, we need more of these here :)
 

overcast

Active Member
Joined
Jun 8, 2017
Messages
518
Reaction score
19
Thanks for the pointer. When it comes to making single page design, I usually go with the internal stylesheet. I have saved a lot of time and money this way. You can also use the external stylesheet hosted on the CDN. That reduces the loading time too. I know some people make use of the bootstrap stylesheet from the CDN.
 
Top