Intro to CSS
- 3. Why Learn CSS?
1. Running a blog on a CMS and
want to tweak things
2. Working with a developer and
want to understand how to talk
with them
3. Web designer looking to
understand how things get built
- 4. What We’ll Learn
1. What is CSS
2. How to speak CSS
3. How to apply it
4. Where to find out
more info
- 14. Think of classes as your name
and nicknames, e.g. Randy,
Amazing Rando, Hey You…
Think of IDs as your unique
social security or credit card
numbers.
- 19. .class
{
color:
#fff;
padding:
10px;
}
Properties & Values
Property
Value
- 22. 1. External File
2. Internal, using the
<style> tag
3. Inline styles
Getting CSS into the HTML
- 23. Put this inside the <head>
<link
rel="stylesheet"
href="file.css">
External File
- 24. Put this inside the <head>
<style
type="text/css">
…
your
styles
…
</style>
Internal
- 34. An element’s size is equal to:
Width (or Height)
+ Padding
+ Border
+ Margin
= Total Size
The Box Model is Tricky
- 35. .box
{
width:
200px;
padding:
10px;
border:
5px;
margin:
15px;
}
- 36. So if we plug in values:
Width (200px)
+ Padding (10px * 2 sides)
+ Border (5px * 2 sides)
+ Margin (15 px * 2 sides)
= Total Size (260px)
The Box Model is Tricky
- 39. *,
*:before,
*:after
{
-‐webkit-‐box-‐sizing:
border-‐box;
-‐moz-‐box-‐sizing:
border-‐box;
box-‐sizing:
border-‐box;
}
Magic Bullet
- 44. Starts at NOON
and goes clockwise.
padding:
top
right
bottom
left;
Shorthand
- 48. a
{
display:
block;
}
The Display Property
- 49. There are many more
exotic display types, such
as inline-‐block, none, etc.
The Display Property
- 52. img
{
float:
left;
}
The Display Property
- 55. img
{
position:
static;
}
Positioning
This is the default, no need to write it
- 57. img
{
position:
fixed;
top:
0px;
left:
0px;
}
Positioning
- 58. top:
0px;
right:
0px;
bottom:
0px;
left:
0px;
Positioning
- 60. img
{
position:
relative;
top:
-‐10px;
left:
-‐200px;
}
Positioning
- 62. img
{
position:
absolute;
top:
0px;
left:
0px;
}
Positioning
- 66. img
{
position:
absolute;
top:
0px;
left:
0px;
}
Positioning