Cascading manner sheets

“Hyper Text Markup Language ( HTML ) defines the construction and layout of a Web papers by utilizing a assortment of tickets and properties. The right construction for an HTML papers starts with & A ; lt ; HTML & A ; gt ; & A ; lt ; HEAD & A ; gt ; ( enter here what papers is about ) & A ; lt ; BODY & A ; gt ; and ends with & A ; lt ; /BODY & A ; gt ; & A ; lt ; /HTML & A ; gt ; . All the information you ‘d wish to include in your Web page tantrums in between the & A ; lt ; BODY & A ; gt ; and & A ; lt ; /BODY & A ; gt ; tags” [ Webopedia ] [ 1 ] . In its earliest signifier, the Web was intended to convey scientific paperss so that the research community had speedy and easy entree to published work. The W3C ( the World Wide Web Consortium—the organic structure responsible for keeping many Web criterions ) revised the HTML criterion continuously as the cyberspace or instead web grew by springs and bounds. As the criterion was revised continuously it became progressively complex. The complexness of the criterion was chiefly due to the fact that W3C concentrated its attempts to assist the developers in heightening the expression and feel of the WebPages. The add-on of these new characteristics that offered interior decorators control over the visual aspect of pages meant that it was possible to make attractive pages that worked great on your mean desktop computing machine. Despite the recurrent attempts of the W3C to polish the criterions jobs kept increasing with every reappraisal of the criterion. Browser specific issues were ever a major job. This was chiefly due to the fact every browser had its ain manner to exposing layouts. Added to this was the fact that every user was bound holding different screen with different declarations. This job aggravated with bettering engineering which resulted in the addition in the scope of screen declarations. Due to the inactive nature of HTML developers had to be after the content of each and every page at the start merely. This was necessary as a little alteration in the design would necessitate the developer to update each and every Web page. Additionally this resulted in drawn-out complicated codification with the increased hazard of mistakes.

As a solution to the above mentioned challenges the W3C suggested to take the full presentational markup that had been added to HTML As a consequence of this separation of manner and content the W3C came up with the Cascading Style Sheets ( CSS ) criterion.

Some of the primary advantages of utilizing manner sheets are listed below.

  • One can recycle the same manner sheet with all of the Web pages in your site ; you do non necessitate to reiterate the stylistic markup in each single papers.
  • Users can alter the visual aspect of several pages by merely changing the manner sheet, instead than each single page ; this is peculiarly helpful if you want to alter your company’s colourss, for illustration, or the fount used for a certain type of component wherever that component appears. Users can make the manner regulations one time and utilize them for each page of your site, instead than reiterate them in each page.
  • Because the manner regulations are written merely one time, instead than looking on every component or in every papers, the beginning paperss are smaller. This means that one time the CSS manner sheet has been downloaded with the first papers that uses it, subsequent paperss will be quicker to download ( because the browser retains a transcript of the CSS manner sheet and the presentation regulations do non hold to be downloaded for every page ) . This besides puts less strain on the Web waiter.
  • Because the beginning papers does non incorporate the manner regulations, different manner sheets can be attached to the same papers. Therefore, you can utilize the same HTML papers with one manner sheet when the spectator is on a desktop computing machine, another manner sheet when the user has a hand-held device, another manner sheet when the page is being printed, and another manner sheet when the page is being viewed on a Television, and so on. You reuse the same papers with different manner sheets for different visitors’ demands.
  • A manner sheet can import and utilize manners from other manner sheets, enabling you to develop manner sheets in a modular manner for better reuse.

A manner sheet consists of regulations. A regulation has apickerthat specifies the papers elements to which the regulation applies, anddeclarationsthat specify the stylistic consequence of the regulation. The declaration is a set ofproperty/valuebraces.

""

Figure 1 Rule Structure

These manner regulations can be applied to a papers in three ways:

Inline manners

To stipulate the manner information for an single component utilizing the manner property it has to be included in that component ‘s HTML ticket as shown below.

