SlideShare a Scribd company logo
1 of 43
P a g e 1 | 43
Contents
Introduction to CSS?...........................................................................................................................3
Advantagesof CSS.......................................................................................................................3
Who Creates and Maintains CSS?................................................................................................3
CSS Versions................................................................................................................................4
CSS3 Modules ........................................................................................................................4
CSS - Syntax........................................................................................................................................4
The Type Selectors.......................................................................................................................5
The Universal Selectors................................................................................................................5
The Descendant Selectors............................................................................................................5
The Class Selectors.......................................................................................................................5
The ID Selectors...........................................................................................................................6
The Child Selectors.......................................................................................................................6
The Attribute Selectors.................................................................................................................7
Multiple Style Rules.......................................................................................................................7
Grouping Selectors.......................................................................................................................7
The CSS Box Model.............................................................................................................................8
CSS - Measurement Units....................................................................................................................8
CSS - Colors......................................................................................................................................10
CSS - Borders....................................................................................................................................10
The border-color Property..........................................................................................................10
The border-style Property...........................................................................................................11
The border-width Property −.....................................................................................................12
Border Properties Using Shorthand............................................................................................13
CSS - Margins...................................................................................................................................14
The Margin Property...................................................................................................................14
CSS - Paddings..................................................................................................................................15
The padding-bottom Property....................................................................................................15
CSS - Lists.........................................................................................................................................15
The list-style-type Property........................................................................................................16
CSS - Positioning...............................................................................................................................18
P a g e 2 | 43
Relative Positioning.....................................................................................................................18
Absolute Positioning....................................................................................................................19
Fixed Positioning.........................................................................................................................19
CSS Reference ..................................................................................................................................20
Color Properties..........................................................................................................................20
Background and Border Properties............................................................................................20
Basic Box Properties...................................................................................................................24
Flexible Box Layout.....................................................................................................................27
Text Properties............................................................................................................................28
Text Decoration Properties.........................................................................................................30
Font Properties...........................................................................................................................31
Writing Modes Properties..........................................................................................................33
Table Properties..........................................................................................................................33
Lists and Counters Properties.....................................................................................................34
Animation Properties..................................................................................................................34
Transform Properties..................................................................................................................36
Transitions Properties.................................................................................................................36
Basic User Interface Properties...................................................................................................37
Multi-column Layout Properties.................................................................................................38
Paged Media...............................................................................................................................39
Generated Content for Paged Media.........................................................................................40
Filter Effects Properties...............................................................................................................40
Image Values and Replaced Content .........................................................................................40
Masking Properties.....................................................................................................................40
Speech Properties.......................................................................................................................41
Marquee Properties....................................................................................................................42
P a g e 3 | 43
Introduction to CSS?
Cascading Style Sheets, fondly referred to 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,
layout designs,variations in display for different devices and screen sizes as
well as a variety of other effects.
CSS is easy to learn and understand but it provides powerful control over the
presentation of an HTML document. Most commonly, CSS is combined with
the markup languages HTML or XHTML.
Advantages of CSS
 CSS saves time − You can write CSS once and then reuse same sheet in multiple HTML
pages. You can define a style for each HTML element and apply it to as many Web pages
as you want.
 Pages load faster − If you are using CSS, you do not need to write HTML tag attributes
every time. Just write one CSS rule of a tag and apply it to all the occurrences of that
tag. So less code means faster download times.
 Easy maintenance − To make a global change, simply change the style, and all
elements in all the web pages will be updated automatically.
 Superior styles to HTML − CSS has a much wider array of attributes than HTML, so
you can give a far better look to your HTML page in comparison to HTML attributes.
 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 cell phones or for
printing.
 Global web standards − Now HTML attributes are being deprecated and it is being
recommended to use CSS. So its a good idea to start using CSS in all the HTML pages to
make them compatible to future browsers.
 Offline Browsing − CSS can store web applications locally with the help of an offline
catche. Using of this, we can view offline websites.The cache also ensures faster loading
and better overall performance of the website.
 Platform Independence − The Script offer consistent platform independence and can
support latest browsers as well.
Who Creates and Maintains CSS?
CSS was invented by Håkon Wium Lie on October 10, 1994 and maintained
through a group of people within the W3C called the CSS Working Group. The
CSS Working Group creates documents called specifications. When a
specification has been discussed and officially ratified by W3C members, it
becomes a recommendation.
P a g e 4 | 43
These ratified specifications are called recommendations because the W3C has
no control over the actual implementation of the language. Independent
companies and organizations create that software.
NOTE − The World Wide Web Consortium, or W3C is a group that makes
recommendations about how the Internet works and how it should evolve.
CSS Versions
Cascading Style Sheets, level 1 (CSS1) was 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 was 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.
CSS3 was became a W3C recommendation in June 1999 and builds on older
versions CSS. It has divided into documentations is called as Modules and
here each module having new extension features defined in CSS2.
CSS3 Modules
CSS3 Modules are having old CSS specifications as well as extension features.
 Selectors
 Box Model
 Backgrounds and Borders
 Image Values and Replaced Content
 Text Effects
 2D/3D Transformations
 Animations
 Multiple Column Layout
 User Interface
CSS - Syntax
A CSS comprises of style rules that are interpreted by the browser and then
applied to the corresponding elements in your document. A style rule is made
of three parts −
 Selector − A selector is an HTML tag at which a style will be applied. This could be any
tag like <h1> or <table> etc.
 Property - A property is a type of attribute of HTML tag. Put simply, all the HTML
attributes are converted into CSS properties. They could be color, border etc.
 Value - Values are assigned to properties. For example, color property can have value
either red or #F1F1F1 etc.
You can put CSS Style Rule Syntax as follows −
selector { property: value }
P a g e 5 | 43
Example: You can define a table border as follows −
table{ border :1px solid #C00; }
Here table is a selector and border is a property and given value 1px solid
#C00 is the value of that property.
You can define selectors in various simple ways based on your comfort. Let
me put these selectors one by one.
The Type Selectors
This is the same selector we have seen above. Again, one more example to
give a color to all level 1 headings:
h1 {
color: #36CFFF;
}
The Universal Selectors
Rather than selecting elements of a specific type, the universal selector quite
simply matches the name of any element type −
* {
color: #000000;
}
This rule renders the content of every element in our document in black.
The Descendant Selectors
Suppose you want to apply a style rule to a particular element only when it
lies inside a particular element. As given in the following example, style rule
will apply to <em> element only when it lies inside <ul> tag.
ul em {
color: #000000;
}
The Class Selectors
You can define style rules based on the class attribute of the elements. All the
elements having that class will be formatted according to the defined rule.
.black {
color: #000000;
P a g e 6 | 43
}
This rule renders the content in black for every element with class attribute
set to black in our document. You can make it a bit more particular. For
example:
h1.black {
color: #000000;
}
This rule renders the content in black for only <h1> elements with class
attribute set to black.
You can apply more than one class selectors to given element. Consider the
following example:
<p class="center bold">
This para will be styled by the classes center and bold.
</p>
The ID Selectors
You can define style rules based on the id attribute of the elements. All the
elements having that id will be formatted according to the defined rule.
#black {
color: #000000;
}
This rule renders the content in black for every element with id attribute set
to black in our document. You can make it a bit more particular. For example
−
h1#black {
color: #000000;
}
This rule renders the content in black for only <h1> elements with id attribute
set to black.
The true power of id selectors is when they are used as the foundation for
descendant selectors, For example:
#black h2 {
color: #000000;
}
In this example all level 2 headings will be displayed in black color when those
headings will lie with in tags having id attribute set to black.
The Child Selectors
You have seen the descendant selectors. There is one more type of selector,
which is very similar to descendants but have different functionality. Consider
the following example −
body > p {
color: #000000;
}
P a g e 7 | 43
This rule will render all the paragraphs in black if they are direct child of
<body> element. Other paragraphs put inside other elements like <div> or
<td> would not have any effect of this rule.
The Attribute Selectors
You can also apply styles to HTML elements with particular attributes. The
style rule below will match all the input elements having a type attribute with
a value of text −
input[type = "text"]{
color: #000000;
}
The advantage to this method is that the <input type = "submit" /> element
is unaffected, and the color applied only to the desired text fields.
There are following rules applied to attribute selector.
 p[lang] - Selects all paragraph elements with a lang attribute.
 p[lang="fr"] - Selects all paragraph elements whose lang attribute has a value of
exactly "fr".
 p[lang~="fr"] - Selects all paragraph elements whose lang attribute contains the word
"fr".
 p[lang|="en"] - Selects all paragraph elements whose lang attribute contains values
