0% found this document useful (0 votes)
13 views15 pages

HTML and CSS Basics - III - Slides

The document provides an overview of HTML and CSS basics, focusing on CSS properties such as backgrounds, fonts, and the box model. It includes examples of how to apply various styles, including background colors, text alignment, and font settings. Additionally, it introduces custom fonts using @import and @font-face, as well as HTML tags like <span> and <div> for structuring content.

Uploaded by

Cédric AJAVON
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views15 pages

HTML and CSS Basics - III - Slides

The document provides an overview of HTML and CSS basics, focusing on CSS properties such as backgrounds, fonts, and the box model. It includes examples of how to apply various styles, including background colors, text alignment, and font settings. Additionally, it introduces custom fonts using @import and @font-face, as well as HTML tags like <span> and <div> for structuring content.

Uploaded by

Cédric AJAVON
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

html & css basics

class three

CSS review, backgrounds,


fonts, & the box model
...so let’s attach our CSS
<head>
<link rel="stylesheet" href="
cafe.css" />
</head>
background
background-color
● žName (red)
● žRGB (rgb(255,0,0))
● žHex (#ff0000)
ž
TRY IT:
body {
background-color: #F1F2E4;
}
background
background-image
● žurl(‘image.jpg’)
žbackground-repeat
● repeat (default), repeat-x, repeat-y, no-repeat
background-position
● žleft, center, right, top, center, bottom
● žx% y% (0% 0% default)
● žxpos ypos
žbackground-attachment
● scroll (default), fixed
TRY IT:
#menu {
background-image:url('images/fabric_texture.jpg');
}
text
color
● žhex, RGB, or name
text-align
● žleft (default), center, right, or justify
ž
TRY IT:
h1 {
color: #B55109;
text-align:center;
}
text
text-decoration
● žnone (default), overline, line-through, underline, blink
žtext-transform
● žnone (default), uppercase, lowercase, capitalize
ž
TRY IT:
a {
text-decoration:none;
text-transform:uppercase;
color: #66839E;
}
font
font-size
● ždefault size is 16px
● žpx, cm, em, %, xx-small, x-small, small, medium, large, x-large, xx-large,
smaller, larger
font-weight
● žnormal(default), bold, bolder, lighter, 100-900
ž
TRY IT:
h1 { h2, h3 {
color: #B55109; color: #B55109;
text-align:center; font-size:2em;
font-size: 4em; font-weight:400;
font-weight: 400; }
}
font
font-family
● sž yntax= font-family:individual, family;
● fž amilies include: serif, sans-serif, monospace, cursive,
fantasy
font-style
● žnormal(default), italic, oblique
ž
TRY IT:
body {
background-color: #F1F2E4;
font-family: "Trebuchet MS", Helvetica, Tahoma, sans-serif;
}
font
Custom fonts: @import & @font-face
● žAllow you to use any font, provided it’s hosted somewhere
on the web.
● žMany options: Font Squirrel, Google web fonts, TypeKit,
etc.
ž
LET’S VISIT GOOGLE FONTS!
https://www.google.com/fonts#
font
@import
● žCan be linked at the top of your CSS like this:
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
ž
Or in the html <head> like this:
<link href='http://fonts.googleapis.com/css?
family=Sanchez|Oswald:
300|Oleo+Script|Stint+Ultra+Condensed'
rel='stylesheet' type='text/css'>
ž
font
@import
● žOnce this declaration is in place, refer to your new fonts using font-family
TRY IT:
body {
background-color: #F1F2E4;
font-family: 'Sanchez', serif;
}
In h2, h3:
font-family: 'Oswald', Verdana, Geneva, sans-serif;
In h1:
font-family: 'Oleo Script', cursive;
font
@import
● žOnce this declaration is in place, refer to your new fonts using font-family
TRY IT:
footer {
font-family: 'Oswald', sans-serif;
font-size: 1.5em;
text-align: center;
}
nav ul {
font-family: 'Oswald', sans-serif;
font-size: 1.75em;
}
h1 span {
font-family: 'Stint Ultra Condensed', cursive;
font-size: 1.1em;
}
span? what?!
<span> is an HTML tag which allows you to just
group some elements together. It doesn’t mean
anything!

TRY IT:
<h1>Sam <span>&amp;</span> Sally's
<span>Cafe</span></h1>
div <div></div>
<div>, like <span>, doesn’t mean anything. It’s
meant to divide up the page into related parts.
TRY IT:
</nav>
<div id="content">

</div>
<footer>
the box model
parts of a box:
margin
padding

h
e
i content
g
h
t
width

border

You might also like