css and-html-for-pub

135
#toccon @NellieMcKesson CSS (and HTML) for Publishers Nellie McKesson eBook Operations Manager, O’Reilly Media TOC, Feb 12, 2013

Upload: marc-jahjah

Post on 05-Dec-2014

1.608 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Css and-html-for-pub

#toccon @NellieMcKesson

CSS (and HTML) for Publishers

Nellie McKessoneBook Operations Manager, O’Reilly Media

TOC, Feb 12, 2013

Page 2: Css and-html-for-pub

#toccon @NellieMcKesson

75%of all O’Reilly titles

Page 3: Css and-html-for-pub

#toccon @NellieMcKesson

Why HTML and CSS?

Page 4: Css and-html-for-pub

#toccon @NellieMcKesson

Single-SourcePublishing

Page 5: Css and-html-for-pub

#toccon @NellieMcKesson

Print EPUB .mobi Web

Page 6: Css and-html-for-pub

#toccon @NellieMcKesson

files(4) =/= $(4)

Page 7: Css and-html-for-pub

#toccon @NellieMcKesson

XMLThe old O’Reilly way:

Page 8: Css and-html-for-pub

#toccon @NellieMcKesson

XMLEXtensible Markup Language

Page 9: Css and-html-for-pub

#toccon @NellieMcKesson

FurnitureXML<table>Coffee</table>

<chair>Eames</chair>

<desk>Writing</desk>

Page 10: Css and-html-for-pub

#toccon @NellieMcKesson

DocBook XML<book>

<chapter>

<sidebar>

Page 11: Css and-html-for-pub

#toccon @NellieMcKesson

Print EPUB .mobi

XML

XSL

XSL

Page 12: Css and-html-for-pub

#toccon @NellieMcKesson

XSLEXtensible Stylesheet Language

Page 13: Css and-html-for-pub

#toccon @NellieMcKesson

XSLTEXtensible Stylesheet Language Transformations

Page 14: Css and-html-for-pub

#toccon @NellieMcKesson

XSL-FOFormatting Objects

Page 15: Css and-html-for-pub

#toccon @NellieMcKesson

XML + XSLT + XSL-FO + PDF Processor

Page 16: Css and-html-for-pub

#toccon @NellieMcKesson

XML + XSLT + XSL-FO + PDF Processor

(Antenna House)

Page 17: Css and-html-for-pub

#toccon @NellieMcKesson

XML XSL

Magic Box(er, PDF Processor)

PDF!

Page 18: Css and-html-for-pub

#toccon @NellieMcKesson

Page 19: Css and-html-for-pub

#toccon @NellieMcKesson

XHTMLEXtensible HyperText Markup Language

Page 20: Css and-html-for-pub

#toccon @NellieMcKesson

Books Data

Page 21: Css and-html-for-pub

#toccon @NellieMcKesson

PrintEPUB .mobiWeb

HTML

Page 22: Css and-html-for-pub

#toccon @NellieMcKesson

Paged Media

Page 23: Css and-html-for-pub

#toccon @NellieMcKesson

Some BasicsHTML and CSS

Page 24: Css and-html-for-pub

#toccon @NellieMcKesson

<html>

<body>

<h1>This is the Page Title</h1>

<p>Here is a plain text paragraph</p>

</body>

</html>

Page 25: Css and-html-for-pub

#toccon @NellieMcKesson

<h1></h1>

Page 26: Css and-html-for-pub

#toccon @NellieMcKesson

<h1 title="Chapter 1: Hello World"></h1>

Page 27: Css and-html-for-pub

#toccon @NellieMcKesson

Page 28: Css and-html-for-pub

#toccon @NellieMcKesson

CSSCascading Style Sheets

Page 29: Css and-html-for-pub

#toccon @NellieMcKesson

<html>

<body>

<h1>This is the Page Title</h1>

<p style="color:blue;margin-left:20px;">Here is a plain text paragraph</p>

<p style="color:blue;margin-left:20px;" >Another paragraph</p>

<p style="color:blue;margin-left:20px;" >And another paragraph</p>

</body>

</html>

Page 30: Css and-html-for-pub

#toccon @NellieMcKesson

p {

color: blue;

margin-left: 20px;

}

Page 31: Css and-html-for-pub

#toccon @NellieMcKesson

Class

Page 32: Css and-html-for-pub

#toccon @NellieMcKesson

<p class="blue">

p.blue {

color: blue;

}