that are exactly "en", or begin with "en-".
Multiple Style Rules
You may need to define multiple style rules for a single element. You can
define these rules to combine multiple properties and corresponding values
into a single block as defined in the following example −
h1 {
color: #36C;
font-weight: normal;
letter-spacing: .4em;
margin-bottom: 1em;
text-transform: lowercase;
}
Here all the property and value pairs are separated by a semi colon (;). You
can keep them in a single line or multiple lines. For better readability we keep
them into separate lines.
For a while, don't bother about the properties mentioned in the above block.
These properties will be explained in the coming chapters and you can find
complete detail about properties in CSS References.
Grouping Selectors
You can apply a style to many selectors if you like. Just separate the selectors
with a comma, as given in the following example −
h1, h2, h3 {
color: #36C;
font-weight: normal;
letter-spacing: .4em;
P a g e 8 | 43
margin-bottom: 1em;
text-transform: lowercase;
}
This define style rule will be applicable to h1, h2 and h3 element as well. The
order of the list is irrelevant. All the elements in the selector will have the
corresponding declarations applied to them.
You can combine the various id selectors together as shown below −
#content, #footer, #supplement {
position: absolute;
left: 510px;
width: 200px;
}
The CSS Box Model
All HTML elements can be considered as boxes. In CSS, the term "box model" is
used when talking about design and layout.
The CSS box model is essentially a box that wraps around every HTML element.
It consists of: margins, borders, padding, and the actual content. The image
below illustrates the box model:
CSS - Measurement Units
Before we start actual exercise, we would like to give a brief idea about the
CSS Measurement Units.
CSS supports a number of measurements including absolute units such as
inches, centimeters, points, and so on, as well as relative measures such as
percentages and em units. You need these values while specifying various
measurements in your Style rules e.g border = "1px solid red".
P a g e 9 | 43
We have listed out all the CSS Measurement Units along with proper Examples
−
Unit Description Example
% Defines a measurement as a percentage relative to
another value, typically an enclosing element.
p {font-size:
16pt; line-
height: 125%;}
cm Defines a measurement in centimeters. div {margin-
bottom: 2cm;}
em A relative measurement for the height of a font in em
spaces. Because an em unit is equivalent to the size of a
given font, if you assign a font to 12pt, each "em" unit
would be 12pt; thus, 2em would be 24pt.
p {letter-
spacing: 7em;}
ex This value defines a measurement relative to a font's x-
height. The x-height is determined by the height of the
font's lowercase letter x.
p {font-size:
24pt; line-
height: 3ex;}
in Defines a measurement in inches. p {word-
spacing: .15in;}
mm Defines a measurement in millimeters. p {word-
spacing:
15mm;}
pc Defines a measurement in picas. A pica is equivalent to
12 points; thus, there are 6 picas per inch.
p {font-size:
20pc;}
pt Defines a measurement in points. A point is defined as
1/72nd of an inch.
body {font-size:
18pt;}
px Defines a measurement in screen pixels. p {padding:
25px;}
vh 1% of viewport height. h2 { font-size:
3.0vh; }
vw 1% of viewport width h1 { font-size:
5.9vw; }
vmin 1vw or 1vh, whichever is smaller p { font-size:
2vmin;}
P a g e 10 | 43
CSS - Colors
CSS uses color values to specify a color. Typically, these are used to set a
color either for the foreground of an element (i.e., its text) or else for the
background of the element. They can also be used to affect the color of
borders and other decorative effects.
You can specify your color values in various formats. Following table lists all
the possible formats −
Format Syntax Example
Hex Code #RRGGBB p{color:#FF0000;}
Short Hex Code #RGB p{color:#6A7;}
RGB % rgb(rrr%,ggg%,bbb%) p{color:rgb(50%,50%,50%);}
RGB Absolute rgb(rrr,ggg,bbb) p{color:rgb(0,0,255);}
keyword aqua, black, etc. p{color:teal;}
CSS - Borders
The border properties allow you to specify how the border of the box
representing an element should look. There are three properties of a border
you can change:
 The border-color specifies the color of a border.
 The border-style specifies whether a border should be solid, dashed line, double line, or
one of the other possible values.
 The border-width specifies the width of a border.
Now, we will see how to use these properties with examples.
The border-color Property
The border-color property allows you to change the color of the border
surrounding an element. You can individually change the color of the bottom,
left, top and right sides of an element's border using the properties −
 border-bottom-color changes the color of bottom border.
 border-top-color changes the color of top border.
 border-left-color changes the color of left border.
 border-right-color changes the color of right border.
The following example shows the effect of all these properties −
<html>
<head>
<style type="text/css">
p.example1{
border:1px solid;
P a g e 11 | 43
border-bottom-color:#009900; /* Green */
border-top-color:#FF0000; /* Red */
border-left-color:#330000; /* Black */
border-right-color:#0000CC; /* Blue */
}
p.example2{
border:1px solid;
border-color:#009900; /* Green */
}
</style>
</head>
<body>
<p class="example1">
This example is showing all borders in different colors.
</p>
<p class="example2">
This example is showing all borders in green color only.
</p>
</body>
</html>
It will produce the following result −
The border-style Property
The border-style property allows you to select one of the following styles of
border −
 none: No border. (Equivalent of border-width:0;)
 solid: Border is a single solid line.
 dotted: Border is a series of dots.
 dashed: Border is a series of short lines.
 double: Border is two solid lines.
 groove: Border looks as though it is carved into the page.
 ridge: Border looks the opposite of groove.
 inset: Border makes the box look like it is embedded in the page.
 outset: Border makes the box look like it is coming out of the canvas.
 hidden: Same as none, except in terms of border-conflict resolution for table elements.
You can individually change the style of the bottom, left, top, and right borders
of an element using the following properties −
 border-bottom-style changes the style of bottom border.
 border-top-style changes the style of top border.
 border-left-style changes the style of left border.
 border-right-style changes the style of right border.
The following example shows all these border styles −
<html>
<head>
</head>
<body>.
P a g e 12 | 43
<p style="border-width:4px; border-style:none;">
This is a border with none width.
</p>
<p style="border-width:4px; border-style:solid;">
This is a solid border.
</p>
<p style="border-width:4px; border-style:dashed;">
This is a dahsed border.
</p>
<p style="border-width:4px; border-style:double;">
This is a double border.
</p>
<p style="border-width:4px; border-style:groove;">
This is a groove border.
</p>
<p style="border-width:4px; border-style:ridge">
This is aridge border.
</p>
<p style="border-width:4px; border-style:inset;">
This is a inset border.
</p>
<p style="border-width:4px; border-style:outset;">
This is a outset border.
</p>
<p style="border-width:4px; border-style:hidden;">
This is a hidden border.
</p>
<p style="border-width:4px;border-top-style:solid;
border-bottom-style:dashed; border-left-style:groove; border-right-
style:double;">
This is a a border with four different styles.
</p>
</body>
</html>
It will produce the following result −
The border-width Property −
The border-width property allows you to set the width of an element borders.
The value of this property could be either a length in px, pt or cm or it should
be set to thin, medium or thick.
You can individually change the width of the bottom, top, left, and right
borders of an element using the following properties −
P a g e 13 | 43
 border-bottom-width changes the width of bottom border.
 border-top-width changes the width of top border.
 border-left-width changes the width of left border.
 border-right-width changes the width of right border.
The following example shows all these border width −
<html>
<head>
</head>
<body>
<p style="border-width:4px; border-style:solid;">
This is a solid border whose width is 4px.
</p>
<p style="border-width:4pt; border-style:solid;">
This is a solid border whose width is 4pt.
</p>
<p style="border-width:thin; border-style:solid;">
This is a solid border whose width is thin.
</p>
<p style="border-width:medium; border-style:solid;">
This is a solid border whose width is medium;
</p>
<p style="border-width:thick; border-style:solid;">
This is a solid border whose width is thick.
</p>
<p style="border-bottom-width:4px;border-top-width:10px;
border-left-width: 2px;border-right-width:15px;border-style:solid;">
This is a a border with four different width.
</p>
</body>
</html>
Border Properties Using Shorthand
The border property allows you to specify color, style, and width of lines in
one property −
The following example shows how to use all the three properties into a single
property. This is the most frequently used property to set border around any
element.
<html>
<head>
</head>
<body>
<p style="border:4px solid red;">
This example is showing shorthand property for border.
</p>
</body>
P a g e 14 | 43
</html>
CSS - Margins
The margin property defines the space around an HTML element. It is possible
to use negative values to overlap content.
The values of the margin property are not inherited by the child elements.
Remember that the adjacent vertical margins (top and bottom margins) will
collapse into each other so that the distance between the blocks is not the
sum of the margins, but only the greater of the two margins or the same size
as one margin if both are equal.
We have the following properties to set an element margin.
 The margin specifies a shorthand property for setting the margin properties in one
declaration.
 The margin-bottom specifies the bottom margin of an element.
 The margin-top specifies the top margin of an element.
 The margin-left specifies the left margin of an element.
 The margin-right specifies the right margin of an element.
Now, we will see how to use these properties with examples.
The Margin Property
The margin property allows you set all of the properties for the four margins
in one declaration. Here is the syntax to set margin around a paragraph −
Here is an example −
<html>
<head>
</head>
<body>
<p style="margin: 15px; border:1px solid black;">
all four margins will be 15px
</p>
<p style="margin:10px 2%; border:1px solid black;">
top and bottom margin will be 10px, left and right margin will be 2% of the
total width of the document.
</p>
<p style="margin: 10px 2% -10px; border:1px solid black;">
top margin will be 10px, left and right margin will be 2% of the total width of
the document, bottom margin will be -10px
</p>
<p style="margin: 10px 2% -10px auto; border:1px solid black;">
top margin will be 10px, right margin will be 2% of the total width of the
document, bottom margin will be -10px, left margin will be set by the browser
</p>
</body>
P a g e 15 | 43
</html>
CSS - Paddings
The padding property allows you to specify how much space should appear
between the content of an element and its border −
The value of this attribute should be either a length, a percentage, or the
word inherit. If the value is inherit, it will have the same padding as its parent
element. If a percentage is used, the percentage is of the containing box.
The following CSS properties can be used to control lists. You can also set
different values for the padding on each side of the box using the following
properties −
 The padding-bottom specifies the bottom padding of an element.
 The padding-top specifies the top padding of an element.
 The padding-left specifies the left padding of an element.
 The padding-right specifies the right padding of an element.
 The padding serves as shorthand for the preceding properties.
Now, we will see how to use these properties with examples.
The padding-bottom Property
The padding-bottom property sets the bottom padding (space) of an element.
This can take a value in terms of length of %.
Here is an example −
<html>
<head>
</head>
<body>
<p style="padding-bottom: 15px; border:1px solid black;">
This is a paragraph with a specified bottom padding
</p>
<p style="padding-bottom: 5%; border:1px solid black;">
This is another paragraph with a specified bottom padding in percent
</p>
</body>
</html>
CSS - Lists
Lists are very helpful in conveying a set of either numbered or bullet points.
This chapter teaches you how to control list type, position, style, etc., using
CSS.
We have the following five CSS properties, which can be used to control lists:
P a g e 16 | 43
 The list-style-type allows you to control the shape or appearance of the marker.
 The list-style-position specifies whether a long point that wraps to a second line should
align with the first line or start underneath the start of the marker.
 The list-style-image specifies an image for the marker rather than a bullet point or
number.
 The list-style serves as shorthand for the preceding properties.
 The marker-offset specifies the distance between a marker and the text in the list.
