HTML and CSS Reference
In-Depth Information
his code could be placed in the document's head section or in an external
ile linked from the document's head. he function to assign the body's click
behavior is not deined until the document is ready. jQuery gives the web
developer a simple way to access DOM objects using the same syntax that CSS
uses to select elements for the application of presentation rules. It is one of
many tools that make web programming fun! See Chapter 5, “Building Web-
sites,” for more information on using JavaScript, jQuery, and other scripting
resources to add dynamic behaviors to your web page elements.
HTML5 Syntax
You must learn a few general syntax rules to work with HTML documents.
First, an HTML document consists of text content along with HTML com-
ments , character entities , and markup elements . HTML markup elements
are further classiied into a few categories, depending on what kind of content
can be inside the element.
CoMMEnTS
Comments are the easiest markup element to understand. HTML authors are
encouraged to use comments to annotate HTML source code so that other
people can understand what the code should do. A comment is a string of
characters beginning with <!-- and ending with --> . Comments can extend
over several lines, making them useful for temporarily disabling and enabling
alternative code segments. However, you should be careful not to overlap com-
ments, because that usually results in unexpected content appearing on a page.
Also, avoid using a double dash (--) inside a comment. It is technically invalid
in HTML5, and some older browsers have diiculty processing that sequence
of characters.
Although user agents are supposed to ignore comments, and most do, there
are instances where comments do matter. For example, Microsot's Internet
Explorer browser pays attention to comments containing conditional tests
for certain browser features. In the following code, placed in the head section
of the document, the link element inside the comment loads in the special
CSS style sheet ile ie6.css only when read by version 6 of Internet Explorer or
earlier releases:
<link rel="stylesheet" type="text/css" href="/css/style.css"/>
<!--[if lte ie 6]>
<link rel="stylesheet" type="text/css" href="/css/ie6.css"/>
<![endif]-->
 
 
 
Search WWH ::




Custom Search