being awesome with css · 2017-09-02 · css: the quick facts • css was created ‘cause html...

15
Being Awesome with CSS A tutorial by Zoe F

Upload: others

Post on 14-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

Being Awesome with CSSA tutorial by Zoe F

Page 2: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

CSS: The quick facts

• CSS was created ‘cause HTML just isn’t made for complex formatting

• The cobbled together CSS to solve the problem

• Everyone hated it• Eventually they learned to live with it.

Page 3: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

Eh?  Why do we want it? 

• It allows us to get rid of attributes• A much more flexible design• Different styles can be used in different situations

Page 4: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

Let’s see it in action!

http://www.csszengarden.com

Page 5: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

Known problems and bugs. 

• There’s no good WYSIWYG editor for CSS• Getting things to stack vertically is really tough

• There’s still some variation between browsers

Page 6: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

CSS:  The final frontierhttp://www.w3schools.com/Css/css_reference_atoz.asp

The old way:<font size = 36pt color = “blue”><B><h1>Hello</h1></b></font>

The new hotness:H1 {

font‐size:36pt; color:blue; font‐weight:bold} 

<h1>Hello</hello>

SelectorProperties: Values

Declaration

Tags/Attributes

Page 7: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

CSS three ways!

• Inline Styles

• Internal Stylesheets

• External Stylesheets

More html

Less html

Page 8: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

The 1 minute rule!

Are you stuck on a bug?  Wait one minute, then ask the person next toyou.  

It’s the XP way!

Page 9: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

Our materials!

Lab:http://www.binaryspark.com/classes/CSS_rocks/CSS_lab_instructions.html

Materials:http://www.binaryspark.com/classes/CSS_rocks/materials.zip

Page 10: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

Inline Styles

Old way<p><font color = blue>This is a paragaph</font></p>

New way<p style="color:blue; ">This is a paragraph.</p>

Page 11: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

Internal stylesheetsIn the header:

<style type="text/css">ul {background‐color:yellow;

color:white; }

p {color:blue}</style>

In the body:<ul>

<li>list item 1<li>list item 2

</ul>

Page 12: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

External stylesheets

Separating out the CSS and the content completely.  Finally.

Page 13: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

Creating  a Class!

• Classes that can apply to any type of tag:

• Classes that only apply to one or two types of tag:

• ON a tag

• With no existing tag

Calling a Class!

Page 14: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

Class‐y vocab

• InheritanceP.title, P.subtitle, P.isblue, {color:blue;}P.Title {text‐align:center;}

• OverwritingP.title, P.subtitle P.isblue, {

color:blue ; text‐align:center;}

P.title { color: red;}

Page 15: Being Awesome with CSS · 2017-09-02 · CSS: The quick facts • CSS was created ‘cause HTML just isn’t made for complex formatting • The cobbled together CSS to solve the

DIV’s and why they rock

<div ID=“imadiv”><h3>This is a header</h3><p>This is a paragraph.</p></div>

#imadiv {   color:green;                 

}