Now, we will see how to use these properties with examples.
The list-style-type Property
The list-style-type property allows you to control the shape or style of bullet
point (also known as a marker) in the case of unordered lists and the style of
numbering characters in ordered lists.
Here are the values which can be used for an unordered list −
Value Description
none NA
disc (default) A filled-in circle
circle An empty circle
square A filled-in square
Here are the values, which can be used for an ordered list −
Value Description Example
decimal Number 1,2,3,4,5
decimal-leading-
zero
0 before the number 01, 02, 03,
04, 05
lower-alpha Lowercase alphanumeric characters a, b, c, d, e
upper-alpha Uppercase alphanumeric characters A, B, C, D, E
lower-roman Lowercase Roman numerals i, ii, iii, iv, v
upper-roman Uppercase Roman numerals I, II, III, IV,
V
lower-greek The marker is lower-greek alpha, beta,
gamma
P a g e 17 | 43
lower-latin The marker is lower-latin a, b, c, d, e
upper-latin The marker is upper-latin A, B, C, D, E
hebrew The marker is traditional Hebrew numbering
armenian The marker is traditional Armenian numbering
georgian The marker is traditional Georgian numbering
cjk-ideographic The marker is plain ideographic numbers
hiragana The marker is hiragana a, i, u, e, o,
ka, ki
katakana The marker is katakana A, I, U, E,
O, KA, KI
hiragana-iroha The marker is hiragana-iroha i, ro, ha, ni,
ho, he, to
katakana-iroha The marker is katakana-iroha I, RO, HA,
NI, HO, HE,
TO
Here is an example −
<html>
<head>
</head>
<body>
<ul style="list-style-type:circle;">
<li>Maths</li>
<li>Social Science</li>
<li>Physics</li>
</ul>
<ul style="list-style-type:square;">
<li>Maths</li>
<li>Social Science</li>
<li>Physics</li>
</ul>
<ol style="list-style-type:decimal;">
<li>Maths</li>
<li>Social Science</li>
<li>Physics</li>
</ol>
<ol style="list-style-type:lower-alpha;">
P a g e 18 | 43
<li>Maths</li>
<li>Social Science</li>
<li>Physics</li>
</ol>
<ol style="list-style-type:lower-roman;">
<li>Maths</li>
<li>Social Science</li>
<li>Physics</li>
</ol>
</body>
</html>
CSS - Positioning
CSS helps you to position your HTML element. You can put any HTML element
at whatever location you like. You can specify whether you want the element
positioned relative to its natural position in the page or absolute based on its
parent element.
Now, we will see all the CSS positioning related properties with examples −
Relative Positioning
Relative positioning changes the position of the HTML element relative to
where it normally appears. So "left:20" adds 20 pixels to the element's LEFT
position.
You can use two values top and left along with the position property to move
an HTML element anywhere in the HTML document.
 Move Left - Use a negative value for left.
 Move Right - Use a positive value for left.
 Move Up - Use a negative value for top.
 Move Down - Use a positive value for top.
NOTE − You can use bottom or right values as well in the same way
as topand left.
Here is the example −
<html>
<head>
</head>
<body>
<div style="position:relative;left:80px;top:2px;background-color:yellow;">
This div has relative positioning.
</div>
</body>
</html>
P a g e 19 | 43
Absolute Positioning
An element with position: absolute is positioned at the specified coordinates
relative to your screen top-left corner.
You can use two values top and left along with the position property to move
an HTML element anywhere in the HTML document.
 Move Left - Use a negative value for left.
 Move Right - Use a positive value for left.
 Move Up - Use a negative value for top.
 Move Down - Use a positive value for top.
NOTE − You can use bottom or right values as well in the same way as top
and left.
Here is an example −
<html>
<head>
</head>
<body>
<div style="position:absolute; left:80px; top:20px; background-color:yellow;">
This div has absolute positioning.
</div>
</body>
</html>
Fixed Positioning
Fixed positioning allows you to fix the position of an element to a particular
spot on the page, regardless of scrolling. Specified coordinates will be relative
to the browser window.
You can use two values top and left along with the position property to move
an HTML element anywhere in the HTML document.
 Move Left - Use a negative value for left.
 Move Right - Use a positive value for left.
 Move Up - Use a negative value for top.
 Move Down - Use a positive value for top.
