No introduction to HTML would be complete without a discussion of the logical versus physical markup battle at the heart of HTML. Physical HTML refers to using HTML to make pages look a particular way; logical HTML refers to using HTML to specify the structure of a document, and using another technology, such as cascading style sheets (see Chapter 10), to designate the look of the page. Mostpeoplearealreadyveryfamiliarwithphysicaldocumentdesign,becausethey normallyuseWYSIWYG(whatyouseeiswhatyouget)texteditors,suchasMicrosoftWord. WhenWorduserswanttomakesomethingbold,theysimplyselecttheappropriate button,andthetextismadebold.InHTML,youcanmakesomethingboldsimplyby enclosingitwithinthe
<B>and</B>tags,
asshownhere:
<B>This is important.</B>
This can easily lead people to believe that HTML is nothing more than a simple formatting language. WYSIWYG HTML editors (such as Microsoft FrontPage) also reinforce this view; but as page designers try to use HTML in this simplistic fashion, sooner or later they must face the fact that HTML is not a physical page-description language. Page authors can’t seem to make the pages look exactly the way they want; and when they can, doing so often requires heavy use of <TABLE> tags, giant images, and even trick HTML. Other technologies, such as style sheets, may provide a better solution for formatting text than a slew of inconsistently supported tricks and proprietary HTML elements.
According to many experts, HTML was not designed to provide most of the document layout features people have come to expect, and it shouldn’t be used for that purpose.Instead,HTMLshouldbeusedasalogical,orgeneralized,markuplanguage thatdefinesadocument’sstructure,notitsappearance.Forexample,insteadofdefining theintroductionofadocumentwithaparticularmargin,font,andsize,HTMLjustlabels itasanintroductionsectionandletsanothersystem,suchasCascadingStyleSheets, determinetheappropriatepresentation.InthecaseofHTML,thebrowserorastyle sheethasthefinalsayonhowadocumentlooks. HTML already contains many logical elements. An example of a logical element is <STRONG>, which indicates something of importance, as shown here:
<STRONG>This is important.</STRONG>
The <STRONG> element says nothing about how the phrase “This is important” will actually appear, although it will probably be rendered in bold. While most of the logical elements are relatively underutilized, others, such as headings (<H1> through <H6>) and paragraphs, are used regularly. The benefits of logical elements may not be obvious to those comfortable with physical markup. To understand the benefits, it’s important to realize that on the Web, many browsers render things differently. In addition, predicting what the viewing environment will be is difficult. What browser does the user have? What is his or her monitor’s screen resolution? Does the user even have a screen? Considering the extremeoftheuserhavingnoscreenatall,howwouldaspeakingbrowserrenderthe <BOLD>element?Whataboutthe <STRONG>element?Texttaggedwith <STRONG> might be read in a firm voice, but boldfaced text doesn’t have a meaning outside the visual realm. Many realistic examples exist of the power of logical elements. Consider the multinational or multilingual aspects of the Web. In some countries, the date is written with the day first, followed by the month and year. In the United States, the date generally is written with the month first, and then the day and year. A <DATE> element, if it existed, could tag the information and let the browser localize it for the appropriate viewing environment. Another example is the problem of screen sizes that, theoretically, could be reduced by logical structuring concepts. For example, logical elements could allow for different renderings based on the screen size of the computer running the browser. This would allow the creation of documents that look good on laptop screens as well as on large workstation monitors. In short, separation of the logical structure from the physical presentation allows multiple physical displays to be applied to the same content. This is a powerful idea that, unfortunately, is rarely taken advantage of. Whether you subscribe to the physical or logical viewpoint, HTML is not purely a physical or logical language, yet. In other words, currently used HTML elements come in both flavors: physical and logical. Elements that specify fonts, type sizes, type styles,and so on, are physical. Elements that specify content or importance, such as <CITE> and <H1>, and let the browser decide how to do things are logical. A quick look at Web pages across the Internet suggests that logical elements often go unused, because Web developers want more layout control than raw HTML provides, and style sheets are relatively new and still buggy. Furthermore, many designers just don’t think in the manner required for logical markup, and WYSIWYG page editors generally don’t encourage such thinking.
So,likeitornot,toachievethelookthattheywant,pagedesignerswillprobably continuetoabuseelements,suchas <TABLE>and<FRAME>,andusetricksto implementlayoutsinthewaythattheywantthem.Thisisthestrugglethatcurrently existsbetweenwhatpeoplewantoutofHTMLandwhatHTMLactuallyprovides.With theriseofHTML4andCascadingStyleSheets,thisstrugglemayeventuallygoaway; buttheuptakeisstillslow,andmillionsofdocumentswillcontinuetobeauthoredwith noconceptoflogicalstructuring.Webpagedevelopmentcontinuestoprovidean interestingstudyofthedifferencebetweenwhattheoristssayandwhatpeoplewant.
<B>and</B>tags,
asshownhere:
<B>This is important.</B>
This can easily lead people to believe that HTML is nothing more than a simple formatting language. WYSIWYG HTML editors (such as Microsoft FrontPage) also reinforce this view; but as page designers try to use HTML in this simplistic fashion, sooner or later they must face the fact that HTML is not a physical page-description language. Page authors can’t seem to make the pages look exactly the way they want; and when they can, doing so often requires heavy use of <TABLE> tags, giant images, and even trick HTML. Other technologies, such as style sheets, may provide a better solution for formatting text than a slew of inconsistently supported tricks and proprietary HTML elements.
According to many experts, HTML was not designed to provide most of the document layout features people have come to expect, and it shouldn’t be used for that purpose.Instead,HTMLshouldbeusedasalogical,orgeneralized,markuplanguage thatdefinesadocument’sstructure,notitsappearance.Forexample,insteadofdefining theintroductionofadocumentwithaparticularmargin,font,andsize,HTMLjustlabels itasanintroductionsectionandletsanothersystem,suchasCascadingStyleSheets, determinetheappropriatepresentation.InthecaseofHTML,thebrowserorastyle sheethasthefinalsayonhowadocumentlooks. HTML already contains many logical elements. An example of a logical element is <STRONG>, which indicates something of importance, as shown here:
<STRONG>This is important.</STRONG>
The <STRONG> element says nothing about how the phrase “This is important” will actually appear, although it will probably be rendered in bold. While most of the logical elements are relatively underutilized, others, such as headings (<H1> through <H6>) and paragraphs, are used regularly. The benefits of logical elements may not be obvious to those comfortable with physical markup. To understand the benefits, it’s important to realize that on the Web, many browsers render things differently. In addition, predicting what the viewing environment will be is difficult. What browser does the user have? What is his or her monitor’s screen resolution? Does the user even have a screen? Considering the extremeoftheuserhavingnoscreenatall,howwouldaspeakingbrowserrenderthe <BOLD>element?Whataboutthe <STRONG>element?Texttaggedwith <STRONG> might be read in a firm voice, but boldfaced text doesn’t have a meaning outside the visual realm. Many realistic examples exist of the power of logical elements. Consider the multinational or multilingual aspects of the Web. In some countries, the date is written with the day first, followed by the month and year. In the United States, the date generally is written with the month first, and then the day and year. A <DATE> element, if it existed, could tag the information and let the browser localize it for the appropriate viewing environment. Another example is the problem of screen sizes that, theoretically, could be reduced by logical structuring concepts. For example, logical elements could allow for different renderings based on the screen size of the computer running the browser. This would allow the creation of documents that look good on laptop screens as well as on large workstation monitors. In short, separation of the logical structure from the physical presentation allows multiple physical displays to be applied to the same content. This is a powerful idea that, unfortunately, is rarely taken advantage of. Whether you subscribe to the physical or logical viewpoint, HTML is not purely a physical or logical language, yet. In other words, currently used HTML elements come in both flavors: physical and logical. Elements that specify fonts, type sizes, type styles,and so on, are physical. Elements that specify content or importance, such as <CITE> and <H1>, and let the browser decide how to do things are logical. A quick look at Web pages across the Internet suggests that logical elements often go unused, because Web developers want more layout control than raw HTML provides, and style sheets are relatively new and still buggy. Furthermore, many designers just don’t think in the manner required for logical markup, and WYSIWYG page editors generally don’t encourage such thinking.
So,likeitornot,toachievethelookthattheywant,pagedesignerswillprobably continuetoabuseelements,suchas <TABLE>and<FRAME>,andusetricksto implementlayoutsinthewaythattheywantthem.Thisisthestrugglethatcurrently existsbetweenwhatpeoplewantoutofHTMLandwhatHTMLactuallyprovides.With theriseofHTML4andCascadingStyleSheets,thisstrugglemayeventuallygoaway; buttheuptakeisstillslow,andmillionsofdocumentswillcontinuetobeauthoredwith noconceptoflogicalstructuring.Webpagedevelopmentcontinuestoprovidean interestingstudyofthedifferencebetweenwhattheoristssayandwhatpeoplewant.
No comments:
Post a Comment