ThePlace

Home ] Search ] Resources ] Site Map ] Contact Me ]
Dave's Information Technology Resource

Up ]

What is XML ] Viewing XML ] XML Syntax ] Creating XML ] [ XML and CSS ] XML and DTD ] XML, XSL, and HTML ] The XML DOM ]

--- XML and CSS ---

XML and CSS

bulletCSS = Cascading Style Sheet
bulletCSS is the W3C standard for controlling the visual appearance of web pages (HTML)
bulletThree basic types of style sheets:
  1. Inline - via the style attribute; tags are modified on a case-by-case basis throughout a document.  e.g., <h1 style="color: blue; font-style: italic">Text </h1>
  2. Document-level - styles are defined by a <style> tag in the head.
  3. External - link tag is used to identify a separate file with style information.  
bulletStyle syntax:
bullet3 parts of a style "rule" - 
  1. tag selector (e.g., H1, P)
  2. curly brace {}
  3. semi-colon separated list of one or more style property:value declarations (e.g., align:center)
bulletThey are not case sensitive.
bullete.g., tag-selector {prop1: value ; prop2: value1 value2 value3; ...}
bulletMultiple tag selectors can be used.  e.g., H1, H2, H3 {text-align: center}
bulletStyle classes - 
bulletRegular - based on primary document objects, e.g., H1, H2, P , specific tags are identified, e.g., P.abstract {font-style: italic}  ....  <p class=abstract>
bulletGeneric - create a generic class that can be used anywhere., e.g.      .italic {font-style: italic}  ....  <p class=italic>
bulletStyle properties - 53 properties that can be used control how the browser presents content.  Uses property values (5 types): keywords, length values, percentage values, URLs, and colors.

CSS Style Attributes

bulletThe following are typical of CSS formatting
bulletFonts
bulletfamily (e.g., font-family:Arial)
bulletsize, font-size: 24
bulletstyle, font-style: italic
bulletweight, font-weight: bold
bullettext decoration, text-decoration: underline
bulletcolor, color: red ... color:#040588 ... color:rgb(255,255,255)
bulletText
bulletword spacing, word-spacing: 10pt
bulletletter spacing, letter-spacing: 3pt
bulletalignment, text-align: justify

Using CSS with XML...

bulletUse the following...

<?xml version='1.0'?>
<?xml-stylesheet href='cssfilename.css' type='text/css'?>
<element>

bulletGenerally...
bulletAll elements should be defined in the stylesheet.
bulletBe careful to verify the operation of the CSS to catch conflicting styles
bulletExamples...
bulletView an XML page (with fancy formatting!): demo.xml
bulletView the style sheet behind it: demostyle.txt
bulletView the related DTD: demoxml.txt
bulletA more complex data example: library.xml (note the XML content)
bulletXML with CSS...library_css.xml
bulletCSS...library.css -- view below...

books
{
display: block;
margin-left: 1%;
font: normal normal normal 10 san-serif;
border: solid 5px;
padding: 4 px;
}
publishers
{
display: block;
margin-left: 3%;
font: normal normal normal 10 san-serif;
border: solid 4px;
padding: 4 px;
}
titles
{
display: block;
margin-left: 5%;
font: normal normal normal 10 san-serif;
border: solid 3px;
padding: 4 px;
}

 

Home ] Up ] Computer Architecture ] Programming Bootcamp ] Database Bootcamp ] Visual BasicS ] Web Basics ] Web Multimedia ] Web Programming ] Advanced Web Topics ] Developing Web Sites ] Web Glossary ]

Copyright © 1999 - 2005 
ThePlace - Written and Sponsored by Dave Hillman