CSS (Cascading Style Sheet)
CSS (Cascading Style Sheet)
example
h1 {color: red;}
the <h1> tag is our selector, the property is color and the
value is red
Selector types:
➢Element Selectors: selects all elements of a specific type
(<body>, <h1>, <p>, etc.)
5
Applying Style Sheets
Three main methods of applying style sheets to a html
document, these are
6
Embedding style sheets(Internal)
It can be used if one single document has a unique style.
Internal styles are defined in the <head> section of an HTML
page, by using the <style> tag, like this:
<head>
<style type="text/css">
body {background-color: yellow;}
p {color: blue;}
</style>
</head>
7
Inline style sheets
style properties can easily be included in individual html tags
like this...
</H1>
8
External style sheet
the ability to use an external style sheet adds a tremendous amount
of flexibility to html documents, because any amount of pages can
link to the same .css document a uniform look can be applied to an
entire website.
the benefits of an external style sheet are that file size is reduced
because individual html documents do not require a style sheet to
be embedded as well as the obvious saving in time
an external style sheet can be written with most simple text editors
and should be saved as whatever-you-want.css
10
Cascading Style Sheets and Class
Finds all elements of a given class –based on the attribute’s class value.
Syntax: .class name(Remember the dot means class selector)
Example:
.purple{
font-weight: bold;
background: pink;
color: purple;
font-size: 12pt;}
Finds all elements whose class = “Purple "and makes their font bold ,their color
purple ,their font size 12 and their backgrounds pink.
<h1 class="purple">This is heading one text with class</h1> other tags can
share a class
font-style: italic;
15
Text Properties
text-indent: indents first line of a paragraph according to size
text-transform: Capitalize;
Line-height: added vertical space to each line of text
according to size
16
List Properties <ul>
17
Border Properties
border-width:(thin, medium, thick, or size)
border-style:(none, hidden, dotted, dashed, solid, double,
groove, ridge, inset, or outset)
19
Color Properties
color: specifies the text color.
background-color: specifies the background color.
black; or #000000;
red; or #FF0000;
lime; or #00FF00;
blue; or #0000FF;
white; or #000000;
23