& A ; lt ; Hl STYLE= ” colour: ruddy ; font-size: 10pt ; ” & amp ; gt ; Warning! ! & A ; lt ; /Hl & A ; gt ;

Embedded manner sheets

Style sheets may besides be embedded in the HEAD subdivision of the HTML papers as shown below:

& A ; lt ; HTML & A ; gt ; & A ; lt ; HEAD & A ; gt ; & A ; lt ; TITLE & A ; gt ; Embedded & A ; lt ; /TITLE & A ; gt ;& A ; lt ; STYLE TYPE= ” text/css ” & amp ; gt ;

h2 { font-size: x-large }

p { font-size: 12pt }

fifty-one { font-size: 90 % }

strong { font-size: larger }

& A ; lt ; /STYLE & A ; gt ;

& A ; lt ; /HEAD & A ; gt ;

……..

& A ; lt ; /HTML & A ; gt ;

External manner sheets

External Style sheets may be referenced in two different ways. The first manner creates a nexus to the external manner sheet utilizing the LINK ticket in the HEAD of the papers:

& A ; lt ; HEAD & A ; gt ;

& A ; lt ; LINK REL= ” stylesheet ” TYPE= ” text/css ” HREF= ” newstyles.css ” & amp ; gt ;

& A ; lt ; /HEAD & A ; gt ;

The other technique is to import an external manner sheet into the STYLE component utilizing the @ import directive:

& A ; lt ; HEAD & A ; gt ;

& A ; lt ; STYLE TYPE= ” text/css ” & amp ; gt ;

©import URL ( newstyles.css ) ;

& A ; lt ; /STYLE & A ; gt ;

& A ; lt ; /HEAD & A ; gt ;

Pickers

Pickers can be of five types: component or type, property, contextual or descendant, kid, next sibling and Pseudo-class or pseudo-element pickers.

Type or Element picker:The simplest sort of picker refers to an HTML component by its ticket:

H1 ( colour: purple ; }

Type/Element pickers can be grouped into a comma-separated list, so that a individual belongings applies to all the listed elements:

H1, H2, P ( colour: purple ; }

At times, users will desire the content of either one or several elements to hold different regulations compared with other elements that portion the same name. Two pickers viz.categoryandIdahopickers enable users to distinguish between elements that portion the same name.

Specific HTML elements can be grouped into a category utilizing the CLASS property:

& A ; lt ; H1 CLASS= ” warning ” & amp ; gt ; Danger! & A ; lt ; /Hl & A ; gt ;

& A ; lt ; P CLASS= ” warning ” & amp ; gt ; Be careful… & A ; lt ; /P & A ; gt ;

To stipulate a manner for elements of a peculiar category, append the category name to the HTML picker, separated by a period ( . ) :

H1.warning ( colour: ruddy ; }

To use a manner to all elements of a category, irrespective of the existent component, omit the ticket name

.warning { colour: ruddy ; }

The HTML ID property assigns a alone identifier to a peculiar HTML component:

& A ; lt ; P ID= ” first-para ” & amp ; gt ; In the beginning… & A ; lt ; /P & A ; gt ;

