HTML5Point SDK Crack + Serial Number (Latest full version)
( Updated : October 23, 2021 )
š„ DOWNLOAD LINK Links to an external site.
HTML5Point SDK provides users with a useful and reliable SDK component that allows them to easily convert PowerPoint presentations into HTML format. HTML5POINT Crack- PowerPoint to HTML5 SDK is a sophisticated SDK How To Crack, patch & activate HTML5Point Full Version for free? You can't download any crack or serial number for HTML5Point SDK - PPT a new blog entry Sam Broadcaster , 13 a la douzaine torrent. full version from the publisher using pad file and submit from users. Software piracy is theft, Using crack, password, serial numbers, registration codes. Using HTML5Point SDK - PowerPoint to HTML5 Free Download crack, warez, password, serial numbers, torrent, keygen, registration codes, key generators is. Software piracy is theft, using crack, warez passwords, patches, serial numbers, registration codes, key generator, keymaker or keygen for HTML5Point SDK. Attention !!! Using crack serial number key generator & cracked registration code unprotectors p2p torrent magnet is illegal and wrong: it prevents developing. Free Download and information on HTML5Point SDK - PPT TO HTML5 - HTML5POINT . Software piracy is theft, Using crack, password, serial. Internet Explorer 9 is the new edition of Microsoft's hugely popular web registration codes, key generator, keymaker or keygen for license key. HTML5 is the most recent update to the HTML standard which is maintained and He teaches Web programming, game development, and Freshman Computer Science.
This is a For Dummies book, so you have to expect some snazzy icons, right? A lot of details here. Watch out! Anything I mark with this icon is a place where things have blown up for me or my students. I point out any potential problems with this icon. Every so often I want to explain something a little deeper. HTML is the predominant programming language used to create Web pages. This book covers the fundamentals for developing Web sites using HTML5 by utilizing clear-cut tasks, code examples, step-by-step instructions, and easy-to-follow advice. This book provides seasoned and new Web programmers and developers with a fast reference for getting up to speed on HTML5. All other trademarks are the property of their respective owners. Wiley Publishing, Inc. For general information on our other products and services, please contact our Customer Care Department within the U. For technical support, please visit www. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. He eventually taught himself enough programming to work as a consultant while pursuing a career in special education. He teaches Web programming, game development, and Freshman Computer Science classes. Dedication I dedicate this book to Jesus Christ, my personal savior, and to Heather, the joy in my life. I also dedicate this project to Benjamin, Jacob, Matthew, and Elizabeth. I love each of you. Thanks to Heather, for being amazing again and again. Thank you Katie Feltman, for another interesting project, and for being a consistent friend. Thanks to Blair Pottenger for all your support on this book. You wrestled this monster into decent shape. Thanks very much to Heidi Unger for your editing help. It took more than a minute to win this one. Thank you Ronald Norman for the technical edit. You found a number of goofy errors that would have confused students. Thank you so much for your vigilance. Thanks also to the many people at Wiley who the author never gets to meet. I appreciate your contributions. Thank you also to the open-source community which creates so many excellent tools. Finally, thank you to my extended family ā the Friday morning guys, and the Sunday evening families. For other comments, please contact our Customer Care Department within the U. They reasoned that a collaborative project like an HTML standard is an evolution rather than a strict milestone. For the purposes of this book, it is important to distinguish between the current state of the art and the evolving standard that is the focus of this work. Companion Resources On the Web Be sure to check out my Web site for working examples of every code fragment in the book: www. New Form Input Types And now for a little reality New Visual Elements HTML is a reasonably simple system of plain-text codes that provide the structure of all Web pages on the Internet. Be sure to check out my Web site for working examples of every code fragment in the book: www. In this part. It has a short but extremely vibrant history. The Internet and the Web in particular has been changing at a dizzying pace. HTML has been trying to keep up. As the Web matured, many features were added. The kinds of devices used on the Internet are changing, too. In the early days, only desktop computers used the Web. Now cellphones and mobile devices are among the most important players on the Web. They require a different way of thinking than the standard desk-based behemoths of a few years ago. HTML5 is that set of standards. A bit of ancient history In the distant mists of time Tim Berners-Lee created a new system of connecting electronic documents. He devised a simple language that allowed document authors to link various documents together with limited formatting options. This language was called HTML. At that point, the Internet existed, but it was mainly accessed by basic command-line programs, and was not easy to use. HTML and some other underlying technologies was designed from the beginning to be easy to work with, and to create documents that were easy for users to manage. The design of HTML was deliberately kept simple, so as many people as possible could participate in the process of building documents in this new format. Of course, the Web took off in a very major way, and soon Web pages became ubiquitous. It became clear that the simple features in basic HTML were not enough to satisfy the interests of the many people who were now building Web pages. And the first browser war begins. By , the Mosaic browser included the ability to add images which were not part of the original specification. Many browsers were being created by small teams all around the world, and each had its own set of new features. By , one platform emerged as the dominant browser. Netscape Navigator was a profoundly successful browser. At the same time, there were working groups. However, Netscape had such a dominant position that Netscape representatives often skipped the standards meetings and created whatever features they wanted. Microsoft did not come into the browser world until For a time sometimes called the first browser wars , Netscape and Microsoft were in an arms race, each trying to produce exclusive features that would steer developers toward their own vision of the Web. While there was a standards body in place, the reality was both Netscape and Microsoft added whatever features they wanted and basically ignored the W3C. There was some small progress made on Web standards. HTML 3. By about the same time HTML 4 was gaining traction, it became clear that Microsoft was dominating the browser space. By , Internet Explorer was used by approximately 95 percent of Internet users. By any measure, Microsoft won the first browser war. Internet Explorer 6 which used mainly HTML 4 was the only browser that really mattered, and there was very little innovation for several years. The Firefox browser first released in in particular was especially important, as it introduced a number of innovative features and followed most of the standards of the W3C working group. These other browsers tended to be more committed to following standards than IE was, and they prompted new versions of IE following a long era of stagnation. Even Microsoft began to at least pay lip service to the notion of standards, promising more standards compliance in each of the new versions of IE introduced. Some consider this the opening of the second browser war, with various developers competing for share of the browser market. However, there is a difference this time around. The Web is no longer a novelty, but now a key part of business and society. A Web-based document is now held to the same visual standards as printed documents, and HTML 4 is simply not capable of easily meeting this standard. In fact, the entire notion of the Web as a series of documents is being challenged. Web pages are being replaced by Web applications. Today, developers are using the Web itself as a programming interface. HTML 4 was clearly not up to the task of supporting modern Web development. The various proprietary tags added through the years added some visual flexibility, but not nearly enough. There was not a satisfying solution for page layout or font management. There was a set of features for entering form data, but these tools were limited and ugly. Most browsers featured a form of the JavaScript programming language, but the implementations varied wildly, and making a real application using Web technologies was a chancy proposition. There was little incentive for developers to adhere to XHTML standards unless they were taking my class. In order to get the functionality that was missing from HTML, many developers turned to plug-in technology like Java Applets and embedded Flash. Java never caught on as a client-side environment although it remains extremely important in other applications but Flash was very popular for a time. Unfortunately, Flash introduces problems of its own. The content of a Flash applet can only be modified by a Flash editor, and it cannot be read at least easily by search engines. Many of the new features of HTML5 particularly the font support and the canvas tag can be seen as a direct response to Flash. Part of the motivation for HTML5 was to create a framework for building Web applications that would really be used by developers. The design of HTML5 indicates these priorities:. The document type in particular is a breath of fresh air compared to the nonsense you have to write to start an XHTML page. Every tag is about describing some feature of the page. Most of the tags are plain English with few abbreviations. One of the original ideas in HTML was markup based on meaning rather than details. HTML5 returns to this tradition, adding a number of new tags to describe common parts of a page. Forms the elements that allow users to enter data in a Web site have been a part of HTML since the beginning, but they have not seen much improvement over the years. However, it was difficult to take JavaScript very seriously because it had a number of limitations. Some limitations were because of legitimate security concerns, and others were simply poor or incompatible implementation. Many of the most interesting features of HTML5 like the canvas tag are mainly improvements in the JavaScript language. A few tags have been added to the HTML 4 standard, and a number have been taken away. Now there are dedicated tags for navigation elements, articles, sections, headers, and footers. This capability will allow for very intriguing capabilities like custom gaming and interface elements. CSS is used to describe how things look. CSS3 now supports new selectors that let you choose every other element, as well as specific sub-elements different types of input tags, for example. Finally, CSS includes the ability to break an element into any number of columns easily. These provide a profound new level of control over the appearance of a page. I describe these features in this book. See Bonus Part 1 for an overview of JavaScript if you need a review or an introduction. HTML5 now allows the developer to store data on the client. There is even a built-in database manager that accepts SQL commands. Server technologies Modern Web development is about communication. However, an equally important part of Web development is a raft of technologies that live on the Web server. Many interesting applications also use database programs like Oracle or MySQL to manage large amounts of data. The advent of AJAX has made integration between those technologies and the browser much easier. Interesting as these tools are, I do not focus on them in this reference book. While HTML5 itself has not yet been ratified as a formal standard, most of the critical ideas are available today. In the first browser war, manufacturers were competing to add new features without any regard to standards. Today, browsers are judged by their adherence to accepted Web standards. The separation of content from layout is a critical part of modern Web development. Officially, HTML5 is not expected to be completely accepted as a standard until This seems like an eternity in Web time. However, parts of the standard such as the canvas tag are universally available right now and are worth exploring immediately. Others like drag-and-drop are simply not ready for use yet. A few like the local data support mechanism are hotly debated, and it is not clear which form of the technology will become part of the standard. As I discuss each of these topics throughout the book, I try to give you a sense of whether it is ready to be used yet, and which browsers support particular features. It can be very confusing to determine which features can be used. There are a couple of good solutions to this problem. A number of sites have charts that indicate which features are supported in which browser. These tools can help you see what is currently supported by the major browsers. Figure shows the detect. Figure The detect. Use it with any browser to get real-time analysis of which HTML5 features are available in your browser. The program uses a script called Modernizr, which automates checking for various browser features. You can get Modernizr for free from www. Checking for features in your code You can also use the Modernizr script in your own code. You can check a variable to see if the current browser supports a particular feature. If it does, you can implement the feature. If not, you will generally implement some sort of fallback. Download the Modernizr script. The Modernizr script can be downloaded free from www. Install the script in the same directory as your Web page. Include a reference to the script. Add a special class to the HTML tag. The Modernizr script needs to have a special tag available so it knows what to do. Write a new JavaScript function. Add a new JavaScript function to do the actual testing. Specific examples are shown in the code listing later in this section. Use the appropriate Boolean property to check for a particular feature. You can look up the variables on the Modernizr site, or look at my detect. Use the feature or an alternative. As an example, the following page uses the Modernizr script to test whether the current browser supports the HTML5 video tag. If so, it also checks for support of the two main video codecs. Figure For more information on the video tag, please check Part 3. The various browsers have differing versions of support. There are several browsers currently available, which all have varying levels of HTML5 support. While there are a large number of browsers available, most are based on a smaller set of tools called rendering engines. It has support for many, but not all features. Gecko 2. Although Firefox is a well-known and respected browser in the Web development community, it does not yet have extremely good support for HTML5. So far, this engine has the weakest support of HTML5 features among all the major browsers. IE9 promises to have much more complete support for HTML5, but even this version is projected to be missing some key features, including advanced form element support and geolocation. Apple then released the code as open source, where it became the foundation of a number of browsers. WebKit is also the foundation of the Google Chrome browser, and the browser on the Android mobile platform. WebKit has become the standard rendering engine for mobile platforms. If you want to see how your pages will look on mobile platforms, you should check with a WebKitbased browser like Chrome or Safari. Most of the. Opera has long been considered a technically superior browser, but it has never gotten the market share it should. A number of gaming and portable browsers are based on Presto, including the Wii Internet Channel, the Nintendo DS Browser, and Opera Mobile, available on numerous cellphones and portable devices. Browser specifications are likely to change. This Wikipedia site tends to have the latest information on what features of HTML are supported by which browser. However, there is an answer. Most of this chapter is a review of standard HTML ideas. The content of this chapter forms a baseline. The code described here works in all modern browsers. As much of the HTML5 content is still browser-dependent, begin with a standard set of tags and elements that work on every browser. This chapter describes this lowest-common-denominator HTML syntax, which is expanded upon throughout the book. This chapter is really an overview. Ideas that were once cutting edge like using frames are now considered out of date. HTML began as a very simple language, which became more complex as it was used more. The following ideas have driven the development of HTML5. Things will get complicated fast. HTML code should be clean and easy to read. Try to keep your HTML code focused on the structure of the code what it means rather than the display how it looks. This keeps the HTML code relatively clean and easy to work with. Use HTML code to determine the meaning and structure of the page. These techniques were the best tools Web designers had at one point, and so they were frequently used to provide visual structure to Web pages. Since the vast majority of users had some form of this browser, any code that would work for this browser was considered standard. Frames added a certain amount of layout support, although they brought their own problems. If you did something wrong, the browser would simply guess what you were trying to say. Often, the guesses were correct. As Web development moved from a hobby enterprise to become the foundation of serious applications, the weaknesses of HTML 4 became more apparent. While HTML 4 was easy to get along with, it was considered sloppy by professional programmers. XHTML especially the strict version was much more precise and predictable, making it popular among higher-end developers. Every tag must have an explicit closing tag. The HTML 4 standard was so loosey-goosey that nobody could tell if a page was formatted incorrectly. With XHTML, it became possible to run a special validation program that could find structural errors in your code. By the time HTML 4 came out, it added numerous tags for handling the visual aspects of a document. While these tags did their jobs, they did not provide enough control, and moved away from the central idea of HTML. XHTML strict removed all layout tags. While this is true, it never turned out to be quite as important as people thought it might. Top designers enjoyed the newfound freedom of CSS. However, XHTML was a little too unforgiving for most developers, and the vast majority of pages never bothered to validate to the new standards. Even people who taught classes and wrote books about it like, um, me never memorized the doctype, but had to copy and paste it every time. Likewise, frames and table-based layout are discouraged in favor of CSS-style layout. Validation is an easy way to eliminate goofy coding mistakes, and can greatly simplify your coding once you start adding programming support to your documents. HTML5 is designed as a central glue that ties together many other technologies: CSS for visual layout, JavaScript for client-side programming, server-side languages like PHP for server control, and databases. Many of the new features are not technically HTML but advances in the various other related technologies integrated databases, new JavaScript syntax, new CSS features, and so on. Note that the text is automatically wrapped. Be sure to look at the actual page on the Web site www. Begin with the doctype. The doctype definition should be on the first line of your Web site. Consult any science fiction movie to see what happens when computers make guesses about things. This special tag indicates the beginning of a Web page. The head is something like the engine compartment of a car. The head is empty in this simple example, but it will fill up with JavaScript and CSS goodness soon enough. Specify the character set. Indent your code. Add a comment. Typically the comments in this book will be a brief summary of the purpose of the page. Comments can last over several lines. This tag allows you to specify a title for your page. If the head area is the engine compartment, the body is the passenger space. Use heading tags to describe your outline. The heading tags all begin with h followed by a number indicating the strength of the heading. All your main topics should be denoted by level-one headings. Place most of the text into paragraphs. This will make it much easier to manage the look and behavior of your text later. Save your file with the. Be sure to save the file with a. You can then load the file into a browser to see how it looks. Some of these elements especially the headings will tend to have a particular visual style. The default styles are just there as guidelines. Avoid the temptation to pick headings based on their appearance. HTML5 adds a few new elements, but for now, stick with the base that works in every browser. Adding images Web pages are capable of far more than text. Figure shows a page with an embedded image. Figure Images are pretty easy to add to Web pages. Identify the image you want to use. Of course, you have to have access to an image before you can use it. Be sure you have permission to use the image in your site. Modify the image if necessary. You may need to adjust the image for use on the page. You can use commercial image-manipulation software, but I prefer IrfanView or Gimp for this kind of work. Links to both of these free programs are available on my Web site www. Choose your image type. Web browsers can display. If your image is in another format, use a tool like IrfanView or Gimp to change it to one of these Web-friendly formats. Put your image in the right place. The image file should be in the same directory as the HTML file. That way, when you post your page to the server, it will be easy to move the image as well. Build your page as normal. The image will be placed with a tag embedded into the body. This tag needs to be embedded inside a paragraph or div if you want the page to validate correctly. Use the src attribute to indicate the file containing the image. If the image file is in the same directory as the Web page, all you need is the name of the image. Include the alt attribute describing the image. The alt attribute contains text describing the image. The slash character at the end of the tag indicates that the tag is a one-shot tag that serves as its own ending tag. Links are one of the things that make the Internet so cool and powerful. Figure shows an example with two different kinds of links in it. They display text on the page, but when the user clicks the text, the browser loads a different page on the Internet. Building links into your pages is quite straightforward. Begin with an ordinary page. Links are usually embedded directly into your page. Links cannot stand on their own, but are usually part of some other block-level element like a paragraph. The a stands for anchor. I know; it should be the link tag, but that term is used for something else in HTML. Utilize the href attribute to describe where the link will go. Most links have an href hypertext reference attribute, which describes what page should load when the user clicks the link. The href can be a relative or absolute address. This is known as a relative reference because the browser assumes the linked file is in the current directory of the current server. The first link of my example points to the monkey image in the same directory as the page itself. If you prefer, you can give the entire address of a Web site. This is known as an absolute reference because it explains how to find the file regardless of the location of the current page. The default format is blue underlined text. You find out how to change that and many other display tricks in Part 5. The file you link to can be a Web page or anything else the browser can read. The first link on linkDemo. Most links point to Web sites, but you can also link anything the browser can read, including images. Making lists and tables Pages are often about data, and data is often organized into lists. Figure illustrates a page with a series of lists on it. Figure The page in Figure shows two main types of lists and a combination list that nests one type into another. When you use CSS described in Part 5 to style your lists, you can have many different kinds of marking, including numbers, Roman numerals, bullets, or custom graphics. Optional Nest lists inside each other. This is the technique used to build the nested lists in the example. Just be sure to close off one list before beginning a new one. Utilizing tables Sometimes you will encounter data that is best presented in a tabular format. HTML has a full-featured table system for exactly this purpose. For example, consider the table displayed in Figure The process for building a table is not difficult, but it does require some forethought. Plan your table first. You should know how many columns you will have, and which rows or columns will be headlines. The table is defined with a series of rows. Some cells will contain headings, and some will contain actual data. Often, the top row will contain headings sometimes the left-most column will, too. By default, such cells are generally bolder and centered, but that can be changed with CSS. Most of the cells in your table will be specified by td tags. Keep the number of cells consistent. Each row should have the same number of cells. Although there are techniques that allow you to extend a cell across multiple rows or columns, I stick to basic techniques in this introductory part. Add CSS as needed. Tables do have a basic format, but as usual, you can change things with CSS. Do not use tables for layout. The early versions of HTML did not have adequate support for layout creating columns and precise page layout. Clever HTML developers came up with all sorts of hacks using tables to simulate a layout system. CSS covered in Parts 5 and 6 provides all the page layout techniques you need, so use of tables should be restricted to its original purpose: presenting tabular data. Making a Form From the beginning, Web pages have had the ability to gather data from users. HTML has a standard but quite useful set of form elements that you can use to get input. Figure shows a form containing all the main HTML form elements you might encounter. I show you the entire code here so you can see how it fits together, and then I explain how the various parts work. The form elements shown in this example are available in all current versions of HTML. All the form elements are enclosed inside this tag. This indicates that you do not plan to call a server-side script when the form is submitted. It is not required, but it can make complex forms easier to navigate. By default, a fieldset has a single border around it, but you can change this with CSS. It acts as a label for the entire fieldset. You can use the optional for attribute to specify which input element the label is associated with. Label tags are normally used to make CSS styling of forms easier to manage. Proper use of these tags and CSS often makes your forms much easier to work with than the older table-based hacks. Constructing text input Many of the form elements are based on the input tag. This workhorse is a generalpurpose tag used to make a number of interesting input objects. The type attribute is used to determine what type of element the tag creates on the page. By far, the most common input element is the basic text box. Create an input element. This indicates you are building a standard text element, not something more elaborate. Add an id attribute. The id attribute allows you to name the element. This will be very important when you add JavaScript to the page because your JavaScript code will use the ID to extract data from the form. Add default data. You can add default data if you want, using the value attribute. Any text you place in the value will become the default value of the form. The text element will place a small box on the screen. When the user selects the box, the cursor will change to an I-beam, and the user will be able to type text into the box. See Bonus Part 1 for information on using JavaScript to read data from forms. Creating password fields The standard input element has a cousin that is sometimes used ā password. The code for the password looks a lot like the code for a standard input element. When the user types data into the text field, the actual contents of the field are replaced by asterisks. This prevents evil henchmen from looking over your shoulders to discover your password. When it is used to send a request to a Web server, that request is normally sent in the clear, where those evil henchmen are sure to find it. In JavaScript processing, the situation is even worse because the code used to retrieve the data will be freely available to the browser. JavaScript is not the language to use if you want to keep a lot of secrets. The text area element is perfect for this situation. This tag indicates the beginning of a multiline text box. Specify the number of rows. Indicate the number of rows or lines of text you want the text area to contain. Larger boxes accommodate more text but require more room on the screen. Indicate the number of columns. The number of columns shows how wide in characters the text box should be. They are nice because they allow the programmer to specify a number of choices. The user can choose a selection without typing. Drop-down lists have one more incredibly important attribute; they prevent certain kinds of errors. The limited options make the response very predictable. When you allow the user to type information into a form, it can be very difficult to check for all the crazy things the user might enter. Give the select element an ID. Add an option element to the select element. I normally indent the options to remind myself they are part of the select object. Give each option a value. The value will be the response sent to a program when the user chooses an option. The user will not necessarily see the value. Indicate the text the user will see. This can be different from the value, or the same. That will make more sense after you do some JavaScript coding. Add as many options as you want. Create a new option object for each choice you want to have available in the list. If you want the box to take up more vertical space on the page, just specify the number of rows with the size attribute. The checkbox element is perfect for this kind of input because the user can click to select or deselect the option. This way, the user can click the checkbox or the associated label to make a selection. Checkboxes often appear in groups, but they are independent of each other. Begin with an input element. Checkboxes are just another form of the input element. Set the type attribute to checkbox. This clarifies that the input element will be a checkbox. A small checkable box will be placed on the screen. Give the element an id. Specify a value. You can attach a value to a checkbox. Add a label. Checkboxes really need to have a label associated with them so that the user will understand what the checkbox is about. The label of a checkbox is usually applied to the right of the checkbox. Add the for attribute to the label. The label has a special attribute called for, which allows you to specify which input element the label corresponds to. Place the id value of the checkbox into this attribute of the label. This is especially useful for checkboxes because in most browsers the user can click either the label or the checkbox to trigger the selection. Associating the label to the checkbox gives the user a larger target to click on, and makes the form easier to use. Popping in radio buttons On the surface, radio buttons seem a lot like checkboxes, but they are different in a number of important ways. You can have one checkbox on a form, but radio buttons make sense only when they are placed in groups. In a radio button group, selecting one button deselects the others. When you build a radio group, you should always make one element of the group selected. If not, any programs attached to your form will get confused. Each id on a Web page must be unique, and the id elements of each radio button will follow the same rules as usual. The name attribute is used to specify the entire group of radio objects. HTML uses the name attribute to figure out which group a radio button is in, and to ensure that only one button in a group is selected. Building a radio group is quite similar to creating checkboxes, but there are a few differences. Begin by creating an input element. As usual, the input element provides the basic foundation. Set the type to radio. Use the type attribute to form radio buttons. Give each element a unique id. As usual, apply a unique id to each radio button. Give all buttons in a group the same name. Use the name attribute to identify the buttons in a group. Consider visual grouping as well. It might be best to use fieldsets or other formatting tricks to help the user know which buttons are in which group. All buttons in one group should be physically near each other. Making a Form 39 6. Make one of the buttons checked selected by default. Putting in action buttons One more critical form element is the ubiquitous button. Buttons are great because they just sit there looking irresistible. Users normally expect something important to happen when they click a button. There are actually three main types of buttons, although they all look identical to the user. These buttons are usually used in JavaScript programming to trigger some kind of action on the client end. You use this type of button a lot in JavaScript. It packages up all the data in the form and submits it to a program that lives on a remote Web server. When the user clicks a reset button, all the data in the form is reset to its original default values. In addition to the three types of buttons, button elements can be created in two different ways. The type attribute is used to indicate which type of button you want to use. The text inside the button indicates the text printed on the button. It would be great if you had some sort of tool that acted like a spell-checker for code. Fortunately, there is exactly such a code-checker available. More troubling, the error messages it gives you are sometimes very mysterious and not very helpful. HTML5 introduces a number of new tags. In addition, a few old friends have new variations. This part takes a look at the new tags and also discusses how some of the old tags have changed. That is, tags are not supposed to describe how a section of the page looks, but instead should describe the meaning of the section in the page context. The semantic page elements added in XHTML are meant to add firstclass tags to a few elements common on every page. Other tags especially anchors to e-mail addresses or page links can be embedded in the address. Typically, articles are used to mark sections of the page that are brought in from some sort of aggregation system. AJAX is one such technology. In this book, you learn what all the fuss is about and why AJAX is such a big deal. Most articles will include a link to the original page if the article is from an online document. It only indicates that the relationship is external. Note that if the article contains a header tag, it is appropriate for the article to have its own h1 heading. This allows page aggregators to pull pages from multiple sources and apply appropriate formatting. Aside text is typically formatted as a sidebar. Instead, the CSS will determine where the footer actually goes. Most browsers do not provide any default formatting to the header. The Web developer is expected to add any desired formatting through CSS. It can be used inside a section or article to indicate that an h1 inside that element is a level-one heading for the element, not for the page. This is useful because a page should have only one level-one element. The normal heading structure is intended to serve as an outline for the page. Using an h1 heading with an immediate h2 as a subhead interferes with the outlining capabilities. You can put multiple headings in an hgroup, and only the initial heading is considered by automatic outlining tools. Additionally, the menu element does not have any particular visual display associated with it. None of the major browsers display menus with commands yet. In HTML 4, the menu item was a type of list. The Web developer is expected to add CSS to determine how the element will look and where it is placed on the page. A page or an article can be broken into numerous sections. Use the detect script described in Part 1 to see if your browser supports this or any other tag before you try to use it. Inline Semantic Elements In addition to the page-level semantic element which adds structure to the entire page , a number of other new or modified tags are intended to add new elements inside a page. This can be command, checkbox, or radio. The types correspond to the same types in ordinary form input elements. By default, only the summary is visible. When the user activates the details by clicking on the summary, the rest of the content in the details element is displayed. This allows a convenient way to hide and show content. The dfn element does not replace the definition list, which is still used for many types of name-value pairs although it was designed originally for definitions. So far, browsers do not provide any particular style or formatting for figures and captions, but these items can be styled through CSS. When the user clicks the summary, all other content in the details element, which was previously hidden, becomes available. Both the summary and the details will be displayed. This field will contain a date, a time, or a date and a time. Data encoded in time elements should be formatted in a standard way so they can be adjusted for time zones. Inline Semantic Elements ā Media Elements 49 wbr The wbr element is used to add suggestions for word breaks. Put this tag inside a long word to indicate the appropriate place to break the word for word wrap purposes. At long last, HTML supports audio and video without an external plugin. Equally exciting is the support for vector-based graphics through the canvas and svg mechanisms. Or you can embed a Flash player for older browsers. Browsers differ on exactly how the controls appear. This can prevent the buffering that might occur if the audio is not preloaded. However, the actual audio file formats are not codified in the standard, so different browsers naturally support different formats. The following code invoked in body. Surprisingly, there is no stop command. The next play command begins at this spot. This is mainly used to attach a src to the audio element. You can read it to find the current position, or set it to cue to a particular part of your song. You can set or retrieve this attribute through JavaScript code. The HTML simply sets aside a portion of the screen to be used as a canvas. All the drawing and manipulation of the image is done through JavaScript code. The following HTML code sets up a canvas element and provides a button. To do anything interesting with the canvas tag, use JavaScript to extract a drawing context a special element that can be drawn on and use the methods of that context object to create dynamic graphics. Figure Most modern browsers support some form of the canvas tag directly. IE currently does not support the canvas tag, but you can use the ExplorerCanvas plugin to add canvas functionality to IE. IThe IE9 beta appears to support the canvas tag, so this may soon be a universal element. At the moment, there is only a 2D drawing context available, but support is eventually planned for a 3D drawing context that will allow 3D graphics directly in the browser. The context object controls all the actual drawing functionality. The arc is defined like a circle, with a center and radius, but also with beginning and ending angles. See the preceding example for a custom circle function created from the arc command. Normally a path is defined by a single moveTo command, followed by a series of lineTo commands, and finished by a stroke, closePath, or fill. This can be a standard color value, or a predefined gradient. The lineTo command takes a point as input and draws from a previously defined point to the current point. Note that the path is not displayed until the application of the stroke function. Note that paths are not immediately drawn; the stroke command actually draws the path on the screen. Most drawing contexts support dotted and dashed stroke styles, but more are expected. This support is uneven, but it is likely to become common in future implementations. The canvas tag is one of the most important new features of HTML5, as it allows nearly unlimited control of the visual interface. Game developers have begun creating online games using the canvas, and it has already become the basis of several innovative user interface experiments notably Google maps. It can theoretically, at least be used to embed any kind of media into the page, specifying the type of media that is to be displayed. It uses the type attribute to determine the appropriate plugin to use based on MIME type. Even if it is, the particular plugin used to display the element is controlled by the client. Use embed only as a backup to a more reliable tool like the img, audio, or video tags. The embed element is still the best option for including Flash elements, particularly as a backup to the audio or video elements. Multiple sources can be listed. The browser will try each source in order until it finds one it can use. This is the preferred way to indicate multiple possible encodings in an audio or video element. Media Elements 55 The output of the svg. Each element is described by a tag, which has various attributes defining its size, position, and color. SVG is often used to create charts or other visualizations dynamically. The main advantage of a vector-based image format like SVG is the ability to scale the image without losing image quality. With this tag, developers will be able to embed videos into a Web page without requiring a plugin like Flash. It will not surprise you that all the browser manufacturers have a different opinion about which format will be supported. At the moment, there are three main video formats in contention. The Ogg system is unencumbered by any known patents. All three formats are subject to patent restrictions. This format is supported by Safari, Chrome, iPhone, and Android. IE plans to support it in IE9. It uses the VP8 video encoding format and Vorbis audio encoding. You can use the free FFmpeg tool available for all major software platforms to convert your videos. You can use JavaScript to control the video element in the same way you control audio. Ruby Elements The Web is a truly international phenomenon. HTML5 acknowledges this phenomenon with a series of tags that support Ruby, a form of markup used primarily with Asian languages. Note that Ruby is also the name of a programming language which originated in Japan sometimes used in server-side Web development. It contains a pronunciation guide to the preceding character. At the moment, no major browsers support any of the Ruby markups. As Web sites have morphed into application frameworks, the basic form elements are beginning to show their age. A number of tools including XForms and third-party add-ons like jQuery UI have tried to give form elements a face-lift. HTML5 finally adds some much-needed attention to form elements. The standard includes several new form elements as well as a number of additions to the standard input element and new attributes that can be applied to any form element. Each of these new tools adds a new capability. A notable subset of these form elements are designed to let a program modify a part of the page dynamically. As soon as the user begins to type in the text field, the list of suggestions appears and the user can choose from the suggestions with the mouse. Browsers that can support the datalist will do so, and others will display the select element. A number of other fields notably the number input type have a list attribute that connects that element to a datalist. This is intended to allow a datalist to be connected to other kinds of input, but there is little support yet for this behavior. All form elements are supposed to be embedded in some sort of block-level element, and the fieldset is the obvious tool for the job. By default, the fieldset draws a simple black border around its child tags. This is normally specified by the server. The keygen element is hotly debated in the HTML5 community. Some security experts consider its encryption mechanism already obsolete, and use of the tool requires knowledge of encryption that a relatively small number of Web developers possess. The label tag allows you to attach an HTML element to a form input element. The for attribute holds the id of the element related to the label. Form elements are often embedded into labels to simplify CSS formatting, and the label can offer some user-interface advantages. For example, if a label is attached to a check box or radio option, the user can click the label or the option to make a choice. Some Web developers embed an input tag inside the corresponding label for easier CSS formatting. I use that technique throughout this reference. Use of fieldsets, labels, and some basic CSS eliminates the need to use tables for form layout. The value, high, low, and optimum values should all be between min and max. No particular display mechanism is indicated for this element, though the webkit-based browsers currently display a small bar graph. Note that the meter element is used to output a numeric element. The meter tag is often used in a form, but it can occur anywhere in a document. The value of the meter can be changed dynamically through JavaScript like the value of any form element. New Form Elements 61 output The output element is meant to display text output. It indicates a section of the page that will be modified by a script usually JavaScript. The output element is currently supported by Opera. It does not have any particular visual style associated with it. Until usage of this element becomes more widespread, you can use the innerHTML attribute of any page element to change its content dynamically through code. These new attributes and capabilities can be applied to any form element. If an element has this attribute, that element will be the focus of the first user input. Of course, it makes sense to have only one autofocus field per form. If the content matches the regular expression, the field will be considered valid. The pattern attribute should be used only when the standard validation techniques are not sufficient, as it can be difficult to debug regular expressions. The title should indicate what the pattern is. The browser can use this as a tip for the user. It may also be useful to add pattern information as placeholder text. See the next section for more information. This placeholder acts as a temporary label showing the purpose of the field without requiring a label tag. As soon as the user activates the field, the placeholder text disappears. Other browsers will simply ignore the placeholder attribute. Likewise, if the field is already filled in, the placeholder will not be visible. Some browsers will also send a warning if the user tries to submit a form with empty required fields. For example, an e-mail. Typically programmers use tricks like regular expression parsing in JavaScript to ensure the data is in the right format. HTML5 promises a much easier solution. If the entry is not valid, the form will generally not submit, and the special :invalid CSS pseudo-class will be associated with the invalid field. For example, if you have a color field and the red background CSS style defined here, the color field will have a red background unless the user enters in a valid color a recognized color name or hex color value. Likewise, the e-mail field will show red until a valid e-mail address is entered. Simply add CSS to display invalid entries, and the browser will do the rest. Note that if a field is required with the required attribute , it will be considered invalid until it contains some value. If you want, you can turn off the validation for any field by adding the novalidate attribute to that element. This same element is used in HTML 4 to build many different types of interface widgets, from standard text and password fields to radio buttons and check boxes. Note that the standard indicates that the various types will be supported, but the exact way the elements are supported will vary from browser to browser. For example, the e-mail field will likely look just like an ordinary text field to a user with a standard desktop machine, but the virtual keyboard on a mobile device might change to include the when it encounters an e-mail field. The browser may display a color-picking tool like the ones found in word processors and image-editing programs. At the moment, most browsers simply display a text box and indicate whether the current content is a valid color name or value. Some browsers Firefox 3. Still other browsers Chrome will include both text and a pop-up calendar. If the date is entered by text, it must be entered in a yyyy-mm-dd format. It also includes a mechanism for entering the time zone. Others may modify virtual keyboards for date and time input. Another dash is placed between the month and the day. Another colon will appear between the hour and minutes of the time zone offset. Typically this is 00, but it is possible that the time zone will be offset by 15, 30, or 45 minutes. For example, PM on October 11, , in New York City will be indicated like this: T If the user is using a browser that validates a dateTime field, the date and time will need to be in this format to be considered valid. The value of a dateTime field will be in this format, which is relatively easy for computer programs to parse and manage. New Form Input Types 67 The datetime-local input type expects and returns a date and time in the same format as the standard datetime element, except datetime-local does not include a time zone offset. Also, it is possible that the browser will modify the user experience in other ways. For example, mobile browsers may modify the virtual keyboard to include the symbol, which is always present in e-mail addresses. It frequently pops up the same calendar control as other date pickers, but only the year and month yyyy-mm format are returned. This often consists of a text field followed by some kind of selector for example, up and down arrows , or it might change the virtual keypad of a portable device to handle only numeric input. If there is an onscreen input element, it will not allow a value less than the min value. The field will also not validate if the value of the field is less than the min value. If there is an onscreen input element, it will not allow a value larger than the max value. The field will not validate if the value of the field is larger than the max value. However, current browsers that support this tag Opera and Chrome do not seem to validate as well with floating-point values as they do with integer values. For more control of numeric input, consider the range input type. See the next section. Userinterface experts have known for years that user input of integer values is very difficult to get right. Most user-interface toolkits have some sort of slider or scrollbar mechanism, which makes it easy for users to enter a numeric value visually. If the browser supports the range tag, the user will see a scroller; if not, a plain-text input type will appear. One solution is to pair an output tag to the range, and use JavaScript to update the output when the range is changed. It does sometimes have some special behavior. On Safari, the search field is displayed with a small x, which clears the contents of the search. On Chrome, the autocompletion features of the main search bar which is also the URL input element in Chrome are automatically applied to the search box. The fallback is a plain-text input. It expects three digits followed by a dash and four digits. You may need to play with the pattern attribute if you want to allow an area code or extensions to validate. Time is stored in hh:mm format, where hh is the hour in hour format , and mm is the minutes. Some browsers will include a colon directly in the field, and some will modify the virtual keyboard with numbers and the colon character. Some browsers will pop up the standard calendar control. When the user selects a date or a week , only the year and week will be returned. Other browsers will simply validate for the proper format. The original plan was for HTML to be more tied to the meaning of page elements rather than their display. In the very early days of the Web, this was fine, but soon people wanted far more sophisticated design elements than HTML was capable of producing. Browser manufacturers responded by adding vendor-specific tags that added new capabilities but greatly complicated development efforts. This part is a review of CSS as it currently stands. The CSS described here works on all major browsers. For each of these tag groups, you can then identify a number of rules. Take a look at the simple page displayed in Figure The new elements are not terribly surprising, but they are quite powerful. Note that the colors are changed without changing anything in the HTML body. All the real action happens in a special part of the header. This is part of the charm of CSS. It makes your HTML a lot cleaner because much of the formatting can go elsewhere. Begin with clean valid HTML code. Be sure your HTML code validates before trying to do too much else with it. Indicate the tag you want to modify. The first tag I change is the body. Changes to the body tag will affect the entire visible part of the page, so this is a great place to start. Just type the tag name without the angle braces. You may have several rules to describe how the body should be displayed. Denote the background-color attribute. Every rule consists of an attribute and a value. The attribute is a built-in characteristic of the element, and the value is the value we want to give that attribute. For now, change the background color of the background, so type background-color:. Note that you must end the attribute name with a colon :. Capitalization and spelling count, so be careful. Indicate the value you want to apply to the attribute. For this example, I want a yellow background, so I just type the value yellow; after the attribute background-color:. End each value with a semicolon ;. Every value must end with a semicolon. If one tag has a lot of rules which is common the semicolons help the browser separate all the various rules from each other. Change the foreground color with the color attribute. Note how I make the level-1 headline red. Set h1 as the new tag, and set its color attribute to the value red. One tag can have multiple rules. Take a look at the rules for the paragraph p tag. You find more about which colors you can use in the next section. For now, though, just play around with the various color names. Most of the common color names will work just like you expect. Employing local styles CSS has a rich mechanism for working with colors. Whenever you want to specify a color, you can simply type the color name. Figure demonstrates the 16 color names that CSS understands. The namedColors. Next to the color name is a table cell with the background color set to that color. Note that in this case, rather than having one large style sheet at the top of the document, I added several smaller styles directly inside the body of the HTML page. This technique is called local styles. Most HTML tags have an attribute called style. You can add CSS rules directly to this style if you want. Still, the technique is useful in a few circumstances, like this example. Making use of ids and classes CSS is pretty useful because it allows you to quickly add a style to all the elements of a particular type. For example, you can very easily make all the paragraphs on a page have the same color. But what if you want to apply a style to only a single element? And what if you have two kinds of paragraphs that should have different styles? Figure illustrates the CSS way to solve exactly these problems. Ordinary paragraphs are light blue with dark blue letters. There are two special kinds of paragraphs. One paragraph has a special name fancy. The fancy paragraph has its own styling. Take a look at the code and then I explain how it all works. They will be styled according to the regular p style rule. This property allows you to specify a name for any HTML object. The id must be unique, meaning that only one object on the screen can have any particular id. The id can be anything you want, but it should be one word without spaces or punctuation. If an object has an ID, you can apply a style to that particular id. The class attribute allows you to indicate that an element is a member of a particular class. Unlike the id, you can. The alternate paragraphs all have the class attribute set to alternate. You can use any term you want as a class name, but it should not have spaces or punctuation. You can apply a style to all elements with a certain class. Different kinds of elements can all have the same class, so you can apply the same class to paragraphs and headings if you want. Use the number sign in front of the id in your CSS to indicate you want to style an element with that id. For example, you can style all elements of the alternate class with this code:. Use the tag name when you want to attach a style to all the elements of a certain type. Use the class mechanism when you want to attach to a number of elements that may or may not be the same type. This is a good way to specify styles for a specific page. This approach allows you to share a set of style rules among several pages. It also cleans up the main page, as the styles are moved out of the way. Figure demonstrates a simple page that uses an external style sheet. They are called in from a separate file, which can be reused by other pages. The secret is the link. This tag allows you to bring in a style from a separate page. To build an external link, follow these steps: 1. The link tag allows you to associate another file with the current page. It is very useful for attaching a style sheet to a Web page. Set the rel attribute to stylesheet. The rel attribute specifies the nature of the external file. Use the stylesheet value to indicate that you are attaching a style to the page. Specify the location of the style sheet with the href attribute. Use the href attribute to indicate where the style sheet is on the file system. This allows you to move the page and the style sheet to the server together. You can use the same style sheet over and over. Multiple pages can use the same style sheet. This is perfect if you have one site that will have many pages using the same style. You can then change the style on one page, and the new style will be reflected through the entire site. The external style is another standard text file that can also be edited with a plaintext editor. It simply contains the style rules. You can modify the main areas of a page by changing the appearance of text, adding borders and background images, and changing the overall layout. Comprehending hex colors For basic colors like red and yellow the color names are perfectly fine, but sometimes you need something with a little more sophistication. Color names. For example, ask yourself what color has just a little more green than aqua? CSS has a more specific way of indicating colors. Each dot on a computer monitor is actually three different tiny color emitters: red, green, and blue. The computer can adjust the amount of color that comes out of each of these emitters. If you want to see a red dot, the red emitter is turned to full strength and the green and blue emitters are turned completely off. You can combine the emitters to get various colors, so red and green makes blue. You might be confused that red and green makes blue, because in elementary school art class, they taught you a totally different way of mixing colors. Both are actually correct. In elementary school, you start with white paper and use pigments to subtract color values. Paper art normally works in a subtractive color model as does your computer printer. The monitor starts with blackness and adds various amounts of colored light, so it evokes an additive color model. While the approach is different, the result is the same. If you want to specify a particular color in the computer world, you can specify how much red, green, and blue respectively are used to make the color. It would make sense then for red to be the color , 0, 0. Computer organization works in a different way, so color values actually range from 0 to To make it even worse, technical people often convert these numbers to base 16 hexadecimal notation , which brings in all kinds of crazy numbers and even letters. Each value red, green, or blue takes a twodigit value that ranges from 00 completely off to FF full brightness. This funky system is called hexadecimal notation often abbreviated hex. Look at the color tester program shown in Figure Feel free to look at the source code to see how it works. For now, use the program to see how these hex values can be used to specify colors. First, note how the page is arranged. The page background will change colors to reflect the current color settings. There are columns for red, green, and blue. The gray buttons can be used to set a color value to a specific setting. Brighter values FF are on the top of the stack, with lower values 00 on the bottom. As you click the various buttons, the background color changes to reflect the current color, and the heading changes to indicate the hex value of the current color. Web developers often begin with preset values in the ranges shown on the buttons 00, 33, 66, 99, CC, and FF. These values provide a reasonable range of colors while being easy to modify. Of course, you can use values besides the presets. You can use hex color values anywhere you use color names. Hex values have a number of advantages over named colors. Only 16 named colors are officially recognized by CSS although most browsers can read many more. With the hex system,. Managing the Appearance of Your Page 85 you can actually represent more than 16 million different colors. Even if you stick with the CCFF system, you have colors to play with. You can directly tweak the hex values to get variations of the basic colors. Most computer graphic programs use the hex notation, so you can sample a color in your graphics editor and match it in your Web page. This marvelous tool lets you play around with various color schemes in real time, and then generates the hex codes you can use in your own page. See Part 6 for more information on these new developments. Editing text Web pages are primarily about text, and CSS has many great features for manipulating text. Figure shows a page with a number of text effects: Figure Each paragraph has a class identifier to specify how it should be styled. The styles are handled by textManipulation. The last paragraph actually combines two classes. It calls both the center and underline classes. The style sheet is where all the fun stuff happens. It uses a number of CSS rules to clarify how the various paragraphs should be styled. Look at the overall code, and then I break it down to show the details. The class names indicate the various effects, and each class contains a single rule to generate that effect. Valid options for this rule are italic, normal, and oblique tipped backwards. The most common values are bold and normal. The most commonly used values are underline, overline, line-through, and none. Most common values are center, left, right, and justify. Note that this attribute is used to align text inside an element only. Part 6 explains the wonderful new font techniques that overcome these problems. This attribute can be measured in many ways, but the safest approach for Web development is to specify percentage of the base font. You can use traditional measures like points, but they have less meaning and reliability in the Web setting than in standard print application. This is a potentially useful design element, but it can also be very helpful when debugging a page layout. This can use the standard CSS measurement schemes, but borders are usually measured in pixels px. Border color is specified with a color name or hex value. Figure shows the possible border styles. Figure Generally, the various border attributes are combined into the single border property, which allows you to specify width, style, and color all in one. For example, you can specify border-top to draw a line above an element, and border-right to draw to the right of the element. Each of these miniborders can be given the same list of value as the standard border. Putting in background images You can add a background image to any element. Figure illustrates a page with a background image. The heading uses a lighter version of the background, and the paragraph uses a solid color background. Choose a background image carefully. Any of the standard Web formats png, gif, or jpg are fine. Place the image in the same directory as your page. That way when you move the page to a server, you can easily move the associated images as well. Add a background image to the body tag. This will apply an image to the entire page. Of course, you can also apply images to any other element you want. Specify the URL of your image. The value of the background image has a unique syntax. Consider modifying the background. You can change the background image by using a number of other CSS attributes: background-repeat. Test your page. Make sure your background image is not too distracting. Background images can be problematic. Take a look at Figure for an example of this phenomenon: Figure Inappropriate background images are one of the most common beginner mistakes. Most interesting photos have a lot of contrast. There are a couple of standard solutions to this problem. You can either provide lower-contrast versions of your background images, or you can use plain colors as the background of elements that feature text. The entire page has the rope background thanks to Julian Burgess for the great image , but the title has a lighter version of the image ā and the paragraphs use a solid color background. Use the adjust colors tool to make an extremely dark or extremely light version of your image. Use a darker background with lighter text, or a lighter background with darker text. Better yet, look to Part 6 for information on how to make partially transparent backgrounds with CSS. This allows you to add a highcontrast background that still allows you to see the underlying image. Table-based hacks used to be the best way to get a page to act correctly, but now CSS provides a number of useful tools for managing the position of elements. Thefloating-position works by defining the relationships between elements rather than specifying exactly where each element goes exactly. This can be a hard idea to get your head around, but once you understand how floating positions work, it is an extremely flexible and useful system. Once you get the idea, you can use floating positions to set up a page that works very well on a variety of browsers. Figure shows a typical form with no CSS applied. Most of the form elements are inline elements. That is, they must exist inside a block element. Most forms have this general structure: labels to indicate what the user is to enter, and input elements to accept the user input. This is a relatively new development in HTML. With CSS, you can provide whatever formatting you want. Most forms include one or more buttons. The real action happens when the user clicks a button. Because the button will have different formatting than the input elements, I use the button tag to describe it. The HTML code simply describes the intention of the various elements, not their formatting. CSS will handle that. You can tell what everything is just by looking at the code. The general structure of the form looks a bit like a table, but not quite. The goal of the CSS is to take this very clean data structure and make it look visually like a table without having to muddy the HTML code with actual table tags. Typically, we want forms to look more like a table. CSS provides a simpler solution. Getting to know the display types To understand how to make a form display like a table, you need to understand a little about how Web browsers manage page layout. It takes very little CSS code to turn the form into a basic table-style format, but the code can be mysterious. The secret has to do with the way HTML lays out pages. Block elements like h1 tags and paragraphs typically have line breaks before and after themselves. The float attribute described in this section is one example. All the HTML tags have their own default display mechanism inline or block. You can alter the way a tag is displayed by changing its display attribute. You can also add an alternative placement scheme by changing other CSS attributes. Take a look at Figure to see how this is done. The only difference is the inclusion of an external stylesheet: formBlock. The code for formBlock. This forces the page to a stacked look, but more importantly, it sets the stage for a nicer layout. Using Float Positioning 97 Floating to a two-column look This is a starting place, but you really want the labels to be to the left of the corresponding block. The float attribute can be used to create exactly this effect, as you can see in Figure Figure The float attribute allows you to remove an element from the normal layout rules and apply a special floating behavior. The float attribute describes the relationship between an element and its neighbors. In this case, I tell each label to float to the left. You can also float to the right, but this is rarely done in practice. This causes the label to be immediately to the left of the corresponding input element. Adding a width to the floated label makes the input elements line up nicely looking and acting like a table with no additional HTML code. You can define all margins with the plain margin attribute, or you can specify individual margins. If you set the margin attribute to auto, you will center the element horizontally. There is no easy way to do vertical centering in CSS. Padding is used to fix text that is crowded too close to a border. Take a look at the code for formFloat. It adds a few formatting attributes to clean up the page and get a better-looking form. Begin with a two-column layout. Begin by building the simple two-column layout described in the previous section. Center the fieldset. The fieldset is a block-level element by default, which is what you want. Right-justify the labels. For that reason, I usually right-justify the labels. Pad the labels a little bit. When text-align is set to right, the labels seem to crowd the input elements a bit. Add a little bit of paddingright to the labels to give them a little breathing space. However, you can use percentages to get the same effect. Center the button. To center the button, just set its display attribute to block and the margin to auto. I find the button needs a little more vertical space, so I add a little margintop to make it look a little better. Of course, you can do much more to make your forms look better. You can add colors, background images, and custom fonts if you want. Using absolute positioning CSS allows some other useful mechanisms for positioning elements. The absolute positioning scheme is especially useful, as it allows you to have much more precise control of the position of CSS elements. This makes the absolute positioning scheme very powerful, but often too tedious for general layout. If you rely on absolute positioning to set up a page, you generally have to use the technique for every element on the screen. Absolute positioning techniques are best used for specialty objects that can ignore the rest of the page layout scheme. I use it mainly for creating moving objects that are animated with JavaScript. Figure shows an example of absolute positioning. The bug shown in Figure is sitting on top of the paragraph. This effect is possible with absolute positioning. When you use absolute positioning, you manually specify the position of the element. This page seems to have a bug in it!!! The bug paragraph contains only an image of a bug. Note that images are inline-level tags, and they must be embedded within a block-level tag to make the page validate. If there were no CSS, the page would simply display the bug image as its own separate paragraph after the ordinary text-laden paragraph. This means that the ordinary layout mechanisms will be overruled by specific position information. Normally absolutely positioned elements are set using pixels px. Anything placed with absolute positioning will ignore previously positioned elements. This can be a problem in ordinary Web design, but in animation, it can be a nice feature. For example, you can make the bug fly around the screen with JavaScript tricks. There is much more to CSS positioning than I can describe in this introductory part. I have hundreds of pages in that book dedicated to explaining multicolumn layouts, drop-down menus, and other CSS goodness. Of course, you can also check Part 6 for some wonderful new CSS capabilities, including an entirely new layout mechanism. Now almost all of the page formatting, style, and layout is performed by CSS. This part describes those features of CSS3 that are relatively new, are supported or are expected to be supported , and have a potential significant impact on the Web. This includes Safari, Chrome, and the iPhone browsers. The Opera rendering engine is naturally enough used in the Opera browser. This is primarily Firefox, but a number of other Mozilla-based browsers are starting to appear. IE8 supports almost none of the features described in this part. As always, be sure to check out my Web site for working examples of every code fragment in the book: www. Traditional CSS has allowed selection by tag type p to select all paragraphs, for example , by class. CSS3 supports several new selectors with interesting new capabilities. Attribute selection You can now apply a style to any element with a specific attribute value. For example, the input tag takes many different forms, all determined by the type attribute. If you apply a single style to the input element, that style is applied to many different kinds of elements: check boxes, text fields, and radio buttons. For example, imagine you wanted to apply a style to all the paragraphs that are not members of the special class: p:not. In my example, I have a list with four items. The style is applied to the list items, not the list. Technically, this was available in CSS2, but it was rarely used. These selection tools are fully supported in all the recent browsers except IE. IE9 supports these tools, but older versions do not. However, as they are generally used simply to improve readability, it should be safe to use them. Noncompliant browsers will simply skip the style. Now the :hover pseudo-class can be applied to any element. If the mouse or other pointing device is over an element, that element has the hover state activated. For example, when a button has been pressed but not yet released. Mobile devices often skip directly to active mode without going through hover mode. This can be an important design consideration when using state for styling. The state pseudo-classes are fully supported by all modern browsers except the IE family of browsers. There is limited but buggy support in early versions of IE. Developers had to rely on a series of substitute fonts and fallbacks. Finally, CSS3 now supports a sensible solution for providing downloadable fonts. Instead, it defines a new CSS value that can be used in other markup. Specifically, it allows you to place a font file on your server and define a font family using that font. The src attribute is the URL of the actual font file as it is found on the server. Many open source fonts are available in this format. Think carefully about readability. Also, be respectful of intellectual property. There are many excellent free open source fonts available. Many approaches have been used over the years, including frames, tables, and floating elements. Finally, CSS3 has now integrated column support. This rule is defined with exactly the same parameters as the border rule. The standard column rules are not yet supported by any major browsers. However, two of the main engines have their own variations of the column tags. Incorporate the -moz- versions of the tag for Firefox and related browsers. The -webkit- versions support Safari and Chrome. You can either set all columns to the same width in which case the number of columns is automatically determined or you can set the number of columns which automatically determines a width for each. You cannot make one column a different size from the others. Content fills up the entire area, automatically flowing from one column to the next. There is no easy way to specify which text is in which column. Columns are more suited for magazine-style layout with text flowing among columns. With CSS3, you can specify a stroke color for your text. This defines an outline around the letter. You can specify the stroke color using any of the standard CSS color values as well as a stroke width using the normal size attributes. Shadows add an element of depth to a page, but they can also enhance readability if used properly to lift a headline from the page. A positive value moves the shadow to the right, and a negative value moves to the left. If the value is 0px, there is no blur, and the shadow looks just like the original text. This allows the shadow to be recognizable as a shadow of the text without becoming a distraction. Generally, a dark gray is the standard shadow color, but you can also try other colors for special effects. Note that blurring tends to lighten the shadow color. If the shadow will not be blurred much, you may need to lighten the shadow color for readability. The size of the shadow is determined indirectly with a combination of offsets and blurs. A special case of text shadowing can be used to help text stand out against a background image. Apply a small shadow of a contrasting color. No special prefixes are necessary. There have been many different approaches to page layout, and all have weaknesses. The current standard is the floating mechanism. The various parts of the float specification can be difficult to follow, and the behavior is not intuitive. The relationship between width, clear, and float attributes can be difficult to follow. One goal of semantic layout is to completely divorce the way the page is created from how it is displayed. With the floating layout, the order in which various elements are written in the HTML document influences how they are placed. While the floating mechanism is the current standard for page layout, clearly another option would be nice. CSS3 includes the new flexible box layout as an alternative. Creating a flexible box layout CSS3 proposes a new layout mechanism, flexible box. While it is far from complete, this mechanism shows significant promise. Designate a page segment as a box. The display attribute of most elements can be set to various types. CSS3 introduces a new display type: box. Setting the display of an element to box makes it capable of holding other elements with the flexible box mechanism. Determine the orientation of child elements. Use a new attribute called box-orient to determine if the child elements of the current element will be placed vertically or horizontally inside the main element. Specify the weight of child elements. Each child element can be given a numeric weight. The weight determines how much space that element takes up. If the weight is zero, the element takes as little space as possible. If the weight of all the elements is one, they all take up the same amount of space. If one element has a weight of two and the others all have a weight of one, the larger element has twice the size of the others, and so on. Weight is determined through the box-flex attribute. Nest another box inside the first. You can nest flex boxes inside each other. Simply apply the box display type to inner elements, which will show the display. Modify the order in which elements appear. Normally, elements will appear in the order in which they were placed on the page, but you can use the box-ordinal-group attribute to adjust the placement order. Figure illustrates a complex nested style that would be difficult to achieve through traditional layout techniques for example, CSS2. Set up a to be the primary container. The a div is the primary container, so give it a height and width. It will contain flex boxes, so set the display attribute to box. Determine how you want the children of this box to be lined up by setting the box-orient attribute to vertical or horizontal. Flexible Box Layout Model 2. Specify the weights of b, c, and d. In my example style sheet here, I want elements b and c to take up half the space, and d to fill up the remainder of the space. To get this behavior, set the box-flex value of c and d to 1, and the box-flex value of d to 2. Set up d as another container. The d element will contain e and f.