NOTE − You can use bottom or right values as well in the same way
as topand left.
Here is an example −
<html>
<head>
</head>
<body>
<div style="position:fixed; left:80px; top:20px; background-color:yellow;">
P a g e 20 | 43
This div has fixed positioning.
</div>
</body>
</html>
CSS Reference
Color Properties
Property Description CSS
color Sets the color of text 1
opacity Sets the opacity level for an element 3
Background and Border Properties
Property Description CSS
background A shorthand property for setting all the background
properties in one declaration
1
background-
attachment
Sets whether a background image is fixed or scrolls
with the rest of the page
1
background-
blend-mode
Specifies the blending mode of each background
layer (color/image)
3
background-color Specifies the background color of an element 1
background-
image
Specifies one or more background images for an
element
1
P a g e 21 | 43
background-
position
Specifies the position of a background image 1
background-
repeat
Sets how a background image will be repeated 1
background-clip Specifies the painting area of the background 3
background-
origin
Specifies where the background image(s) is/are
positioned
3
background-size Specifies the size of the background image(s) 3
border Sets all the border properties in one declaration 1
border-bottom Sets all the bottom border properties in one
declaration
1
border-bottom-
color
Sets the color of the bottom border 1
border-bottom-
left-radius
Defines the shape of the border of the bottom-left
corner
3
border-bottom-
right-radius
Defines the shape of the border of the bottom-right
corner
3
border-bottom-
style
Sets the style of the bottom border 1
border-bottom-
width
Sets the width of the bottom border 1
border-color Sets the color of the four borders 1
border-image A shorthand property for setting all the border-
image-* properties
3
border-image-
outset
Specifies the amount by which the border image
area extends beyond the border box
3
P a g e 22 | 43
border-image-
repeat
Specifies whether the border image should be
repeated, rounded or stretched
3
border-image-
slice
Specifies how to slice the border image 3
border-image-
source
Specifies the path to the image to be used as a
border
3
border-image-
width
Specifies the widths of the image-border 3
border-left Sets all the left border properties in one declaration 1
border-left-color Sets the color of the left border 1
border-left-style Sets the style of the left border 1
border-left-width Sets the width of the left border 1
border-radius A shorthand property for setting all the four border-
*-radius properties
3
border-right Sets all the right border properties in one
declaration
1
border-right-color Sets the color of the right border 1
border-right-style Sets the style of the right border 1
P a g e 23 | 43
border-right-
width
Sets the width of the right border 1
border-style Sets the style of the four borders 1
border-top Sets all the top border properties in one declaration 1
border-top-color Sets the color of the top border 1
border-top-left-
radius
Defines the shape of the border of the top-left
corner
3
border-top-right-
radius
Defines the shape of the border of the top-right
corner
3
border-top-style Sets the style of the top border 1
border-top-width Sets the width of the top border 1
border-width Sets the width of the four borders 1
box-decoration-
break
Sets the behaviour of the background and border of
an element at page-break, or, for in-line elements,
at line-break.
3
box-shadow Attaches one or more drop-shadows to the box 3
P a g e 24 | 43
Basic Box Properties
Property Description CSS
bottom Specifies the bottom position of a positioned element 2
clear Specifies which sides of an element where other floating
elements are not allowed
1
clip Clips an absolutely positioned element 2
display Specifies how a certain HTML element should be displayed 1
float Specifies whether or not a box should float 1
height Sets the height of an element 1
left Specifies the left position of a positioned element 2
margin Sets all the margin properties in one declaration 1
margin-
bottom
Sets the bottom margin of an element 1
P a g e 25 | 43
margin-left Sets the left margin of an element 1
margin-right Sets the right margin of an element 1
margin-top Sets the top margin of an element 1
max-height Sets the maximum height of an element 2
max-width Sets the maximum width of an element 2
min-height Sets the minimum height of an element 2
min-width Sets the minimum width of an element 2
overflow Specifies what happens if content overflows an element's
box
2
overflow-x Specifies whether or not to clip the left/right edges of the
content, if it overflows the element's content area
3
overflow-y Specifies whether or not to clip the top/bottom edges of the
content, if it overflows the element's content area
3
P a g e 26 | 43
padding Sets all the padding properties in one declaration 1
padding-
bottom
Sets the bottom padding of an element 1
padding-left Sets the left padding of an element 1
padding-
right
Sets the right padding of an element 1
padding-top Sets the top padding of an element 1
position Specifies the type of positioning method used for an
element (static, relative, absolute or fixed)
2
right Specifies the right position of a positioned element 2
top Specifies the top position of a positioned element 2
visibility Specifies whether or not an element is visible 2
width Sets the width of an element 1
vertical-
align
Sets the vertical alignment of an element 1
P a g e 27 | 43
z-index Sets the stack order of a positioned element 2
Flexible Box Layout
Property Description CSS
align-
content
Specifies the alignment between the lines inside a flexible
container when the items do not use all available space
3
align-items Specifies the alignment for items inside a flexible
container
3
align-self Specifies the alignment for selected items inside a flexible
container
3
flex Specifies the length of the item, relative to the rest 3
flex-basis Specifies the initial length of a flexible item 3
flex-
direction
Specifies the direction of the flexible items 3
flex-flow A shorthand property for the flex-direction and the flex-
wrap properties
3
flex-grow Specifies how much the item will grow relative to the rest 3
P a g e 28 | 43
flex-shrink Specifies how the item will shrink relative to the rest 3
flex-wrap Specifies whether the flexible items should wrap or not 3
justify-
content
Specifies the alignment between the items inside a flexible
container when the items do not use all available space
3
order Sets the order of the flexible item, relative to the rest 3
Text Properties
Property Description CSS
hanging-
punctuation
Specifies whether a punctuation character may be
placed outside the line box
3
hyphens Sets how to split words to improve the layout of
paragraphs
3
letter-spacing Increases or decreases the space between characters in
a text
1
line-break Specifies how/if to break lines 3
line-height Sets the line height 1
P a g e 29 | 43
overflow-wrap Specifies whether or not the browser may break lines
within words in order to prevent overflow (when a string
is too long to fit its containing box)
3
tab-size Specifies the length of the tab-character 3
text-align Specifies the horizontal alignment of text 1
text-align-last Describes how the last line of a block or a line right
before a forced line break is aligned when text-align is
"justify"
3
text-combine-
upright
Specifies the combination of multiple characters into the
space of a single character
3
text-indent Specifies the indentation of the first line in a text-block 1
text-justify Specifies the justification method used when text-align is
"justify"
3
text-transform Controls the capitalization of text 1
white-space Specifies how white-space inside an element is handled 1
word-break Specifies line breaking rules for non-CJK scripts 3
P a g e 30 | 43
word-spacing Increases or decreases the space between words in a
text
1
word-wrap Allows long, unbreakable words to be broken and wrap
to the next line
3
Text Decoration Properties
Property Description CSS
text-decoration Specifies the decoration added to text 1
text-decoration-
color
Specifies the color of the text-decoration 3
text-decoration-
line
Specifies the type of line in a text-decoration 3
text-decoration-
style
Specifies the style of the line in a text decoration 3
text-shadow Adds shadow to text 3
text-underline-
position
Specifies the position of the underline which is set
using the text-decoration property
3
P a g e 31 | 43
Font Properties
Property Description CSS
@font-face A rule that allows websites to download and use fonts
other than the "web-safe" fonts
3
@font-feature-
values
Allows authors to use a common name in font-variant-
alternate for feature activated differently in OpenType
3
font Sets all the font properties in one declaration 1
font-family Specifies the font family for text 1
font-feature-
settings
Allows control over advanced typographic features in
OpenType fonts
3
font-kerning Controls the usage of the kerning information (how
letters are spaced)
3
font-language-
override
Controls the usage of language-specific glyphs in a
typeface
3
font-size Specifies the font size of text 1
font-size-
adjust
Preserves the readability of text when font fallback
occurs
3
P a g e 32 | 43
font-stretch Selects a normal, condensed, or expanded face from a
font family
3
font-style Specifies the font style for text 1
font-synthesis Controls which missing typefaces (bold or italic) may
be synthesized by the browser
3
font-variant Specifies whether or not a text should be displayed in a
small-caps font
1
font-variant-
alternates
Controls the usage of alternate glyphs associated to
alternative names defined in @font-feature-values
3
font-variant-
caps
Controls the usage of alternate glyphs for capital letters 3
font-variant-
east-asian
Controls the usage of alternate glyphs for East Asian
scripts (e.g Japanese and Chinese)
3
font-variant-
ligatures
Controls which ligatures and contextual forms are used
in textual content of the elements it applies to
3
font-variant-
numeric
Controls the usage of alternate glyphs for numbers,
fractions, and ordinal markers
3
font-variant-
position
Controls the usage of alternate glyphs of smaller size
positioned as superscript or subscript regarding the
baseline of the font
3
P a g e 33 | 43
font-weight Specifies the weight of a font 1
Writing Modes Properties
Property Description CSS
direction Specifies the text direction/writing direction 2
text-
orientation
Defines the orientation of the text in a line 3
text-
combine-
upright
Specifies the combination of multiple characters into the
space of a single character
3
unicode-bidi Used together with the direction property to set or return
whether the text should be overridden to support
multiple languages in the same document
2
user-select Specifies whether the text of an element can be selected 3
writing-mode 3
Table Properties
Property Description
border-collapse Specifies whether or not table borders should be collapsed
border-spacing Specifies the distance between the borders of adjacent cells
P a g e 34 | 43
caption-side Specifies the placement of a table caption
empty-cells Specifies whether or not to display borders and background on e
a table
table-layout Sets the layout algorithm to be used for a table
Lists and Counters Properties
Property Description CSS
counter-
increment
Increments one or more counters 2
counter-reset Creates or resets one or more counters 2
list-style Sets all the properties for a list in one declaration 1
list-style-
image
Specifies an image as the list-item marker 1
list-style-
position
Specifies if the list-item markers should appear inside
or outside the content flow
1
list-style-type Specifies the type of list-item marker 1
Animation Properties
Property Description CSS
P a g e 35 | 43
@keyframes Specifies the animation code 3
animation A shorthand property for all the animation properties
(except animation-play-state and animation-fill-
mode)
3
animation-delay Specifies a delay for the start of an animation 3
animation-
direction
Specifies whether or not the animation should play in
reverse on alternate cycles
3
animation-
duration
Specifies how many seconds or milliseconds an
animation takes to complete one cycle
3
animation-fill-
mode
Specifies a style for the element when the animation
is not playing (when it is finished, or when it has a
delay)
3
animation-
iteration-count
Specifies the number of times an animation should be
played
3
animation-name Specifies the name of the @keyframes animation 3
animation-play-
state
Specifies whether the animation is running or paused 3
P a g e 36 | 43
animation-timing-
function
Specifies the speed curve of an animation 3
Transform Properties
Property Description CSS
backface-
visibility
Defines whether or not an element should be visible
when not facing the screen
3
perspective Specifies the perspective on how 3D elements are
viewed
3
perspective-
origin
Specifies the bottom position of 3D elements 3
transform Applies a 2D or 3D transformation to an element 3
transform-
origin
Allows you to change the position on transformed
elements
3
transform-style Specifies how nested elements are rendered in 3D
space
3
Transitions Properties
Property Description
transition A shorthand property for setting the four transition properties
transition-property Specifies the name of the CSS property the transition effect is f
P a g e 37 | 43
transition-duration Specifies how many seconds or milliseconds a transition effect t
complete
transition-timing-
function
Specifies the speed curve of the transition effect
transition-delay Specifies when the transition effect will start
Basic User Interface Properties
Property Description
box-sizing Tells the browser what the sizing properties (width and height)
include
content Used with the :before and :after pseudo-elements, to insert gen
content
cursor Specifies the type of cursor to be displayed
ime-mode Controls the state of the input method editor for text fields
nav-down Specifies where to navigate when using the arrow-down navigat
nav-index Specifies the tabbing order for an element
nav-left Specifies where to navigate when using the arrow-left navigatio
nav-right Specifies where to navigate when using the arrow-right navigat
nav-up Specifies where to navigate when using the arrow-up navigation
outline Sets all the outline properties in one declaration
outline-color Sets the color of an outline
outline-offset Offsets an outline, and draws it beyond the border edge
outline-style Sets the style of an outline
outline-width Sets the width of an outline
resize Specifies whether or not an element is resizable by the user
text-overflow Specifies what should happen when text overflows the containin
P a g e 38 | 43
Multi-column Layout Properties
Property Description CSS
break-after Specifies the page-, column-, or region-break behavior
after the generated box
3
break-before Specifies the page-, column-, or region-break behavior
before the generated box
3
break-inside Specifies the page-, column-, or region-break behavior
inside the generated box
3
column-
count
Specifies the number of columns an element should be
divided into
3
column-fill Specifies how to fill columns 3
column-gap Specifies the gap between the columns 3
column-rule A shorthand property for setting all the column-rule-*
properties
3
column-rule-
color
Specifies the color of the rule between columns 3
column-rule-
style
Specifies the style of the rule between columns 3
P a g e 39 | 43
column-rule-
width
Specifies the width of the rule between columns 3
column-span Specifies how many columns an element should span
across
3
column-
width
Specifies the width of the columns 3
columns A shorthand property for setting column-width and
column-count
3
widows Sets the minimum number of lines that must be left at the
top of a page when a page break occurs inside an element
2
Paged Media
Property Description CSS
orphans Sets the minimum number of lines that must be left at
the bottom of a page when a page break occurs inside an
element
2
page-break-
after
Sets the page-breaking behavior after an element 2
page-break-
before
Sets the page-breaking behavior before an element 2
P a g e 40 | 43
page-break-
inside
Sets the page-breaking behavior inside an element 2
Generated Content for Paged Media
Property Description
marks Adds crop and/or cross marks to the document
quotes Sets the type of quotation marks for embedded quotations
Filter Effects Properties
Property Description
filter Defines effects (e.g. blurring or color shifting) on an element befo
element is displayed
Image Values and Replaced Content
Property Description
image-orientation Specifies a rotation in the right or clockwise direction that a user agent
image (This property is likely going to be deprecated and its functionalit
HTML)
image-rendering Gives a hint to the browser about what aspects of an image are most im
preserve when the image is scaled
image-resolution Specifies the intrinsic resolution of all raster images used in/on the elem
object-fit Specifies how the contents of a replaced element should be fitted to the
established by its used height and width
object-position Specifies the alignment of the replaced element inside its box
Masking Properties
Property Description CSS
P a g e 41 | 43
mask 3
mask-type 3
Speech Properties
Property Description CSS
mark A shorthand property for setting the mark-before and
mark-after properties
3
mark-after Allows named markers to be attached to the audio
stream
3
mark-before Allows named markers to be attached to the audio
stream
3
phonemes Specifies a phonetic pronunciation for the text contained
by the corresponding element
3
rest A shorthand property for setting the rest-before and
rest-after properties
3
rest-after Specifies a rest or prosodic boundary to be observed
after speaking an element's content
3
rest-before Specifies a rest or prosodic boundary to be observed
before speaking an element's content
3
P a g e 42 | 43
voice-balance Specifies the balance between left and right channels 3
voice-duration Specifies how long it should take to render the selected
element's content
3
voice-pitch Specifies the average pitch (a frequency) of the speaking
voice
3
voice-pitch-
range
Specifies variation in average pitch 3
voice-rate Controls the speaking rate 3
voice-stress Indicates the strength of emphasis to be applied 3
voice-volume Refers to the amplitude of the waveform output by the
speech synthesises
3
Marquee Properties
Property Description CSS
marquee-direction Sets the direction of the moving content 3
marquee-play-
count
Sets how many times the content move 3
P a g e 43 | 43
marquee-speed Sets how fast the content scrolls 3
marquee-style Sets the style of the moving content 3

More Related Content

Similar to Css handouts (recovered)

Get Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdfGet Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdfRonDosh
 
Graphic Design For Web
Graphic Design For WebGraphic Design For Web
Graphic Design For WebDeniz Gökçe
 
Discover the Top 23 CSS Frameworks for 2023.pdf
Discover the Top 23 CSS Frameworks for 2023.pdfDiscover the Top 23 CSS Frameworks for 2023.pdf
Discover the Top 23 CSS Frameworks for 2023.pdfpcloudy2
 
Vskills certified css designer Notes
Vskills certified css designer NotesVskills certified css designer Notes
Vskills certified css designer NotesVskills
 
Responsive Web Designed for your communication and marketing needs
Responsive Web Designed for your communication and marketing needsResponsive Web Designed for your communication and marketing needs
Responsive Web Designed for your communication and marketing needsSEGIC
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS ImplementationAmey Parab
 
Life above the_service_tier_v1.1
Life above the_service_tier_v1.1Life above the_service_tier_v1.1
Life above the_service_tier_v1.1Ganesh Prasad
 
The CSS Handbook
The CSS HandbookThe CSS Handbook
The CSS Handbookjackchenvlo
 
Tailwind CSS.11.pptx
Tailwind CSS.11.pptxTailwind CSS.11.pptx
Tailwind CSS.11.pptxHarish Verma
 
New Css style
New Css styleNew Css style
New Css styleBUDNET
 
Awsgsg wah-linux
Awsgsg wah-linuxAwsgsg wah-linux
Awsgsg wah-linuxSebin John
 
