leveraging css & html5 to enhance your madcap flare output ...€¦ · • every html element...

18
Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output: Part 1 Mike Kelley Sr. Information Developer

Upload: others

Post on 15-Jul-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

Insert Cover Image Here

Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output: Part 1 Mike Kelley Sr. Information Developer

Page 2: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

2

What is CSS? Cascading Style Sheets

Page 3: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

3

Multiple stylesheets

Page 4: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

4

1. Media type declarations • Such as @media screen, @media print, or @media pdf

2. Order of precedence (low-to-high priority): 1. User agent declarations (browser) 2. User normal declarations (user-imported stylesheet – usually via scripting) 3. Author normal declarations (us) 4. Author important declarations (us) 5. User important declarations (user-imported stylesheet – usually via scripting)

Style priority

Page 5: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

5

3. Specificity • p vs. div p • html body div ul li vs. ul li

4. Order specified • If two declarations have the same weight, origin, and specificity, the latter specified

wins.

Style priority

Page 6: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

6

selector { }

CSS syntax

Can reference any: • HTML element (<p>, <img>, <table>, <h1>) • Element class/ID (<p class=“big”>, <img id=“small”>)

value; property: The attribute of a selector you want to change. Things like: • color • font-size • border • background-color

Values are the setting you want to apply to a property.

You must end each property-value pair with a semi-colon (;).

h1 { font-family: Arial; }

h1, h2, h3, h4 { font-family: Arial; padding: 8px; font-weight: bold; border-bottom: 1px solid black; }

Page 7: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

CSS – DOM body p { >

html

head

text

script

body

h1 p

i

a

ul

li

p p

a

img

h2 p img div

p

a

a

img ul

p p

h2 ~ property: value; }

+

Page 8: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

8

Classes • The same class can be used multiple times. • Every HTML element can have multiple classes.

IDs • A unique ID can exist only once per HTML document. • Each HTML element can have only one ID.

They must both be declared in your HTML markup and your CSS code.

Class vs. ID (barcode)

(serial number)

Page 9: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

9

Use them as attributes of a given HTML element:

<p class=“isCompliant”> … such as Chrome or Firefox.

</p>

<p id=“notCompliant”> You should use a standards-compliant browser.

</p>

Classes and IDs in HTML

Page 10: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

10

Class: p.isCompliant { background-color: awesome; }

ID: p#notCompliant { background-color: ugly; }

Class and ID selectors in CSS

Page 11: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

11

Child elements can inherit some property values of their parents.

Style Inheritance

Page 12: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

12

CSS box model

Page 13: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

13

CSS box model margin – moves content in relation to other content padding – moves content in relation to its container

Page 14: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

14

• Pseudo-classes • Pseudo-elements

CSS pseudos A pseudo-class is a keyword that allows you to style an element when it has a special state. • a:hover – Apply this style to links only when they are

hovered. • h2:first-child – Apply this style only to H2s that

are the first child of their parent. • body :not(p) – Apply this style to every

descendant of the body that isn’t a paragraph. • :not(*) – This is a useless selector. It matches any

element that is not an element.

Pseudo-elements allow you to style certain parts of an element. • ::after – Allows you to add and style content after an

element. • ::before – Allows you to add and style content before

an element. • ::first-letter – Selects the first letter of the first

line of a block.

Page 15: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

15

The W3C • http://www.w3.org/TR/css-2010/ • http://www.webplatform.org/ Mozilla Developer Network (MDN): • https://developer.mozilla.org/en-US/docs/Web/CSS • https://developer.mozilla.org/en-US/docs/Web/CSS/Reference stackoverflow: http://stackoverflow.com/ Browser-specific developer tools • Right-click an element in a page and click “Inspect element” CSS Zen Garden: http://csszengarden.com/

CSS resources

Page 16: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

16

https://www.codecademy.com/learn/web https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started https://docs.webplatform.org/wiki/css/tutorials

CSS tutorials

Page 17: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

Full Conference Schedule Now Available

REGISTER BY OCTOBER 30TH TO SAVE: $200 Off Conference Packages

$200 Off Advanced Training Workshop

www.MadWorldConference.com

Page 18: Leveraging CSS & HTML5 to Enhance Your MadCap Flare Output ...€¦ · • Every HTML element can have multiple classes. IDs • A unique ID can exist only once per HTML document

THANK YOU FOR ATTENDING TODAY’S WEBINAR!

As a webinar attendee, receive $100 OFF our next advanced training course. Just $499 per student!

MadCap Flare Single Sourcing Training November 9-10, 2015 (web-based)

MadCap Flare CSS Training November 12-13, 2015 (web-based)

*Offer valid through October 30, 2015.

Note: Courses subject to change. Availability based on student registration.