To use a manner to the identified component, merely stipulate the ID value, preceded by a lb mark ( # ) :

# first-para { font-weight: bold ; }

Attribute picker:Attribute pickers enable you to utilize the properties that an component carries in the picker. There are several ways in which you can utilize attribute pickers. For illustration, the following paragraph carries an id property:

& A ; lt ; p id=”important” class=” HTML, attributes” & A ; gt ; All attribute values must be written in dual quotes. & A ; lt ; /p & A ; gt ;

Descendant picker:The descendant picker matches an component type that is a descendant of another specified component, at any degree of nesting, non merely a direct kid and was foremost supported by Internet adventurer 5 and Netscape 6. In CSS1, this type of picker was referred to as acontextual picker, but CSS2 changed its name to descendent picker. This differs from the kid picker because it applies to all of the kids of the selected component, instead than merely the direct kids. In the undermentioned illustration, the picker matches any & A ; lt ; B & A ; gt ; component that is a kid of the & A ; lt ; table & A ; gt ; component, which means it would use to & A ; lt ; B & A ; gt ; elements both in & A ; lt ; td & A ; gt ; and & A ; lt ; th & A ; gt ; elements:

tabular array B { font-size:12px ; }

The Child picker:The kid picker will fit an component that is a direct kid of another. In the undermentioned instance, it matches any & A ; lt ; B & A ; gt ; elements that are direct kids of & A ; lt ; td & A ; gt ; elements:

td & A ; gt ; b { font-size:12px ; }

This would enable you to stipulate a different manner merely for those & amp ; lt ; b & A ; gt ; elements that are direct kids of the & A ; lt ; td & A ; gt ; component, instead than for any & A ; lt ; B & A ; gt ; elements that appear elsewhere in the papers.

The Adjacent Sibling Picker:An next sibling picker matches an component type that is the following sibling of another. This was introduced in CSS2 and is still non available in IE6 but Netscape 6 supports this picker. For illustration, if you want to do the first paragraph after any flat 1 heading a different manner, you could utilize the next sibling picker like:

h1 + P { font-weight: bold ; }

Pseudo-class and pseudo-element pickers:CSS1 defines some pseudo-classes of the ground tackle ticket ( A ) to back up different manners for assorted nexus provinces. For illustration, the: visited pseudo-class selects links that have been visited:

A: visited { colour: ruddy ; }

The following tabular array shows some of the pseudo category options that may be utilized in the styling of the web page.

""

Table 1

Similarly, pseudo-elements are subparts of bing elements for which manners can be specified:

Phosphorus: first-letter { colour: ruddy ; }

""

Table 2

Declaration

As shown in figure 1 the declaration portion consists of belongings and value. Proper sentence structure is required for stipulating certain sorts of CSS belongings values. In general, there are five sorts of belongings values: keywords, length values, per centum values, colourss, and URLs. It is non within the range of this papers to name all the values or instead belongingss. The complete ”CSS Property Reference ” can be found at the W3C [ 2 ] web site and few other web sites [ 3 ] . However few belongingss, values and illustrations are provided below.

""

Table 3

Until now we have seen CSS as the styling linguistic communication for HTML or XHTML but there are other manner sheet linguistic communications every bit good. The Document Style Semantics and Specification Language ( DSSSL ) is an ISO criterion for stipulating the format of SGML paperss. DSSSL is based on Scheme, and provides both a transmutation linguistic communication and a manner linguistic communication. The W3C has besides introduced the XSL manner sheet for usage with XML paperss. PSL [ Marden and Munson, 1998 ] is another manner sheet linguistic communication ; its expressiveness lies halfway between that of CSS and XSL. In this subdivision we will briefly explore DSSSL and XSL.

""

Figure 2 Hypermedia Standards on the Web

DSSSL:

The Document sty1e semantics and specification and Language ( DSSSL, 1996 ) , is an International criterion developed to supply a manner sheet linguistic communication for SGML paperss. DSSSL specifications are device independent pieces of information that can be interchanged between different platforms. DSSSL has several advantages. First of all, DSSSL does non do any premise about the construction of the input papers because a DSSSL manner sheet by and large maps component from its input papers to arbitrary component in the end product theoretical account. Besides, the DSSSL question linguistic communication gives the Style Sheet full entree to both the content and the construction of the papers through a powerful query linguistic communication. One of the really of import advantages of DSSSL is that its manner sheets are typically device and platform independent. Along with these advantages, DSSSL has some disadvantages excessively. DSSSL uses a side-effect free strategy idiom to stipulate the layout of a papers and an adept cognition on SGML is required for proper apprehension of the DSSSL interface to the SGML papers construction. The usage of DSSSL to bring forth HTML paperss is rather cumbrous because DSSSL’s transmutation linguistic communication is non widely used and hence by and large users use the DSSSL data format linguistic communication to bring forth HTML which becomes rather complicated.

XSL:The W3C has specified an Extensile Stylesheet Language ( XSL ) [ Clark and Deach, 1998 ] for presentation and show of XML paperss. XSL can rearrange papers construction, doing it purely more powerful than Cascading Style Sheets [ Matzen and Hedrick, 1998 ] , which can merely stipulate how markup elements are rendered ( fount, colour etc. ) without leting element reordering. XSL plants by recursively transforming XML paperss into other formats such as HTML, harmonizing to a set of manner regulations augmented with a scripting linguistic communication. XSL is based in portion on a styling linguistic communication for SGML, Document Style Semantics and Specification Language ( DSSSL ) [ ISO, 1994 ] . The transmutation procedure can take topographic point inside an XML-enabled browser, or in an applet or book run by a browser without XML capablenesss.

Clark, J. and Deach, S. ( 1998 ) ( erectile dysfunction ) , Extensile Stylesheet Language ( XSL ) , Version 1.0, World Wide Web Consortium Working Draft 18-August- 1998 ( 1998 ) .

DSSSL, ( 1996 ) International Organisation for Standardization/International Electro proficient Commission.Information Technology – Processing Language – papers manner Semantics and Specification Language ( DSSSL ), 1996. International Standard ISO/ISE 10179:1996.

Graham, S. Harrison, M and Munson, E. ( 1992 ) The Proteus Presentation System. In Proceedings of the ACM SIGSOFT Fifth Symposium on Software Development Environments, pp. 130- 138, Tyson’s Corner, VA, December 1992. ACM Press.

ISO 8879:1986, Information Processing – Text and Office Systems – Standard Generalized Markup Language ( SGML ) . International Organization for Standardization. Ref. No. ISO 8879:1986 ( E ) . Geneva/New York ( 1986 ) .

ISO/IEC DIS 10179.2:1994. Information Technology- Text and Office Systems – Document Style Semantics and Specification Language ( DSSSL ) . International Organization for Standardization/ International Electrotechnical Commission. Geneva ( 1994 ) .

Lie, H. and Bos, B. The Cascading Style Sheets: Planing for the Web. Addison-Wesley Longman, Harlow, England, 1997

Lie. H. and Bos, B. Cascading Style Sheets, Level 1. W3C ; see www.w3.org/TR/

Lie. H. , Bos, B, Lilley, C. , and Jacobs, I. Cascading Style Sheets, Level 2. W3C ; see www.w3.org/TR/

Marden, P. Jr. and Munson, E. PSL: An surrogate attack to manner sheet linguistic communications for the universe broad web. Journal of Universal Computer Science, 4 ( 10 ) , 1998. hypertext transfer protocol: //www.cs.uwm.edu/?multimedia.

Matzen, R. W. and Hedrick, G. E. ( 1998 ) . A new tool for SGML with applications for the World Wide Web. Proceedings of the 1998 ACM symposium on Applied Computing, p.752-759, February 27-March 01, 1998, Atlanta, Georgia, United States

Munson. E. ( 1996 ) A New Presentation Language for Structured Documents. Electronic Publication: Origin, Dissemination, and Design, 8:125-138, September 1995. Originally presented at EP96, the Sixth International Conference on Electronic Publishing, Document Manipulation, and Typography, Palo Alto, CA, September 1996

Raggett, D. , Le Hors, A. , and Jacobs, I. HTML 4.0 Specification. W3C ; see www.w3.org/TR/

Schwabe, D. Rossi, G. and Barbosa, S.D.J. ( 1996 ) SystematicApplication design with 00HDM. In Seventh ACM Conference on Hypertext ( Hypertext ’96 ) Wmhington DC, March 16-201996, pages 116-128, 1996.

1