<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="../stylesheets/yaps-tei.css"?>
<?oxygen RNGSchema="../schema/yaps.rnc" type="compact"?>
<?oxygen SCHSchema="../schema/yaps.sch"?>
<TEI xmlns="http://www.wwp.brown.edu/ns/yaps/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0">
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title>Making a TEI File Look Good in a Browser</title>
        <author>Syd Bauman</author>
      </titleStmt>
      <xi:include href="./boilerplate_publicationStmt.xml">
        <xi:fallback>
          <publicationStmt status="restricted">
            <note type="auto">WARNING: XInclude processing failed &#x2014; this file should not be copied or
            used (and is invalid) as a result.</note>
          </publicationStmt>
        </xi:fallback>
      </xi:include>
      <sourceDesc>
        <p>based on same talk given 2007-09-19 at the Transliteracies Project and Early Modern
	Center at the University of California, Santa Barbara</p>
      </sourceDesc>
    </fileDesc>
    <revisionDesc>
      <change who="#sbauman.emt" when="2008-04-30">Remove stuff now duplicated on handout; fix wording of reference to spec</change>
      <change who="#sbauman.emt" when="2008-04-12">Changed <q>elem</q>
      to <q>element</q>, removed erroneous space from an example, and
      added CSSZenGarden link.</change>
      <change who="#sbauman.emt" when="2008-02-29">Chnaged from using
      <q>gi</q> to <q>elem</q> for generic identifier in selector
      templates</change>
      <change>automatically converted from presentation.odd conforming
      to yaps.odd conforming using p2y.xslt and p2y.perl</change>
    </revisionDesc>
  </teiHeader>
  <text>
    <presentation>
      <section>
        <head>What, me worry?</head>
        <slide>
          <p>I am not a CSS expert. I use it, that's all.</p>
        </slide>
      </section>
      <section>
        <head>CSS Stylesheets</head>
        <slide>
          <p>Allow you to associate a <term>style</term> (i.e.,
            typeface, size, color, spacing, etc.) to elements of XML
            documents.</p>
	    <p>Syd &#x2014; show ’em this slide using <name
	    type="file">css_demo-html.css</name>, instead.</p>
        </slide>
        <handoutNote>
          <p>This is more of a brief crib sheet than a real CSS2
            reference. It is intended to provide you with a few
            useful selectors, properties, and values, just to get
            you started. For detailed information see the CSS 2.1
            specification itself, or any one of the many on-line
            tutorials. The prompts from your CSS editor may also
            prove helpful, as may a stroll through
            http://www.csszengarden.com/.</p>
        </handoutNote>
      </section>

      <section>
        <head>Supported Browsers</head>
        <slide>
          <p>All modern browsers support CSS for HTML, <ref
          target="http://www.webdevout.net/browser-support-css">some
          more, some less</ref>. Most support CSS for XML: notably,
          though, not some (all?) versions of MSIE.</p>
        </slide>
	<lectureNote>
	  <p>Many people report this does not work in Internet
	  Explorer; we have verified that it works in Firefox, Safari,
	  Camino, iCab, Opera, Radon, OmniWeb, Nova X, Sunrise, and
	  Xyle scope; we have not tested Netscape or Seamonkey, but
	  they use the same engine as Firefox, so should work; we have
	  verified that it does not work in Demeter or Shiira.</p>
	</lectureNote>
      </section>
      <section>
        <head>Other Support</head>
        <slide>
          <list>
            <head>Editors</head>
            <item>oXygen provides color syntaxing, indentation, and
                <soCalled>validation</soCalled></item>
            <item>CSSEdit provides color syntaxing, some
              indentation, completion, and a GUI interface for
              styles</item>
            <item>Emacs has a css-mode, of coures</item>
            <item>Those are the ones I've used; there are dozens of
              others</item>
          </list>
        </slide>
      </section>

      <section>
        <head>What is CSS2?</head>
        <slide>
          <p>Let's practice reading TEI source:<eg><![CDATA[<choice><expan>Cascading Style Sheets, level 2</expan><abbr>CSS2</abbr></choice>
