HTML and CSS Reference
In-Depth Information
LEARNING WHICH FILES WORK WITH THE WEB
If you're new to writing Web pages, the i rst thing to learn is what i les work with Web pages.
Directly, HTML5 recognizes, the .html extension and the three graphic i le extensions
discussed earlier ( .jpg , .png , and .gif ). However, you'll see a reference to .css i les.
h ese are external CSS i les, whether CSS3 or older versions. Likewise, JavaScript i les are
saved with a .js extension, and they, too, may have a link reference.
h e browsers that parse HTML also parse CSS and JavaScript. In fact, you can have HTML
i les with CSS and JavaScript code written right in with the HTML tags. Whenever you see the
<script> tag, you'll i nd either a JavaScript or CSS script in the script container (between
the opening <script> and closing </script> tags). At other times, the developer chooses
to put all the CSS and JavaScript code in external i les and load them using the <link> tag
for CSS and the <script> tag for JavaScript.
For example, the following code loads the external .css i le lookingGood.css :
< link rel = ”stylesheet” type = ”text/css” href = ”lookingGood.css” />
With JavaScript, the external .js i le is called from within the <script> container rather
than inside of a <link> tag. h e following loads a JavaScript i le named doMagic.js :
< script language = ”JavaScript” src = ”doMagic.js” />
31
h is topic concentrates on HTML5, but you dei nitely need CSS3 for formatting, so you'll see
it here a good deal, too. For the most part, you'll see CSS embedded in the HTML code. In
Chapter 3, you learn more about using CSS3 with HTML5. Chapter 12 provides you with a
little JavaScript to use with HTML5 tags, and there you'll see exactly how to create and use
JavaScript with HTML5.
KNOWING HOW TAGS WORK
When you write code in HTML5, you're going to need to know which elements to use to get
what you want. As we saw in Chapter 1, you can change the size and appearance of a font
using the <h1> tag. To get started, you won't be modifying the tags with CSS. When you use
<h1> , you can expect to get the same big black bold text every time. (You can modify it to be
a small green font with CSS if you want, but you'll have to wait for Chapter 3 to see how to use
CSS to do that.)
In a nutshell, your tags work by dividing up your page into sections that begin with an
opening tag <element> and end with a closing </element> tag. You can write all the
HTML5 pages you want using that method and not much else, and your page will work just
i ne. Naturally, you're going to want to create pages with a bit of l air and help the browser
know right of the bat what you're up to, but for the most part, you just write tags. So, let's start
with the basic HTML5 container.
 
Search WWH ::




Custom Search