Awsgsg wah-linux
Awsgsg wah-linuxAwsgsg wah-linux
Awsgsg wah-linuxSebin John
 
Input and output voltage.pdf
Input and output voltage.pdfInput and output voltage.pdf
Input and output voltage.pdfPrinceVerma645693
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksAndolasoft Inc
 
css-presentation-for mid career engineers.ppt
css-presentation-for mid career engineers.pptcss-presentation-for mid career engineers.ppt
css-presentation-for mid career engineers.pptmohamed abd elrazek
 
ExampleSiteEvaluationJustification
ExampleSiteEvaluationJustificationExampleSiteEvaluationJustification
ExampleSiteEvaluationJustificationDesarae Veit
 
using cascading style sheets-presentation.ppt
using cascading style sheets-presentation.pptusing cascading style sheets-presentation.ppt
using cascading style sheets-presentation.pptKADAMBARIPUROHIT
 

Similar to Css handouts (recovered) (20)

Presentation 1 [autosaved]
Presentation 1 [autosaved]Presentation 1 [autosaved]
Presentation 1 [autosaved]
 
Get Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdfGet Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdf
 
Graphic Design For Web
Graphic Design For WebGraphic Design For Web
Graphic Design For Web
 
Discover the Top 23 CSS Frameworks for 2023.pdf
Discover the Top 23 CSS Frameworks for 2023.pdfDiscover the Top 23 CSS Frameworks for 2023.pdf
Discover the Top 23 CSS Frameworks for 2023.pdf
 
Vskills certified css designer Notes
Vskills certified css designer NotesVskills certified css designer Notes
Vskills certified css designer Notes
 
Responsive Web Designed for your communication and marketing needs
Responsive Web Designed for your communication and marketing needsResponsive Web Designed for your communication and marketing needs
Responsive Web Designed for your communication and marketing needs
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
 
Life above the_service_tier_v1.1
Life above the_service_tier_v1.1Life above the_service_tier_v1.1
Life above the_service_tier_v1.1
 
The CSS Handbook
The CSS HandbookThe CSS Handbook
The CSS Handbook
 
Tailwind CSS.11.pptx
Tailwind CSS.11.pptxTailwind CSS.11.pptx
Tailwind CSS.11.pptx
 
Using a CSS Framework
Using a CSS FrameworkUsing a CSS Framework
Using a CSS Framework
 
New Css style
New Css styleNew Css style
New Css style
 
Awsgsg wah-linux
Awsgsg wah-linuxAwsgsg wah-linux
Awsgsg wah-linux
 
Awsgsg wah-linux
Awsgsg wah-linuxAwsgsg wah-linux
Awsgsg wah-linux
 
Input and output voltage.pdf
Input and output voltage.pdfInput and output voltage.pdf
Input and output voltage.pdf
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
 
css-presentation-for mid career engineers.ppt
css-presentation-for mid career engineers.pptcss-presentation-for mid career engineers.ppt
css-presentation-for mid career engineers.ppt
 
ExampleSiteEvaluationJustification
ExampleSiteEvaluationJustificationExampleSiteEvaluationJustification
ExampleSiteEvaluationJustification
 
using cascading style sheets-presentation.ppt
using cascading style sheets-presentation.pptusing cascading style sheets-presentation.ppt
using cascading style sheets-presentation.ppt
 
W3css tutorial
W3css tutorialW3css tutorial
W3css tutorial
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 

