Page 38 - LoudOffice_Guide-to-HTML_Part-II_Advanced.PDF
P. 38

CSS and the <a> Element
               Notice that for the < a >  element, you can apply CSS for each of these different states:
                   Ø Normal / All: By applying CSS to just the < a >  element, you effect all instances
                   Ø Link: This will apply the CSS to all links.
                   Ø Hover: This will apply when the mouse is ‘hovered’ over the link.
                   Ø Active: This will apply to the ‘active’ link.
                   Ø Visited: This will apply to only ‘visited’ links.

               Required Elements
                                                                     and it should be set to t e x t / c s s . A
               A required attribute of the Style element is T Y P E
               disadvantage of Embedded Style sheets is that the style commands only apply to the
               document they are embedded in, which means you have to put them in each and every
               page you want to use them.

               Some browsers are not CSS-compliant and will display the contents of the STYLE element in
               the document window. For this reason it is a good idea to surround an embedded style
               sheet with an HTML comment. This will cause the content to be ignored by non-CSS
               browsers, but still interpreted by CSS compliant browsers.  To enter comments simply type

               `< ! - - ' just after the < S T Y L E >  start-tag, but before the style sheet information and type `-
               - > ' just before the < / S T Y L E >  end-tag, but after the style sheet information.
               Notice in the HTML code above that the < S T Y L E >  selector has two parts:
                   1.  A selector that identifies an HTML element or group of elements; and
                   2.  A declaration of the style properties to be applied to that selector.
               The generic syntax for a style rule is as follows:

                           s e l e c t o r  { p r o p e r t y 1 : v a l u e 1 ;  p r o p e r t y 2 : v a l u e 2 ;  . . . }
               Each style rule must start with a selector or group of selectors, followed by an open brace
               ({ ), followed by a set of declarations. Each of these declarations ends with a semi-colon and
               each property is separated from its value(s) by a colon (: ), ending with a close brace (} ).







               LoudOffice.com Guide to HTML – Part II                                               Page 38
   33   34   35   36   37   38   39   40   41   42   43