is a <choice><expan>World Wide Web Consortium</expan><abbr>W3C</abbr></choice>
specification.]]></eg></p>
          <p>The specification itself can be found <ref target="http://www.w3.org/TR/CSS21/">on-line at the
              W3C site</ref>.</p>
          <p>CSS3 has been around for a long time, but is still at an
	    earlier stage of development, and has poor browser support.</p>
        </slide>
      </section>

      <section>
        <head>Basic Usage: syntax</head>
        <slide>
          <p>The core of the stylesheet consists of a series of
              <soCalled>rulesets</soCalled>. Each has the same basic
            syntax.</p>
          <p xml:id="bus">
            <code>selector { property: value; }</code>
          </p>
        </slide>
        <handoutNote>
          <eg>selector {
   property1: value1;
   property2: value2;
   ...
   propertyN: valueN
   }</eg>
          <p>Most of the whitespace outside of the selector is
            insignificant.</p>
        </handoutNote>
      </section>

      <section>
        <head>Simple Example</head>
        <slide>
          <eg>emph {
    font-weight: bold;
}</eg>
        </slide>
      </section>

      <section>
        <head>Basic Usage: selectors</head>
        <slide>
          <list>
            <head>some selectors</head>
            <item>element</item>
            <item>element descendant-element</item>
            <item>element &gt; child-element</item>
            <item>element[attr="value"]</item>
          </list>
          <p>Selectors may be combined simply by listing them
          left-to-right. Complete list is available <ref
          target="http://www.w3.org/TR/CSS21/selector.html#q1">in the
          specification</ref>.</p>
        </slide>
        <handoutNote>
          <list>
            <label>me</label>
            <item>matches any <gi>me</gi> element</item>
            <label>foo &gt; bar</label>
            <item>matches any <gi>bar</gi> element that is a child
              of a <gi>foo</gi> element</item>
            <label>foo bar</label>
            <item>matches any <gi>bar</gi> element that is a
              descendant of a <gi>foo</gi> element</item>
            <label>primo:first-child</label>
            <item>matches any <gi>primo</gi> element that is the
              first child of its parent</item>
            <label>foo[bar]</label>
            <item>matches any <gi>foo</gi> element that has a
                <att>bar</att> attribute, whatever the value</item>
            <label>foo[bar="Cheers"]</label>
            <item>matches any <gi>foo</gi> element that has a
                <att>bar</att> attribute with the value
              <val>Cheers</val></item>
            <label>foo[bar~="horizontal"]</label>
            <item>matches any <gi>foo</gi> element whose
              <att>foo</att> attribute value is a list of
              space-separated values, one of which is exactly equal
              to <val>warning</val></item>
          </list>
          <p>Multiple selectors may be used at once, separated by
            commas. E.g.:
            <eg>name[type="person"], persName { color: red; }</eg></p>
          <p>I have not gotten a CSS2 selector to work for
              <att>xml:id</att> whether using
              <code>[xml:id='whatever']</code> or the short-hand
              <code>#</code> selector.</p>
        </handoutNote>
      </section>

      <section>
        <head>Example</head>
        <slide>
          <eg>TEI {
  background-color: red;
  margin: 1em 1em 1em 1em;
  }</eg>
        </slide>
      </section>

      <section>
        <head>Combined Properties</head>
        <slide>
          <p>Some properties are combined for convenience.
            E.g., the last example on the previous slide is the same
            as <eg>TEI {
  background-color: red;
  margin-top: 1em;
  margin-right: 1em;
  margin-bottom: 1em;
  margin-left: 1em;
  }</eg></p>
          <p><eg>epigraph { border: thin solid blue; }</eg></p>
        </slide>
      </section>

      <section>
        <head>Associating Stylesheet with XML Instance</head>
        <slide>
          <p>To tell a browser which stylesheet to use, put the
            following after the XML declaration, but before the
            DOCTYPE declaration (if any)</p>
          <eg><![CDATA[<?xml-stylesheet type="text/css" href="my.css"?>]]></eg>
          <p>For example: <eg><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="../stylesheets/yaps-tei.css"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:lang='en'>]]></eg>
          </p>
          <p>In HTML or XHTML <gi>link</gi> can be used instead.</p>
        </slide>
      </section>

      <section>
	<head>The Zen of CSS</head>
	<slide>
	  <p>One excellent way to see the power of CSS and learn it is
	  to stroll through the <ref target="http://www.csszengarden.com/">CSS Zen
	  Garden</ref>.</p>
	</slide>
      </section>
    </presentation>
  </text>
</TEI>