Recently uploaded (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 

Css handouts (recovered)

  • 1. P a g e 1 | 43 Contents Introduction to CSS?...........................................................................................................................3 Advantagesof CSS.......................................................................................................................3 Who Creates and Maintains CSS?................................................................................................3 CSS Versions................................................................................................................................4 CSS3 Modules ........................................................................................................................4 CSS - Syntax........................................................................................................................................4 The Type Selectors.......................................................................................................................5 The Universal Selectors................................................................................................................5 The Descendant Selectors............................................................................................................5 The Class Selectors.......................................................................................................................5 The ID Selectors...........................................................................................................................6 The Child Selectors.......................................................................................................................6 The Attribute Selectors.................................................................................................................7 Multiple Style Rules.......................................................................................................................7 Grouping Selectors.......................................................................................................................7 The CSS Box Model.............................................................................................................................8 CSS - Measurement Units....................................................................................................................8 CSS - Colors......................................................................................................................................10 CSS - Borders....................................................................................................................................10 The border-color Property..........................................................................................................10 The border-style Property...........................................................................................................11 The border-width Property −.....................................................................................................12 Border Properties Using Shorthand............................................................................................13 CSS - Margins...................................................................................................................................14 The Margin Property...................................................................................................................14 CSS - Paddings..................................................................................................................................15 The padding-bottom Property....................................................................................................15 CSS - Lists.........................................................................................................................................15 The list-style-type Property........................................................................................................16 CSS - Positioning...............................................................................................................................18
  • 2. P a g e 2 | 43 Relative Positioning.....................................................................................................................18 Absolute Positioning....................................................................................................................19 Fixed Positioning.........................................................................................................................19 CSS Reference ..................................................................................................................................20 Color Properties..........................................................................................................................20 Background and Border Properties............................................................................................20 Basic Box Properties...................................................................................................................24 Flexible Box Layout.....................................................................................................................27 Text Properties............................................................................................................................28 Text Decoration Properties.........................................................................................................30 Font Properties...........................................................................................................................31 Writing Modes Properties..........................................................................................................33 Table Properties..........................................................................................................................33 Lists and Counters Properties.....................................................................................................34 Animation Properties..................................................................................................................34 Transform Properties..................................................................................................................36 Transitions Properties.................................................................................................................36 Basic User Interface Properties...................................................................................................37 Multi-column Layout Properties.................................................................................................38 Paged Media...............................................................................................................................39 Generated Content for Paged Media.........................................................................................40 Filter Effects Properties...............................................................................................................40 Image Values and Replaced Content .........................................................................................40 Masking Properties.....................................................................................................................40 Speech Properties.......................................................................................................................41 Marquee Properties....................................................................................................................42
  • 3. P a g e 3 | 43 Introduction to CSS? Cascading Style Sheets, fondly referred to 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, layout designs,variations in display for different devices and screen sizes as well as a variety of other effects. CSS is easy to learn and understand but it provides powerful control over the presentation of an HTML document. Most commonly, CSS is combined with the markup languages HTML or XHTML. Advantages of CSS  CSS saves time − You can write CSS once and then reuse same sheet in multiple HTML pages. You can define a style for each HTML element and apply it to as many Web pages as you want.  Pages load faster − If you are using CSS, you do not need to write HTML tag attributes every time. Just write one CSS rule of a tag and apply it to all the occurrences of that tag. So less code means faster download times.  Easy maintenance − To make a global change, simply change the style, and all elements in all the web pages will be updated automatically.  Superior styles to HTML − CSS has a much wider array of attributes than HTML, so you can give a far better look to your HTML page in comparison to HTML attributes.  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 cell phones or for printing.  Global web standards − Now HTML attributes are being deprecated and it is being recommended to use CSS. So its a good idea to start using CSS in all the HTML pages to make them compatible to future browsers.  Offline Browsing − CSS can store web applications locally with the help of an offline catche. Using of this, we can view offline websites.The cache also ensures faster loading and better overall performance of the website.  Platform Independence − The Script offer consistent platform independence and can support latest browsers as well. Who Creates and Maintains CSS? CSS was invented by Håkon Wium Lie on October 10, 1994 and maintained through a group of people within the W3C called the CSS Working Group. The CSS Working Group creates documents called specifications. When a specification has been discussed and officially ratified by W3C members, it becomes a recommendation.
  • 4. P a g e 4 | 43 These ratified specifications are called recommendations because the W3C has no control over the actual implementation of the language. Independent companies and organizations create that software. NOTE − The World Wide Web Consortium, or W3C is a group that makes recommendations about how the Internet works and how it should evolve. CSS Versions Cascading Style Sheets, level 1 (CSS1) was 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 was 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. CSS3 was became a W3C recommendation in June 1999 and builds on older versions CSS. It has divided into documentations is called as Modules and here each module having new extension features defined in CSS2. CSS3 Modules CSS3 Modules are having old CSS specifications as well as extension features.  Selectors  Box Model  Backgrounds and Borders  Image Values and Replaced Content  Text Effects  2D/3D Transformations  Animations  Multiple Column Layout  User Interface CSS - Syntax A CSS comprises of style rules that are interpreted by the browser and then applied to the corresponding elements in your document. A style rule is made of three parts −  Selector − A selector is an HTML tag at which a style will be applied. This could be any tag like <h1> or <table> etc.  Property - A property is a type of attribute of HTML tag. Put simply, all the HTML attributes are converted into CSS properties. They could be color, border etc.  Value - Values are assigned to properties. For example, color property can have value either red or #F1F1F1 etc. You can put CSS Style Rule Syntax as follows − selector { property: value }
  • 5. P a g e 5 | 43 Example: You can define a table border as follows − table{ border :1px solid #C00; } Here table is a selector and border is a property and given value 1px solid #C00 is the value of that property. You can define selectors in various simple ways based on your comfort. Let me put these selectors one by one. The Type Selectors This is the same selector we have seen above. Again, one more example to give a color to all level 1 headings: h1 { color: #36CFFF; } The Universal Selectors Rather than selecting elements of a specific type, the universal selector quite simply matches the name of any element type − * { color: #000000; } This rule renders the content of every element in our document in black. The Descendant Selectors Suppose you want to apply a style rule to a particular element only when it lies inside a particular element. As given in the following example, style rule will apply to <em> element only when it lies inside <ul> tag. ul em { color: #000000; } The Class Selectors You can define style rules based on the class attribute of the elements. All the elements having that class will be formatted according to the defined rule. .black { color: #000000;
  • 6. P a g e 6 | 43 } This rule renders the content in black for every element with class attribute set to black in our document. You can make it a bit more particular. For example: h1.black { color: #000000; } This rule renders the content in black for only <h1> elements with class attribute set to black. You can apply more than one class selectors to given element. Consider the following example: <p class="center bold"> This para will be styled by the classes center and bold. </p> The ID Selectors You can define style rules based on the id attribute of the elements. All the elements having that id will be formatted according to the defined rule. #black { color: #000000; } This rule renders the content in black for every element with id attribute set to black in our document. You can make it a bit more particular. For example − h1#black { color: #000000; } This rule renders the content in black for only <h1> elements with id attribute set to black. The true power of id selectors is when they are used as the foundation for descendant selectors, For example: #black h2 { color: #000000; } In this example all level 2 headings will be displayed in black color when those headings will lie with in tags having id attribute set to black. The Child Selectors You have seen the descendant selectors. There is one more type of selector, which is very similar to descendants but have different functionality. Consider the following example − body > p { color: #000000; }
  • 7. P a g e 7 | 43 This rule will render all the paragraphs in black if they are direct child of <body> element. Other paragraphs put inside other elements like <div> or <td> would not have any effect of this rule. The Attribute Selectors You can also apply styles to HTML elements with particular attributes. The style rule below will match all the input elements having a type attribute with a value of text − input[type = "text"]{ color: #000000; } The advantage to this method is that the <input type = "submit" /> element is unaffected, and the color applied only to the desired text fields. There are following rules applied to attribute selector.  p[lang] - Selects all paragraph elements with a lang attribute.  p[lang="fr"] - Selects all paragraph elements whose lang attribute has a value of exactly "fr".  p[lang~="fr"] - Selects all paragraph elements whose lang attribute contains the word "fr".  p[lang|="en"] - Selects all paragraph elements whose lang attribute contains values that are exactly "en", or begin with "en-". Multiple Style Rules You may need to define multiple style rules for a single element. You can define these rules to combine multiple properties and corresponding values into a single block as defined in the following example − h1 { color: #36C; font-weight: normal; letter-spacing: .4em; margin-bottom: 1em; text-transform: lowercase; } Here all the property and value pairs are separated by a semi colon (;). You can keep them in a single line or multiple lines. For better readability we keep them into separate lines. For a while, don't bother about the properties mentioned in the above block. These properties will be explained in the coming chapters and you can find complete detail about properties in CSS References. Grouping Selectors You can apply a style to many selectors if you like. Just separate the selectors with a comma, as given in the following example − h1, h2, h3 { color: #36C; font-weight: normal; letter-spacing: .4em;
  • 8. P a g e 8 | 43 margin-bottom: 1em; text-transform: lowercase; } This define style rule will be applicable to h1, h2 and h3 element as well. The order of the list is irrelevant. All the elements in the selector will have the corresponding declarations applied to them. You can combine the various id selectors together as shown below − #content, #footer, #supplement { position: absolute; left: 510px; width: 200px; } The CSS Box Model All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout. The CSS box model is essentially a box that wraps around every HTML element. It consists of: margins, borders, padding, and the actual content. The image below illustrates the box model: CSS - Measurement Units Before we start actual exercise, we would like to give a brief idea about the CSS Measurement Units. CSS supports a number of measurements including absolute units such as inches, centimeters, points, and so on, as well as relative measures such as percentages and em units. You need these values while specifying various measurements in your Style rules e.g border = "1px solid red".
  • 9. P a g e 9 | 43 We have listed out all the CSS Measurement Units along with proper Examples − Unit Description Example % Defines a measurement as a percentage relative to another value, typically an enclosing element. p {font-size: 16pt; line- height: 125%;} cm Defines a measurement in centimeters. div {margin- bottom: 2cm;} em A relative measurement for the height of a font in em spaces. Because an em unit is equivalent to the size of a given font, if you assign a font to 12pt, each "em" unit would be 12pt; thus, 2em would be 24pt. p {letter- spacing: 7em;} ex This value defines a measurement relative to a font's x- height. The x-height is determined by the height of the font's lowercase letter x. p {font-size: 24pt; line- height: 3ex;} in Defines a measurement in inches. p {word- spacing: .15in;} mm Defines a measurement in millimeters. p {word- spacing: 15mm;} pc Defines a measurement in picas. A pica is equivalent to 12 points; thus, there are 6 picas per inch. p {font-size: 20pc;} pt Defines a measurement in points. A point is defined as 1/72nd of an inch. body {font-size: 18pt;} px Defines a measurement in screen pixels. p {padding: 25px;} vh 1% of viewport height. h2 { font-size: 3.0vh; } vw 1% of viewport width h1 { font-size: 5.9vw; } vmin 1vw or 1vh, whichever is smaller p { font-size: 2vmin;}
  • 10. P a g e 10 | 43 CSS - Colors CSS uses color values to specify a color. Typically, these are used to set a color either for the foreground of an element (i.e., its text) or else for the background of the element. They can also be used to affect the color of borders and other decorative effects. You can specify your color values in various formats. Following table lists all the possible formats − Format Syntax Example Hex Code #RRGGBB p{color:#FF0000;} Short Hex Code #RGB p{color:#6A7;} RGB % rgb(rrr%,ggg%,bbb%) p{color:rgb(50%,50%,50%);} RGB Absolute rgb(rrr,ggg,bbb) p{color:rgb(0,0,255);} keyword aqua, black, etc. p{color:teal;} CSS - Borders The border properties allow you to specify how the border of the box representing an element should look. There are three properties of a border you can change:  The border-color specifies the color of a border.  The border-style specifies whether a border should be solid, dashed line, double line, or one of the other possible values.  The border-width specifies the width of a border. Now, we will see how to use these properties with examples. The border-color Property The border-color property allows you to change the color of the border surrounding an element. You can individually change the color of the bottom, left, top and right sides of an element's border using the properties −  border-bottom-color changes the color of bottom border.  border-top-color changes the color of top border.  border-left-color changes the color of left border.  border-right-color changes the color of right border. The following example shows the effect of all these properties − <html> <head> <style type="text/css"> p.example1{ border:1px solid;
  • 11. P a g e 11 | 43 border-bottom-color:#009900; /* Green */ border-top-color:#FF0000; /* Red */ border-left-color:#330000; /* Black */ border-right-color:#0000CC; /* Blue */ } p.example2{ border:1px solid; border-color:#009900; /* Green */ } </style> </head> <body> <p class="example1"> This example is showing all borders in different colors. </p> <p class="example2"> This example is showing all borders in green color only. </p> </body> </html> It will produce the following result − The border-style Property The border-style property allows you to select one of the following styles of border −  none: No border. (Equivalent of border-width:0;)  solid: Border is a single solid line.  dotted: Border is a series of dots.  dashed: Border is a series of short lines.  double: Border is two solid lines.  groove: Border looks as though it is carved into the page.  ridge: Border looks the opposite of groove.  inset: Border makes the box look like it is embedded in the page.  outset: Border makes the box look like it is coming out of the canvas.  hidden: Same as none, except in terms of border-conflict resolution for table elements. You can individually change the style of the bottom, left, top, and right borders of an element using the following properties −  border-bottom-style changes the style of bottom border.  border-top-style changes the style of top border.  border-left-style changes the style of left border.  border-right-style changes the style of right border. The following example shows all these border styles − <html> <head> </head> <body>.
  • 12. P a g e 12 | 43 <p style="border-width:4px; border-style:none;"> This is a border with none width. </p> <p style="border-width:4px; border-style:solid;"> This is a solid border. </p> <p style="border-width:4px; border-style:dashed;"> This is a dahsed border. </p> <p style="border-width:4px; border-style:double;"> This is a double border. </p> <p style="border-width:4px; border-style:groove;"> This is a groove border. </p> <p style="border-width:4px; border-style:ridge"> This is aridge border. </p> <p style="border-width:4px; border-style:inset;"> This is a inset border. </p> <p style="border-width:4px; border-style:outset;"> This is a outset border. </p> <p style="border-width:4px; border-style:hidden;"> This is a hidden border. </p> <p style="border-width:4px;border-top-style:solid; border-bottom-style:dashed; border-left-style:groove; border-right- style:double;"> This is a a border with four different styles. </p> </body> </html> It will produce the following result − The border-width Property − The border-width property allows you to set the width of an element borders. The value of this property could be either a length in px, pt or cm or it should be set to thin, medium or thick. You can individually change the width of the bottom, top, left, and right borders of an element using the following properties −
  • 13. P a g e 13 | 43  border-bottom-width changes the width of bottom border.  border-top-width changes the width of top border.  border-left-width changes the width of left border.  border-right-width changes the width of right border. The following example shows all these border width − <html> <head> </head> <body> <p style="border-width:4px; border-style:solid;"> This is a solid border whose width is 4px. </p> <p style="border-width:4pt; border-style:solid;"> This is a solid border whose width is 4pt. </p> <p style="border-width:thin; border-style:solid;"> This is a solid border whose width is thin. </p> <p style="border-width:medium; border-style:solid;"> This is a solid border whose width is medium; </p> <p style="border-width:thick; border-style:solid;"> This is a solid border whose width is thick. </p> <p style="border-bottom-width:4px;border-top-width:10px; border-left-width: 2px;border-right-width:15px;border-style:solid;"> This is a a border with four different width. </p> </body> </html> Border Properties Using Shorthand The border property allows you to specify color, style, and width of lines in one property − The following example shows how to use all the three properties into a single property. This is the most frequently used property to set border around any element. <html> <head> </head> <body> <p style="border:4px solid red;"> This example is showing shorthand property for border. </p> </body>
  • 14. P a g e 14 | 43 </html> CSS - Margins The margin property defines the space around an HTML element. It is possible to use negative values to overlap content. The values of the margin property are not inherited by the child elements. Remember that the adjacent vertical margins (top and bottom margins) will collapse into each other so that the distance between the blocks is not the sum of the margins, but only the greater of the two margins or the same size as one margin if both are equal. We have the following properties to set an element margin.  The margin specifies a shorthand property for setting the margin properties in one declaration.  The margin-bottom specifies the bottom margin of an element.  The margin-top specifies the top margin of an element.  The margin-left specifies the left margin of an element.  The margin-right specifies the right margin of an element. Now, we will see how to use these properties with examples. The Margin Property The margin property allows you set all of the properties for the four margins in one declaration. Here is the syntax to set margin around a paragraph − Here is an example − <html> <head> </head> <body> <p style="margin: 15px; border:1px solid black;"> all four margins will be 15px </p> <p style="margin:10px 2%; border:1px solid black;"> top and bottom margin will be 10px, left and right margin will be 2% of the total width of the document. </p> <p style="margin: 10px 2% -10px; border:1px solid black;"> top margin will be 10px, left and right margin will be 2% of the total width of the document, bottom margin will be -10px </p> <p style="margin: 10px 2% -10px auto; border:1px solid black;"> top margin will be 10px, right margin will be 2% of the total width of the document, bottom margin will be -10px, left margin will be set by the browser </p> </body>
  • 15. P a g e 15 | 43 </html> CSS - Paddings The padding property allows you to specify how much space should appear between the content of an element and its border − The value of this attribute should be either a length, a percentage, or the word inherit. If the value is inherit, it will have the same padding as its parent element. If a percentage is used, the percentage is of the containing box. The following CSS properties can be used to control lists. You can also set different values for the padding on each side of the box using the following properties −  The padding-bottom specifies the bottom padding of an element.  The padding-top specifies the top padding of an element.  The padding-left specifies the left padding of an element.  The padding-right specifies the right padding of an element.  The padding serves as shorthand for the preceding properties. Now, we will see how to use these properties with examples. The padding-bottom Property The padding-bottom property sets the bottom padding (space) of an element. This can take a value in terms of length of %. Here is an example − <html> <head> </head> <body> <p style="padding-bottom: 15px; border:1px solid black;"> This is a paragraph with a specified bottom padding </p> <p style="padding-bottom: 5%; border:1px solid black;"> This is another paragraph with a specified bottom padding in percent </p> </body> </html> CSS - Lists Lists are very helpful in conveying a set of either numbered or bullet points. This chapter teaches you how to control list type, position, style, etc., using CSS. We have the following five CSS properties, which can be used to control lists:
  • 16. P a g e 16 | 43  The list-style-type allows you to control the shape or appearance of the marker.  The list-style-position specifies whether a long point that wraps to a second line should align with the first line or start underneath the start of the marker.  The list-style-image specifies an image for the marker rather than a bullet point or number.  The list-style serves as shorthand for the preceding properties.  The marker-offset specifies the distance between a marker and the text in the list. Now, we will see how to use these properties with examples. The list-style-type Property The list-style-type property allows you to control the shape or style of bullet point (also known as a marker) in the case of unordered lists and the style of numbering characters in ordered lists. Here are the values which can be used for an unordered list − Value Description none NA disc (default) A filled-in circle circle An empty circle square A filled-in square Here are the values, which can be used for an ordered list − Value Description Example decimal Number 1,2,3,4,5 decimal-leading- zero 0 before the number 01, 02, 03, 04, 05 lower-alpha Lowercase alphanumeric characters a, b, c, d, e upper-alpha Uppercase alphanumeric characters A, B, C, D, E lower-roman Lowercase Roman numerals i, ii, iii, iv, v upper-roman Uppercase Roman numerals I, II, III, IV, V lower-greek The marker is lower-greek alpha, beta, gamma
  • 17. P a g e 17 | 43 lower-latin The marker is lower-latin a, b, c, d, e upper-latin The marker is upper-latin A, B, C, D, E hebrew The marker is traditional Hebrew numbering armenian The marker is traditional Armenian numbering georgian The marker is traditional Georgian numbering cjk-ideographic The marker is plain ideographic numbers hiragana The marker is hiragana a, i, u, e, o, ka, ki katakana The marker is katakana A, I, U, E, O, KA, KI hiragana-iroha The marker is hiragana-iroha i, ro, ha, ni, ho, he, to katakana-iroha The marker is katakana-iroha I, RO, HA, NI, HO, HE, TO Here is an example − <html> <head> </head> <body> <ul style="list-style-type:circle;"> <li>Maths</li> <li>Social Science</li> <li>Physics</li> </ul> <ul style="list-style-type:square;"> <li>Maths</li> <li>Social Science</li> <li>Physics</li> </ul> <ol style="list-style-type:decimal;"> <li>Maths</li> <li>Social Science</li> <li>Physics</li> </ol> <ol style="list-style-type:lower-alpha;">
  • 18. P a g e 18 | 43 <li>Maths</li> <li>Social Science</li> <li>Physics</li> </ol> <ol style="list-style-type:lower-roman;"> <li>Maths</li> <li>Social Science</li> <li>Physics</li> </ol> </body> </html> CSS - Positioning CSS helps you to position your HTML element. You can put any HTML element at whatever location you like. You can specify whether you want the element positioned relative to its natural position in the page or absolute based on its parent element. Now, we will see all the CSS positioning related properties with examples − Relative Positioning Relative positioning changes the position of the HTML element relative to where it normally appears. So "left:20" adds 20 pixels to the element's LEFT position. You can use two values top and left along with the position property to move an HTML element anywhere in the HTML document.  Move Left - Use a negative value for left.  Move Right - Use a positive value for left.  Move Up - Use a negative value for top.  Move Down - Use a positive value for top. NOTE − You can use bottom or right values as well in the same way as topand left. Here is the example − <html> <head> </head> <body> <div style="position:relative;left:80px;top:2px;background-color:yellow;"> This div has relative positioning. </div> </body> </html>
  • 19. P a g e 19 | 43 Absolute Positioning An element with position: absolute is positioned at the specified coordinates relative to your screen top-left corner. You can use two values top and left along with the position property to move an HTML element anywhere in the HTML document.  Move Left - Use a negative value for left.  Move Right - Use a positive value for left.  Move Up - Use a negative value for top.  Move Down - Use a positive value for top. NOTE − You can use bottom or right values as well in the same way as top and left. Here is an example − <html> <head> </head> <body> <div style="position:absolute; left:80px; top:20px; background-color:yellow;"> This div has absolute positioning. </div> </body> </html> Fixed Positioning Fixed positioning allows you to fix the position of an element to a particular spot on the page, regardless of scrolling. Specified coordinates will be relative to the browser window. You can use two values top and left along with the position property to move an HTML element anywhere in the HTML document.  Move Left - Use a negative value for left.  Move Right - Use a positive value for left.  Move Up - Use a negative value for top.  Move Down - Use a positive value for top. NOTE − You can use bottom or right values as well in the same way as topand left. Here is an example − <html> <head> </head> <body> <div style="position:fixed; left:80px; top:20px; background-color:yellow;">
  • 20. P a g e 20 | 43 This div has fixed positioning. </div> </body> </html> CSS Reference Color Properties Property Description CSS color Sets the color of text 1 opacity Sets the opacity level for an element 3 Background and Border Properties Property Description CSS background A shorthand property for setting all the background properties in one declaration 1 background- attachment Sets whether a background image is fixed or scrolls with the rest of the page 1 background- blend-mode Specifies the blending mode of each background layer (color/image) 3 background-color Specifies the background color of an element 1 background- image Specifies one or more background images for an element 1
  • 21. P a g e 21 | 43 background- position Specifies the position of a background image 1 background- repeat Sets how a background image will be repeated 1 background-clip Specifies the painting area of the background 3 background- origin Specifies where the background image(s) is/are positioned 3 background-size Specifies the size of the background image(s) 3 border Sets all the border properties in one declaration 1 border-bottom Sets all the bottom border properties in one declaration 1 border-bottom- color Sets the color of the bottom border 1 border-bottom- left-radius Defines the shape of the border of the bottom-left corner 3 border-bottom- right-radius Defines the shape of the border of the bottom-right corner 3 border-bottom- style Sets the style of the bottom border 1 border-bottom- width Sets the width of the bottom border 1 border-color Sets the color of the four borders 1 border-image A shorthand property for setting all the border- image-* properties 3 border-image- outset Specifies the amount by which the border image area extends beyond the border box 3
  • 22. P a g e 22 | 43 border-image- repeat Specifies whether the border image should be repeated, rounded or stretched 3 border-image- slice Specifies how to slice the border image 3 border-image- source Specifies the path to the image to be used as a border 3 border-image- width Specifies the widths of the image-border 3 border-left Sets all the left border properties in one declaration 1 border-left-color Sets the color of the left border 1 border-left-style Sets the style of the left border 1 border-left-width Sets the width of the left border 1 border-radius A shorthand property for setting all the four border- *-radius properties 3 border-right Sets all the right border properties in one declaration 1 border-right-color Sets the color of the right border 1 border-right-style Sets the style of the right border 1
  • 23. P a g e 23 | 43 border-right- width Sets the width of the right border 1 border-style Sets the style of the four borders 1 border-top Sets all the top border properties in one declaration 1 border-top-color Sets the color of the top border 1 border-top-left- radius Defines the shape of the border of the top-left corner 3 border-top-right- radius Defines the shape of the border of the top-right corner 3 border-top-style Sets the style of the top border 1 border-top-width Sets the width of the top border 1 border-width Sets the width of the four borders 1 box-decoration- break Sets the behaviour of the background and border of an element at page-break, or, for in-line elements, at line-break. 3 box-shadow Attaches one or more drop-shadows to the box 3
  • 24. P a g e 24 | 43 Basic Box Properties Property Description CSS bottom Specifies the bottom position of a positioned element 2 clear Specifies which sides of an element where other floating elements are not allowed 1 clip Clips an absolutely positioned element 2 display Specifies how a certain HTML element should be displayed 1 float Specifies whether or not a box should float 1 height Sets the height of an element 1 left Specifies the left position of a positioned element 2 margin Sets all the margin properties in one declaration 1 margin- bottom Sets the bottom margin of an element 1
  • 25. P a g e 25 | 43 margin-left Sets the left margin of an element 1 margin-right Sets the right margin of an element 1 margin-top Sets the top margin of an element 1 max-height Sets the maximum height of an element 2 max-width Sets the maximum width of an element 2 min-height Sets the minimum height of an element 2 min-width Sets the minimum width of an element 2 overflow Specifies what happens if content overflows an element's box 2 overflow-x Specifies whether or not to clip the left/right edges of the content, if it overflows the element's content area 3 overflow-y Specifies whether or not to clip the top/bottom edges of the content, if it overflows the element's content area 3
  • 26. P a g e 26 | 43 padding Sets all the padding properties in one declaration 1 padding- bottom Sets the bottom padding of an element 1 padding-left Sets the left padding of an element 1 padding- right Sets the right padding of an element 1 padding-top Sets the top padding of an element 1 position Specifies the type of positioning method used for an element (static, relative, absolute or fixed) 2 right Specifies the right position of a positioned element 2 top Specifies the top position of a positioned element 2 visibility Specifies whether or not an element is visible 2 width Sets the width of an element 1 vertical- align Sets the vertical alignment of an element 1
  • 27. P a g e 27 | 43 z-index Sets the stack order of a positioned element 2 Flexible Box Layout Property Description CSS align- content Specifies the alignment between the lines inside a flexible container when the items do not use all available space 3 align-items Specifies the alignment for items inside a flexible container 3 align-self Specifies the alignment for selected items inside a flexible container 3 flex Specifies the length of the item, relative to the rest 3 flex-basis Specifies the initial length of a flexible item 3 flex- direction Specifies the direction of the flexible items 3 flex-flow A shorthand property for the flex-direction and the flex- wrap properties 3 flex-grow Specifies how much the item will grow relative to the rest 3
  • 28. P a g e 28 | 43 flex-shrink Specifies how the item will shrink relative to the rest 3 flex-wrap Specifies whether the flexible items should wrap or not 3 justify- content Specifies the alignment between the items inside a flexible container when the items do not use all available space 3 order Sets the order of the flexible item, relative to the rest 3 Text Properties Property Description CSS hanging- punctuation Specifies whether a punctuation character may be placed outside the line box 3 hyphens Sets how to split words to improve the layout of paragraphs 3 letter-spacing Increases or decreases the space between characters in a text 1 line-break Specifies how/if to break lines 3 line-height Sets the line height 1
  • 29. P a g e 29 | 43 overflow-wrap Specifies whether or not the browser may break lines within words in order to prevent overflow (when a string is too long to fit its containing box) 3 tab-size Specifies the length of the tab-character 3 text-align Specifies the horizontal alignment of text 1 text-align-last Describes how the last line of a block or a line right before a forced line break is aligned when text-align is "justify" 3 text-combine- upright Specifies the combination of multiple characters into the space of a single character 3 text-indent Specifies the indentation of the first line in a text-block 1 text-justify Specifies the justification method used when text-align is "justify" 3 text-transform Controls the capitalization of text 1 white-space Specifies how white-space inside an element is handled 1 word-break Specifies line breaking rules for non-CJK scripts 3
  • 30. P a g e 30 | 43 word-spacing Increases or decreases the space between words in a text 1 word-wrap Allows long, unbreakable words to be broken and wrap to the next line 3 Text Decoration Properties Property Description CSS text-decoration Specifies the decoration added to text 1 text-decoration- color Specifies the color of the text-decoration 3 text-decoration- line Specifies the type of line in a text-decoration 3 text-decoration- style Specifies the style of the line in a text decoration 3 text-shadow Adds shadow to text 3 text-underline- position Specifies the position of the underline which is set using the text-decoration property 3
  • 31. P a g e 31 | 43 Font Properties Property Description CSS @font-face A rule that allows websites to download and use fonts other than the "web-safe" fonts 3 @font-feature- values Allows authors to use a common name in font-variant- alternate for feature activated differently in OpenType 3 font Sets all the font properties in one declaration 1 font-family Specifies the font family for text 1 font-feature- settings Allows control over advanced typographic features in OpenType fonts 3 font-kerning Controls the usage of the kerning information (how letters are spaced) 3 font-language- override Controls the usage of language-specific glyphs in a typeface 3 font-size Specifies the font size of text 1 font-size- adjust Preserves the readability of text when font fallback occurs 3
  • 32. P a g e 32 | 43 font-stretch Selects a normal, condensed, or expanded face from a font family 3 font-style Specifies the font style for text 1 font-synthesis Controls which missing typefaces (bold or italic) may be synthesized by the browser 3 font-variant Specifies whether or not a text should be displayed in a small-caps font 1 font-variant- alternates Controls the usage of alternate glyphs associated to alternative names defined in @font-feature-values 3 font-variant- caps Controls the usage of alternate glyphs for capital letters 3 font-variant- east-asian Controls the usage of alternate glyphs for East Asian scripts (e.g Japanese and Chinese) 3 font-variant- ligatures Controls which ligatures and contextual forms are used in textual content of the elements it applies to 3 font-variant- numeric Controls the usage of alternate glyphs for numbers, fractions, and ordinal markers 3 font-variant- position Controls the usage of alternate glyphs of smaller size positioned as superscript or subscript regarding the baseline of the font 3
  • 33. P a g e 33 | 43 font-weight Specifies the weight of a font 1 Writing Modes Properties Property Description CSS direction Specifies the text direction/writing direction 2 text- orientation Defines the orientation of the text in a line 3 text- combine- upright Specifies the combination of multiple characters into the space of a single character 3 unicode-bidi Used together with the direction property to set or return whether the text should be overridden to support multiple languages in the same document 2 user-select Specifies whether the text of an element can be selected 3 writing-mode 3 Table Properties Property Description border-collapse Specifies whether or not table borders should be collapsed border-spacing Specifies the distance between the borders of adjacent cells
  • 34. P a g e 34 | 43 caption-side Specifies the placement of a table caption empty-cells Specifies whether or not to display borders and background on e a table table-layout Sets the layout algorithm to be used for a table Lists and Counters Properties Property Description CSS counter- increment Increments one or more counters 2 counter-reset Creates or resets one or more counters 2 list-style Sets all the properties for a list in one declaration 1 list-style- image Specifies an image as the list-item marker 1 list-style- position Specifies if the list-item markers should appear inside or outside the content flow 1 list-style-type Specifies the type of list-item marker 1 Animation Properties Property Description CSS
  • 35. P a g e 35 | 43 @keyframes Specifies the animation code 3 animation A shorthand property for all the animation properties (except animation-play-state and animation-fill- mode) 3 animation-delay Specifies a delay for the start of an animation 3 animation- direction Specifies whether or not the animation should play in reverse on alternate cycles 3 animation- duration Specifies how many seconds or milliseconds an animation takes to complete one cycle 3 animation-fill- mode Specifies a style for the element when the animation is not playing (when it is finished, or when it has a delay) 3 animation- iteration-count Specifies the number of times an animation should be played 3 animation-name Specifies the name of the @keyframes animation 3 animation-play- state Specifies whether the animation is running or paused 3
  • 36. P a g e 36 | 43 animation-timing- function Specifies the speed curve of an animation 3 Transform Properties Property Description CSS backface- visibility Defines whether or not an element should be visible when not facing the screen 3 perspective Specifies the perspective on how 3D elements are viewed 3 perspective- origin Specifies the bottom position of 3D elements 3 transform Applies a 2D or 3D transformation to an element 3 transform- origin Allows you to change the position on transformed elements 3 transform-style Specifies how nested elements are rendered in 3D space 3 Transitions Properties Property Description transition A shorthand property for setting the four transition properties transition-property Specifies the name of the CSS property the transition effect is f
  • 37. P a g e 37 | 43 transition-duration Specifies how many seconds or milliseconds a transition effect t complete transition-timing- function Specifies the speed curve of the transition effect transition-delay Specifies when the transition effect will start Basic User Interface Properties Property Description box-sizing Tells the browser what the sizing properties (width and height) include content Used with the :before and :after pseudo-elements, to insert gen content cursor Specifies the type of cursor to be displayed ime-mode Controls the state of the input method editor for text fields nav-down Specifies where to navigate when using the arrow-down navigat nav-index Specifies the tabbing order for an element nav-left Specifies where to navigate when using the arrow-left navigatio nav-right Specifies where to navigate when using the arrow-right navigat nav-up Specifies where to navigate when using the arrow-up navigation outline Sets all the outline properties in one declaration outline-color Sets the color of an outline outline-offset Offsets an outline, and draws it beyond the border edge outline-style Sets the style of an outline outline-width Sets the width of an outline resize Specifies whether or not an element is resizable by the user text-overflow Specifies what should happen when text overflows the containin
  • 38. P a g e 38 | 43 Multi-column Layout Properties Property Description CSS break-after Specifies the page-, column-, or region-break behavior after the generated box 3 break-before Specifies the page-, column-, or region-break behavior before the generated box 3 break-inside Specifies the page-, column-, or region-break behavior inside the generated box 3 column- count Specifies the number of columns an element should be divided into 3 column-fill Specifies how to fill columns 3 column-gap Specifies the gap between the columns 3 column-rule A shorthand property for setting all the column-rule-* properties 3 column-rule- color Specifies the color of the rule between columns 3 column-rule- style Specifies the style of the rule between columns 3
  • 39. P a g e 39 | 43 column-rule- width Specifies the width of the rule between columns 3 column-span Specifies how many columns an element should span across 3 column- width Specifies the width of the columns 3 columns A shorthand property for setting column-width and column-count 3 widows Sets the minimum number of lines that must be left at the top of a page when a page break occurs inside an element 2 Paged Media Property Description CSS orphans Sets the minimum number of lines that must be left at the bottom of a page when a page break occurs inside an element 2 page-break- after Sets the page-breaking behavior after an element 2 page-break- before Sets the page-breaking behavior before an element 2
  • 40. P a g e 40 | 43 page-break- inside Sets the page-breaking behavior inside an element 2 Generated Content for Paged Media Property Description marks Adds crop and/or cross marks to the document quotes Sets the type of quotation marks for embedded quotations Filter Effects Properties Property Description filter Defines effects (e.g. blurring or color shifting) on an element befo element is displayed Image Values and Replaced Content Property Description image-orientation Specifies a rotation in the right or clockwise direction that a user agent image (This property is likely going to be deprecated and its functionalit HTML) image-rendering Gives a hint to the browser about what aspects of an image are most im preserve when the image is scaled image-resolution Specifies the intrinsic resolution of all raster images used in/on the elem object-fit Specifies how the contents of a replaced element should be fitted to the established by its used height and width object-position Specifies the alignment of the replaced element inside its box Masking Properties Property Description CSS
  • 41. P a g e 41 | 43 mask 3 mask-type 3 Speech Properties Property Description CSS mark A shorthand property for setting the mark-before and mark-after properties 3 mark-after Allows named markers to be attached to the audio stream 3 mark-before Allows named markers to be attached to the audio stream 3 phonemes Specifies a phonetic pronunciation for the text contained by the corresponding element 3 rest A shorthand property for setting the rest-before and rest-after properties 3 rest-after Specifies a rest or prosodic boundary to be observed after speaking an element's content 3 rest-before Specifies a rest or prosodic boundary to be observed before speaking an element's content 3
  • 42. P a g e 42 | 43 voice-balance Specifies the balance between left and right channels 3 voice-duration Specifies how long it should take to render the selected element's content 3 voice-pitch Specifies the average pitch (a frequency) of the speaking voice 3 voice-pitch- range Specifies variation in average pitch 3 voice-rate Controls the speaking rate 3 voice-stress Indicates the strength of emphasis to be applied 3 voice-volume Refers to the amplitude of the waveform output by the speech synthesises 3 Marquee Properties Property Description CSS marquee-direction Sets the direction of the moving content 3 marquee-play- count Sets how many times the content move 3
  • 43. P a g e 43 | 43 marquee-speed Sets how fast the content scrolls 3 marquee-style Sets the style of the moving content 3