Page 33: Css and-html-for-pub

#toccon @NellieMcKesson

Less Class

Page 34: Css and-html-for-pub

#toccon @NellieMcKesson

The DOMDocument Object Model

Page 35: Css and-html-for-pub

#toccon @NellieMcKesson

bodychapter

headingparagraphparagraphsidebar

paragraphimage

paragraphchapter

headingimagep

Page 36: Css and-html-for-pub

#toccon @NellieMcKesson

<body><section>

<h1><p><p><aside>

<p><img>

<p><section>

<h1><img><p>

Page 37: Css and-html-for-pub

#toccon @NellieMcKesson

aside p {

font-style: italic;

}

Page 38: Css and-html-for-pub

#toccon @NellieMcKesson

aside + p {

font-style: italic;

}

aside > p {

font-style: italic;

}

Page 39: Css and-html-for-pub

#toccon @NellieMcKesson

Selectorsw3schools.com

Page 40: Css and-html-for-pub

#toccon @NellieMcKesson

Cascades

Page 41: Css and-html-for-pub

#toccon @NellieMcKesson

<body><section>

<h1><p><p><aside>

<p><img>

<p><section>

<h1><img><p>

Page 42: Css and-html-for-pub

#toccon @NellieMcKesson

aside p {

font-style: italic;

}

p {

font-style: normal;

}

Page 43: Css and-html-for-pub

#toccon @NellieMcKesson

<body><div>

<h2><p><p><div>

<p><img>

<p><div>

<h2><img><p>

<body><section>

<h1><p><p><aside>

<p><img>

<p><section>

<h1><img><p>

<body><div class="chapter">

<h2><p><p><div>

<p class="sidebartext"><img>

<p><div class="chapter">

<h2><img><p>

Page 44: Css and-html-for-pub

#toccon @NellieMcKesson

