Web Technologies: Course Code
Web Technologies: Course Code
2
Introduction
What is CSS?
•Cascading Style Sheets, referred as CSS, is a simple design
language intended to simplify the process of making web pages
presentable.
•CSS handles the look and feel part of a web page.
•Using CSS, you can control
– the color of the text,
– the style of fonts,
– the spacing between paragraphs,
– how columns are sized and laid out,
– what background images or colors are used,
– as well as a variety of other effects.
3
Introduction
What is CSS?
•CSS is easy to learn and understand but it provides a powerful
control over the formatting and presentation of an HTML
document.
•Most commonly, CSS is combined with the markup languages
HTML or XHTML.
4
Introduction
Advantages of CSS
•CSS saves time
– We can write CSS once and then reuse the same sheet in
multiple HTML pages.
– We can define a style for each HTML element and apply it
to as many web pages as you want.
5
Introduction
Advantages of CSS
•Easy maintenance
– To make a global change, simply change the style, and all
the elements in all the web pages will be updated
automatically.
6
Introduction
Advantages of CSS
•Multiple Device Compatibility
– Style sheets allow content to be optimized for more than
one type of device.
– By using the same HTML document, different versions of
a website can be presented for handheld devices such as
PDAs and cellphones or for printing.
8
Introduction
CSS Versions
•Cascading Style Sheets level 1 (CSS1) came out of W3C as a
recommendation in December 1996.
•This version describes the CSS language as well as a simple
visual formatting model for all the HTML tags.
•CSS2 became a W3C recommendation in May 1998 and builds
on CSS1.
•This version adds support for media-specific style sheets e.g.
printers and aural devices, downloadable fonts, element
positioning and tables.
9
CSS Syntax
A CSS rule-set consists of a selector and a declaration block:
11
CSS Syntax
A CSS rule-set consists of a selector and a declaration block:
•Example:
h1 {
color: #36C;
font-weight: normal;
letter-spacing: .4em;
margin-bottom: 1em;
text-transform: lowercase;
}
12
CSS Syntax
A CSS rule-set consists of a selector and a declaration block:
•Example:
H1, H2, H3 {
color: #36C;
font-weight: normal;
letter-spacing: .4em;
margin-bottom: 1em;
text-transform: lowercase;
}
13
Types of CSS
Three Ways to Insert CSS
14
Types of CSS
Inline Styling (Inline CSS)
Example
•<h1 style="color:blue;">This is a Blue Heading</h1>
15
Types of CSS
Internal Styling (Internal CSS)
16
Types of CSS
• Example
17
Types of CSS
External Styling (External CSS)
•An external style sheet is used to define the style for many
pages.
•With an external style sheet, you can change the look of an
entire web site by changing one file!
•To use an external style sheet, add a link to it in the <head>
section of the HTML page:
18
Types of CSS
• Example
19
Types of CSS
External Styling (External CSS)
•An external style sheet can be written in any text editor. The file
should not contain any html tags. The style sheet file must be
saved with a .css extension.
•Here is how the "styles.css" looks:
20
CSS Properties
21
CSS Properties
22
CSS Properties
23
CSS Properties
24
CSS Properties
25
CSS Properties
26
CSS Properties
Margin
27
CSS Properties
Padding
28
CSS Properties
Background/Images/Color
29
Features of CSS3
• CSS3 is the 3rd level and latest version of CSS, the style
language of web.
• It includes all the features of CSS1, CSS2, CSS2.1 including
its own new features.
• It is an integral part of HTML5.
30
Features of CSS3
CSS3 includes some new features, like new
•CSS3 selectors,
•rounded corners,
•box shadows,
•RGBA, HSL and HSLA colors,
•box sizing,
•Opacity,
•CSS3 Gradients,
•transitions,
•transformations,
•animations,
•multi-column layout,
•flex box,
•CSS grids, embedded fonts and Responsive web design . 31
Features of CSS3
32
Features of CSS3
33