4. WHAT CSS IS?
CSS which stands for Cascading Style Sheets is a language used to
describe the appearance and formatting of your HTML.
A style sheet is a file that describes how an HTML file should look like
,thatâs it.
We say these style sheets are cascading because the sheets can apply
formatting when more than one style applies.
For instance, if you say all paragraphs should have blue font, but you
specifically single out one paragraph to have red font, CSS can do that.
5. SAMPLE HTML FILE
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Fancy Fonts</title>
</head>
<body>
<p>I'm a paragraph written in red font, but one of my words is
<span>blue</span>!</p> </body></html>
7. WHY SEPARATE FORM FROM FUNCTION?
There are two main reasons for separating your
form/formatting (CSS) from your functional
content/structure (HTML):
1. You can apply the same formatting to several HTML
elements without rewriting code
(e.g. style=âcolor:redâ) over and over
2. You can apply similar appearance and formatting to
several HTML pages from a single CSS file
8. SAMPLE HTML FILE
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Even Fancier Fonts</title>
</head>
<body>
<p>Much of this is regular text, but some of it is <span>fancy</span>! We
can use our <span>newly fancified font</span> to add some
<span>flair</span> to our website. It'd be a <span>royal pain</span> to
make each of these span tags <span>fancy</span> individually, but it's a
cinch with <span>CSS</span>!</p>
</body></html>
10. LINKING THEM ?
You know you should write your CSS in a totally separate file. But
how do you make sure your HTML file can see that CSS
information?
You do this by putting a <link> tag in between <head>tags of your
html page.
<link> tag needs three attributes:
1. A type attribute that should always be equal to âtext/cssâ
2.A rel attribute that should always be equal to âstylesheetâ
3.A href attribute that should point to the web address of your css file
11. SAMPLE HTML FILE
<!DOCTYPE html>
<html>
<head>
<title>Result</title>
</head>
<body>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<p>I want to be SIZE 44 font!</p>
</body>
</html>