Creativity :)Scalability :(

Page 45: Css and-html-for-pub

#toccon @NellieMcKesson

We Cheated

Page 46: Css and-html-for-pub

#toccon @NellieMcKesson

== AsciiDoc

This is a text paragraph.

.Here’s a bullet list* Item One* Item Two* Item Three

.Here’s a sidebar++++Sidebar paragraph goes here.++++

Page 47: Css and-html-for-pub

#toccon @NellieMcKesson

PDF EPUB .mobi

asc

Web

XML

HTML

Page 48: Css and-html-for-pub

#toccon @NellieMcKesson

Dynamic ElementsTable of Contents, Index, Cross Refs

Page 49: Css and-html-for-pub

#toccon @NellieMcKesson

Why Even Bother?

Page 50: Css and-html-for-pub

#toccon @NellieMcKesson

Page 51: Css and-html-for-pub

#toccon @NellieMcKesson

HTML <3

Page 52: Css and-html-for-pub

#toccon @NellieMcKesson

Well, there’s EPUB

Page 53: Css and-html-for-pub

#toccon @NellieMcKesson

HTMLBookA Spec for HTML-based Books

Page 54: Css and-html-for-pub

#toccon @NellieMcKesson

HTMLBook = HTML + CSS

Not a New Language, No Extra Stuff

Page 55: Css and-html-for-pub

#toccon @NellieMcKesson

<section class="chapter">

<h1 class="title">

<ol class="toc">

Page 56: Css and-html-for-pub

#toccon @NellieMcKesson

Invisible Markup

Page 57: Css and-html-for-pub

#toccon @NellieMcKesson

CSS 3 Paged Mediaphew

!

Page 58: Css and-html-for-pub

#toccon @NellieMcKesson

The Box Model

Page 59: Css and-html-for-pub

#toccon @NellieMcKesson

marginborderpaddingcontent

Page 60: Css and-html-for-pub

#toccon @NellieMcKesson

margin

border

padding

content

Page 61: Css and-html-for-pub

#toccon @NellieMcKesson

margin

Page 62: Css and-html-for-pub

#toccon @NellieMcKesson

Master Pages

Page 63: Css and-html-for-pub

#toccon @NellieMcKesson

@page {

size: 6in 9in;

margin: 0.5in 1in .75in 1in;

padding: 0.25in;

}

Page 64: Css and-html-for-pub

#toccon @NellieMcKesson

@page {

size: 6in 9in;

margin: 0.5in 1in .75in 1in;

padding: 0.25in;

}

Page 65: Css and-html-for-pub

#toccon @NellieMcKesson

:left :right:first

Page 66: Css and-html-for-pub

#toccon @NellieMcKesson

@page {

size: 6in 9in;

margin-top: 0.75in;

margin-bottom: 0.75in;

}

@page:right {

margin-right: .5in;

margin-left: 1in;

}

@page:left {

margin-right: 1in;

margin-left: .5in;

}

Page 67: Css and-html-for-pub

#toccon @NellieMcKesson

@page {

size: 6in 9in;

margin-top: 0.75in;

margin-bottom: 0.75in;

}

@page:right {

margin-right: .5in;

margin-left: 1in;

}

@page:left {

margin-right: 1in;

margin-left: .5in;

}

@page:right {

size: 6in 9in;

margin-top: 0.75in;

margin-bottom: 0.75in;

margin-right: .5in;

margin-left: 1in;

}

@page:left {

size: 6in 9in;

margin-top: 0.75in;

margin-bottom: 0.75in;

margin-right: 1in;

margin-left: .5in;

}

=

Page 68: Css and-html-for-pub

#toccon @NellieMcKesson

@page {

size: 6in 9in;

margin-top: 0.75in;

margin-bottom: 0.75in;

}

@page:right {

margin-right: .5in;

margin-left: 1in;

}

@page:left {

margin-right: 1in;

margin-left: .5in;

}

Page 69: Css and-html-for-pub

#toccon @NellieMcKesson

Named Pages

Page 70: Css and-html-for-pub

#toccon @NellieMcKesson

@page chaptermaster {

border-bottom: 1pt solid black;

}

section.chapter {

page: chaptermaster;

}

Page 71: Css and-html-for-pub

#toccon @NellieMcKesson

@page chaptermaster {

border-bottom: 1pt solid black;

}

@page chaptermaster:first {

border-bottom-width: 0pt;

}

Page 72: Css and-html-for-pub

#toccon @NellieMcKesson

Headers & Footers

Page 73: Css and-html-for-pub

#toccon @NellieMcKesson

@page chaptermaster {

margin-top: 1in;

margin-right: .5in;

margin-bottom: 1.2in;

margin-left: 1in;

}

Page 74: Css and-html-for-pub

#toccon @NellieMcKesson

Page 75: Css and-html-for-pub

#toccon @NellieMcKesson

marginborderpaddingcontent

Page 76: Css and-html-for-pub

#toccon @NellieMcKesson

margin-top: .5in;

margin-left: 1in;

Page 77: Css and-html-for-pub

#toccon @NellieMcKesson

margin-left: 1in;

Page 78: Css and-html-for-pub

#toccon @NellieMcKesson

width = 1in

height = ????

Page 79: Css and-html-for-pub

#toccon @NellieMcKesson

Page 80: Css and-html-for-pub

#toccon @NellieMcKesson

Page 81: Css and-html-for-pub

#toccon @NellieMcKesson

content: PUT STUFF HERE;

Page 82: Css and-html-for-pub

#toccon @NellieMcKesson

Page 83: Css and-html-for-pub

#toccon @NellieMcKesson

@page index:right { @bottom-right { content: "Index"; text-align: right; }}

@page index:left { @bottom-left { content: "Index"; text-align: left; }}

Page 84: Css and-html-for-pub

#toccon @NellieMcKesson

Page 85: Css and-html-for-pub

#toccon @NellieMcKesson

Strings

Page 86: Css and-html-for-pub

#toccon @NellieMcKesson

Page 87: Css and-html-for-pub

#toccon @NellieMcKesson

h1 { string-set: Chaptertitle self;}

Page 88: Css and-html-for-pub

#toccon @NellieMcKesson

:before :after

Page 89: Css and-html-for-pub

#toccon @NellieMcKesson

h1:before { content: "Hello "; }

h1:after { content: ". Goodbye."; }

<h1>World</h1>

“Hello World. Goodbye.”

Page 90: Css and-html-for-pub

#toccon @NellieMcKesson

h1 { string-set: Chaptertitle self before;}

Page 91: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter h1.title { string-set: Chaptertitle self before;}

Page 92: Css and-html-for-pub

#toccon @NellieMcKesson

@page chaptermaster:left { @bottom-left { content: string(Chaptertitle); }}

Page 93: Css and-html-for-pub

#toccon @NellieMcKesson

Page 94: Css and-html-for-pub

#toccon @NellieMcKesson

Counters!

Page 95: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter { counter-increment: chapter;}

Page 96: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter { counter-increment: chapter 10;}

Page 97: Css and-html-for-pub

#toccon @NellieMcKesson

body { counter-reset: chapter;}

Page 98: Css and-html-for-pub

#toccon @NellieMcKesson

body { counter-reset: chapter; counter-reset: appendix;}

Page 99: Css and-html-for-pub

#toccon @NellieMcKesson

body { counter-reset: chapter appendix;}

Page 100: Css and-html-for-pub

#toccon @NellieMcKesson

body { counter-reset: chapter 9;}

Page 101: Css and-html-for-pub

#toccon @NellieMcKesson

content: PUT STUFF HERE;count

ers

Page 102: Css and-html-for-pub

#toccon @NellieMcKesson

:before :after

Page 103: Css and-html-for-pub

#toccon @NellieMcKesson

Chapter 1: Hello World

Page 104: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter h1.title:before { content: counter(chapter);}

Page 105: Css and-html-for-pub

#toccon @NellieMcKesson

1Hello World

ugh

Page 106: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter h1.title:before { content: "Chapter " counter(chapter) ": ";}

Page 107: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter h1.title:before { content: "Chapter " counter(chapter) ": ";}

Page 108: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter h1.title:before { content: "Chapter " counter(chapter) ": ";}

Don’t forget spaces

Page 109: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter h1.title:before { content: "Chapter " counter(chapter) ": ";}

Page 110: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter h1.title:before { content: "Chapter " counter(chapter) ": ";}

Page 111: Css and-html-for-pub

#toccon @NellieMcKesson

Chapter 1: Hello World

yay!

Page 112: Css and-html-for-pub

#toccon @NellieMcKesson

Page 113: Css and-html-for-pub

#toccon @NellieMcKesson

Page 114: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter h1.title:before { content: "Chapter " counter(chapter) ": ";}

section.chapter h1.title { string-set: Chaptertitle self before;}

+

Page 115: Css and-html-for-pub

#toccon @NellieMcKesson

Page 116: Css and-html-for-pub

#toccon @NellieMcKesson

pagepages

Page 117: Css and-html-for-pub

#toccon @NellieMcKesson

section.chapter:first-of-type { counter-reset: page 1;}

Page 118: Css and-html-for-pub

#toccon @NellieMcKesson

@page chaptermaster:left { @bottom-left { content: counter(page) string(Chaptertitle); }}

Page 119: Css and-html-for-pub

#toccon @NellieMcKesson

@page chaptermaster:left { @bottom-left { content: counter(page)" | "string(Chaptertitle); }}

Page 120: Css and-html-for-pub

#toccon @NellieMcKesson

Page 121: Css and-html-for-pub

#toccon @NellieMcKesson

content: counter(page, lower-roman);

Page 122: Css and-html-for-pub

#toccon @NellieMcKesson

Page 123: Css and-html-for-pub

#toccon @NellieMcKesson

Cascades <3

Page 124: Css and-html-for-pub

#toccon @NellieMcKesson

PDF x 2

Page 125: Css and-html-for-pub

#toccon @NellieMcKesson

@charset "UTF-8";@import "core.css";/* Special stuff for Print PDFs goes here */

@charset "UTF-8";@import "core.css";/* Special stuff for Web PDFs goes here */

Page 126: Css and-html-for-pub

#toccon @NellieMcKesson

Print

Page 127: Css and-html-for-pub

#toccon @NellieMcKesson

Resolution

Page 128: Css and-html-for-pub

#toccon @NellieMcKesson

img {image-resolution: from-image;}

Page 129: Css and-html-for-pub

#toccon @NellieMcKesson

CMYK

Page 130: Css and-html-for-pub

#toccon @NellieMcKesson

hr {color: device-cmyk(0,0,0,0.3);}

Page 131: Css and-html-for-pub

#toccon @NellieMcKesson

hr {color: #B3B3B3;color: device-cmyk(0,0,0,0.3);}

Page 132: Css and-html-for-pub

#toccon @NellieMcKesson

Marks & Bleeds

Page 133: Css and-html-for-pub

#toccon @NellieMcKesson

Page 134: Css and-html-for-pub

#toccon @NellieMcKesson

@page {bleed: 6pt;marks: crop;}

Page 135: Css and-html-for-pub

#toccon @NellieMcKesson

@page:index { @right-top { border-right: .5in; margin-right: -.25in;}