HTML and CSSMDST 3559:  DataestheticsProf. Alvarado02/08/2011
BusinessRevised syllabusWill move from HTML to PHP Then move down the stack into SQL
ReviewjEditHTMLBasic CSSTouched on idea of documents as data structures
CSS Box Model
OverviewData structures and transformationsData, addressability, and pathsCSS selectors to control look and feelCSS selectors to control behavior
x
StructuresWe have seen three basic structures so far:Linear sequence of content (e.g. news article)Tree structure of source code (HTML)Tabular structure of CSVHow are these related?What depends on what?How are they combined?
Structures and TransformsThe news article is an interpreted version of the treeThe tree is transformed into a sequence by means of rules defined by CSS and other standardsCSV is actually a tree as wellTableRow +Cell +Where the number of cells is the same throughout
xInterpretation
How do the rules work?What does “interpretation” mean in this context?
“Interpretation”Every data structure consists of elementsIn a data structure, every element has an addressA transformation is achieved by applying one or more rule to a data structureRules reference elements by addressEither directly or by means of patterns ...
Example transform rulesFor every element of pattern X, display using font YFor every element at location R and C, express as a point on a graph at position X and Y
The key idea is selectionWhat to pick from the whole and what to do with it
So, how does CSS do this?How does it select?
With SelectorsPatternselector {key: value;}Examplebody {	font-size: 12pt;}
CSS Selectors: BasicXElements of type X#XElement with ID X.XElements of Class X*Every elementX Y Y is child of XX > YY is immediate childX + YY follows XX ~ YY immediately follows
CSS Selectors: AttributesX[title]X has titleX[href=“foo”]X has href of ‘foo’X[href*=”foo"]href contains ‘foo’ X[href^="http"]href begins with ...X[href$=".jpg”]href ends withX[data-*="foo"]Attribute matchesX[foo~="bar"]Attribute among valuese.g. attr=“v1 v2 v3”
CSS Selectors: PseudoX:linkunclicked anchorX:visitedclicked anchorX:hoveron mouse hoverX:checkedchecked inputX:beforeX:afterBefore and after the elementWorks with the content propertyE.g. content:”foo”;
CSS Selectors: Double ColonX::first-letterX::first-line
ExerciseDownload Aristlotle’s Poetics, Section I, Parts I & IIMark up using DIVs with following classes and IDs#front-matter#(title).creator +, #(role)#(date)#content.section +, #(section-N).section-title.part +, #(part-N).part-titlep +
Exercise (cont’d)Then create a CSS element in the header to style each class and IDVary the following propertiesfont-sizefont-weightfont-familypaddingmarginfirst-letter of a section
Assignment (to be posted)Create a page collection in your STUDIO1 directory with the following items:Main page 		 main1.htmlTopic page 1 	 main1-topic1.htmlTopic page 2 	 main1-topic2.htmlFor each page, create a TITLE element and an H1 element, titling each page as your wish.In Topic page 1Embed two visualizationsWrite 250 words of contextIn Topic page 2Create a gallery of 4 images using a 2 x 2 tablesCreate a common style sheet for each page and define font and color styles for the following elements:BODY, H1, and PCreate a common menu in each page that links to the other pages

Mdst 3559-02-08-css

  • 1.
    HTML and CSSMDST3559: DataestheticsProf. Alvarado02/08/2011
  • 2.
    BusinessRevised syllabusWill movefrom HTML to PHP Then move down the stack into SQL
  • 3.
    ReviewjEditHTMLBasic CSSTouched onidea of documents as data structures
  • 4.
  • 5.
    OverviewData structures andtransformationsData, addressability, and pathsCSS selectors to control look and feelCSS selectors to control behavior
  • 6.
  • 7.
    StructuresWe have seenthree basic structures so far:Linear sequence of content (e.g. news article)Tree structure of source code (HTML)Tabular structure of CSVHow are these related?What depends on what?How are they combined?
  • 8.
    Structures and TransformsThenews article is an interpreted version of the treeThe tree is transformed into a sequence by means of rules defined by CSS and other standardsCSV is actually a tree as wellTableRow +Cell +Where the number of cells is the same throughout
  • 9.
  • 10.
    How do therules work?What does “interpretation” mean in this context?
  • 11.
    “Interpretation”Every data structureconsists of elementsIn a data structure, every element has an addressA transformation is achieved by applying one or more rule to a data structureRules reference elements by addressEither directly or by means of patterns ...
  • 12.
    Example transform rulesForevery element of pattern X, display using font YFor every element at location R and C, express as a point on a graph at position X and Y
  • 13.
    The key ideais selectionWhat to pick from the whole and what to do with it
  • 14.
    So, how doesCSS do this?How does it select?
  • 15.
    With SelectorsPatternselector {key:value;}Examplebody { font-size: 12pt;}
  • 16.
    CSS Selectors: BasicXElementsof type X#XElement with ID X.XElements of Class X*Every elementX Y Y is child of XX > YY is immediate childX + YY follows XX ~ YY immediately follows
  • 17.
    CSS Selectors: AttributesX[title]Xhas titleX[href=“foo”]X has href of ‘foo’X[href*=”foo"]href contains ‘foo’ X[href^="http"]href begins with ...X[href$=".jpg”]href ends withX[data-*="foo"]Attribute matchesX[foo~="bar"]Attribute among valuese.g. attr=“v1 v2 v3”
  • 18.
    CSS Selectors: PseudoX:linkunclickedanchorX:visitedclicked anchorX:hoveron mouse hoverX:checkedchecked inputX:beforeX:afterBefore and after the elementWorks with the content propertyE.g. content:”foo”;
  • 19.
    CSS Selectors: DoubleColonX::first-letterX::first-line
  • 20.
    ExerciseDownload Aristlotle’s Poetics,Section I, Parts I & IIMark up using DIVs with following classes and IDs#front-matter#(title).creator +, #(role)#(date)#content.section +, #(section-N).section-title.part +, #(part-N).part-titlep +
  • 21.
    Exercise (cont’d)Then createa CSS element in the header to style each class and IDVary the following propertiesfont-sizefont-weightfont-familypaddingmarginfirst-letter of a section
  • 22.
    Assignment (to beposted)Create a page collection in your STUDIO1 directory with the following items:Main page  main1.htmlTopic page 1  main1-topic1.htmlTopic page 2  main1-topic2.htmlFor each page, create a TITLE element and an H1 element, titling each page as your wish.In Topic page 1Embed two visualizationsWrite 250 words of contextIn Topic page 2Create a gallery of 4 images using a 2 x 2 tablesCreate a common style sheet for each page and define font and color styles for the following elements:BODY, H1, and PCreate a common menu in each page that links to the other pages