Ms. Belle Salazar-Sandagon
Ms. Belle Salazar-Sandagon
1. Browser default
2. External Style Sheet
3. Internal Style Sheet (inside the <head> tag)
4. Inline Style (inside HTML element)
Multiple Styles Will
Cascade Into One
Style Sheets allow style information to be
specified in many ways.
Styles can be specified inside a single HTML
element, inside the <head> element of an
HTML page, or in an external CSS file.
multiple external Style Sheets can be
referenced inside a single HTML document.
To Create Inline Style Sheet
declare the style inside an HTML tag.
add the style=" " attribute to an html tag.
The general form to add one style property:
style="property:value"
Ex. A colored paragraph
<p style=color:red;font-family:"algerian";>
i am red
</p>
To create internal CSS:
add a new tag, <style>, inside the <head> tag.
Ex. Body and paragraph style
<html>
<head>
<style type="text/css">
p {color: white; }
body {background-color: black; }
</style>
</head>
<body>
<p>White text on a black background!</p>
</body>
</html>
External CSS
When using CSS it is preferable to keep the CSS
separate from your HTML.
Placing CSS in a separate file allows the web
designer to completely differentiate between
content (HTML) and design (CSS).
External CSS is a file that contains only CSS code
and is saved with a ".css" file extension.
This CSS file is then referenced in your HTML
using the <link> instead of <style>.
To Create External CSS
1. Create CSS Code external file:
body{ background-color: gray;}
p { color: blue; } h3{ color: white; }
2. Now save the file as a CSS (.css) file
ex. test.css
3. Create a separate HTML file.
4. 4. Call the .css external file w/n the
head tag of HTML file
4. Call the .css external file w/n the head tag of
HTML file
<html>
<head>
<link rel="stylesheet" type="text/css" href="test.css“/>
</head>
<body>
<h3> A White Header </h3>
<p> This paragraph has a blue font. The background color of
this page is gray because we changed it with CSS! </p>
</body> </html>
The class Selector
class selector- use to define different styles
for the same type of HTML element. It may
apply to SEVERAL elements on a page
Ex. two types of paragraphs in your
document: one right-aligned paragraph,
and one center-aligned paragraph.
none (default)
Changes the
uppercase
text-transform case of a
lowercase
section of text
capitalize
Text Properties
baseline (default)
sub
super
Controls the vertical
top
vertical-align alignment of a
text-top
section of text
middle
bottom
text-bottom
Font Properties
Property What it Does Possible Values
medium (default)
Controls the size of the
font-size number of pixels
font
percentage
normal (default)
Controls the style of the
font-style italic
font
oblique
Font Properties
medium (default)
Controls the size of the
font-size number of pixels
font
percentage
Controls the variant of normal (default)
font-variant
the font small-caps
normal (default)
lighter
bold ,bolder
100
200
Controls the boldness
font-weight 300
of the font
400
500
600
700
800 , 900
Color/Background
Properties
Property What it Does Possible Values
browser decides
Controls the color of the
color (default)
text
color name
0% 0% (default)
postion in pixels ie
{20,20}
percentage ie
Controls the position of
{5%,7%}
background-position the background on
top
the page
bottom
left
right
center
Box Properties
Property What it Does Possible Values
auto (default)
Controls the width of a
width number of pixels
section
percentage
auto (default)
Controls the height of a
height number of pixels
section
percentage
default text color
Controls the border
border-color (default)
color of a section
color name
none (default)
Controls the style of a
border-style solid
border
double
Box Properties
undefined (default)
number of pixels
Controls the width of a
border-width thin
border
medium
thick
medium (default)
Controls the width of a number of pixels
border-top-width
border side thin
thick
medium (default)
Controls the width of a number of pixels
border-left-width
border side thin
thick
Box Properties
medium (default)
Controls the width of a number of pixels
border-right-width
border side thin
thick
medium (default)
Controls the width of a number of pixels
border-bottom-width
border side thin
thick
Controls the width of a 0 (default)
margin-top margin from the number of pixels
specified side percentage
Controls the width of a 0 (default)
margin-left margin from the number of pixels
specified side percentage
Box Properties
Controls the width of a 0 (default)
margin-right margin from the number of pixels
specified side percentage