CSS Tutorial - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

CSS Tutorial

Description:

Advantages of CSS versus HTML formatting. Based on CSS Tutorial at ... p style='color: sienna; margin-left: 20px' This is a paragraph /p Use this method ... – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 24
Provided by: galatiAr
Category:
Tags: css | sienna | tutorial

less

Transcript and Presenter's Notes

Title: CSS Tutorial


1
CSS Tutorial
  • Introduction
  • Syntax
  • How to use style specifications.
  • Styles

2
Introduction
  • CSS
  • HTML element
  • CSS style
  • Advantages of CSS versus HTML formatting

3
Syntax
selector property value Examples
body color black p font-family "sans
serif" p text-aligncentercolorred
4
How to ... - External Style Sheet
Styles are specified in an external file. This is
the most common and useful way of using style
specifications. ltheadgt ltlink rel"stylesheet"
type"text/css" href"mystyle.css"gt lt/headgt .
..
relationship
5
How to ... - Internal Style Sheet
Styles are specified inside the header of the
HTML document. ltheadgt ltstyle type"text/css"gt hr
color sienna p margin-left 20px body
background-image url("images/back40.gif") lt/sty
legt lt/headgt ...
6
How to ... - Inline styles
A style is applied to only one occurrence of an
element. ltp style"color sienna margin-left
20px"gt This is a paragraph lt/pgt
Use this method sparingly!
7
How to ... - Styles Priority
  • Browser default
  • External style sheet
  • Internal style sheet
  • Inline style

8
Syntax - Grouping
You can set a property for more than one element
(tag) at a time. Example
h1, h2, h3 color green
9
Syntax Class Selector
With the class selector you can set different
styles for the same type of HTML
element. Example ltp class"right"gt This
paragraph will be right-aligned. lt/pgt ltp
class"center"gt This paragraph will be
center-aligned. lt/pgt
p.right text-align right p.center text-align
center
10
Syntax Class Selector (cont.)?
You can omit the tag name to define the style for
all HTML elements with a certain
class. Example lth1 class"center"gt This
heading will be center-aligned lt/h1gt ltp
class"center"gt This paragraph will also be
center-aligned. lt/pgt
.center text-align center
11
Syntax id selector
You can define styles for HTML elements with a
certain 'id' attribute. Example 1 lth1
id"verde"gt This heading will be green lt/h1gt ltp
id"verde"gt This paragraph will also be greenlt/pgt
verde color green
12
Syntax Pseudo-classes
A link that is active, visited, unvisited, or
when the mouse is above it can be displayed
differently using CSS. selectorpseudo-class
property value Example
alink color FF0000 / unvisited link
/ avisited color 00FF00 / visited link
/ ahover color FF00FF / mouse over link
/ aactive color 0000FF / selected link /
13
Syntax CSS Comments
CSS comments start with a / and end with
/ Example
/ This is a comment / p text-align
center / This is another comment / color
black font-family arial
14
Styles - Background
  • The CSS background properties allows you to
  • change background color of an element
  • set an image as the background
  • repeat a background image vertically or
    horizontally
  • position an image on a page.

15
(No Transcript)
16
(No Transcript)
17
Styles - Text
The CSS text properties allow you to control the
appearance of text. It is possible to change the
color of a text, increase or decrease the space
between characters in a text, align a text,
decorate a text, indent the first line in a
paragraph, and more.
18
(No Transcript)
19
Styles - Font
The CSS font properties allow you to change the
font family, boldness, size, and the style of a
text.
20
(No Transcript)
21
Styles Border, Margin, Padding
Border Specify the style and color of an
element's border Margin Specify space around
elements Padding Specify space between the
element border and the element content
22
Styles - Margin
23
Styles List
Allow you to change between various list item
markers.
Write a Comment
User Comments (0)
About PowerShow.com