Unit 1 - CSS_st
Unit 1 - CSS_st
–HTML/HTML5
Web Essentials Iand Mark-up language -
Syllabus - CSS
Web Essentials and Mark-up language - HTML/HTML5
• Introduction to CSS3 box model, selectors, Positioning, Pseudo-class,
Pseudo-element, Building Responsive Websites with HTML5 and
CSS3, HTML5 and CSS3 Site Design using Flexbox
• Types of CSS, How to use CSS, Properties, Classes, Child-Class
(Nested CSS), Colors, Text, Background, Border, Margin, Padding,
Positioning (flex, grid, inline, block), Animation, Transition.
CS
S
CSS
•Why CSS
•Types of CSS
•Properties
• CreateStunning Web site - CSS handles the look and feel part of a
web page.
• Learn other languages - Once you understands the basic of HTML and
CSS
then other relatedtechnologies like javascript, php,or
angular are become easier to understand.
Hello World using CSS
Demo
Applications of
CSS
• CSS saves time
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
The Universal Selectors
• * (asterisk): This is the universal selector
• It targets all HTML elements in the document, regardless of their
tag name.
Check *
<!DOCTYPE html>
<html>
<head> The Descendant
• Style rule will apply to <em> element only
Selectors
<title>ul em Selector Example</title>
<style> when it lies inside <ul> tag.
ul em {
color: red;
font-style: italic;
}
</style> </head> <body>
<ul>
<li>This is a list item.</li>
<li>This list item has an
<em>emphasized</em> word.</li>
<li>Another list item.</li>
</ul>
Click here
<p>This is a paragraph with
<em>emphasized</em> text.</p>
</body>
</html>
The Class
Selectors
• You can define style rules based on the class attribute of the
elements
The Attribute
Selectors
CSS -
Color
CSS uses color values to specify a
color.
CSS Colors - Hex Codes
•A hexadecimal is a 6
digit representation of
a color.
• The first two
digits(RR) represent
a red value, the next
two are a green
value(GG), and the
last are the blue
value(BB).
CSS Colors - Short Hex
Codes
• This
is a shorter
form of the six-digit
notation.
• Inthis format, each
digit is replicated to
arrive at an equivalent
six-digit value. For
example: #6A7
becomes #66AA77.
CSS Colors - RGB Values
• Thiscolor value is
specified using the
rgb( ) property.
• This
property takes three
values, one each for red,
green, and blue. The value
can be an integer between
0 and 255 or a percentage.
Building Color Codes
• You can build millions of color codes using our Color Code
Builder. Check our HTML Color Code Builder. To use this
tool, you would need a Java Enabled Browser.
• background-image
• background-repeat
• background-position
• background-
attachment
• background
Set the Background Color
Set the Background Image
CSS - Fonts
• font-
family
• font-style
• font-
variant
• font-
weight
• font-size
• font
Set the Font Family
Set the Font Style
CSS - Images
• border
• height
• width
• -moz-
opacity
CSS -
Border
• border-color
• border-style
• border-width
border-color
Property
• border-bottom-color
• border-top-color
• border-left-color
• border-right-color
CSS
Margins
• margin
• margin-
bottom
• margin-top
• margin-left
• margin-right
CSS -
•Padding
padding-
bottom
• padding-top
• padding-left
• padding-right
• padding
CSS - Animation
• https://www.tutorialspoint.com/css/css_animation.htm
Types of CSS
• There are three types of
CSS.
1. Inline CSS
2. Internal CSS
3. External CSS
Inline
CSS
Inline CSS contains the CSS property in the body section attached with
element is known as inline CSS. This kind of style is specified within an
HTML tag using the style attribute.
Internal or Embedded
CSS:
•This can be used when a single HTML document must be styled uniquely.
The CSS rule set should be within the HTML file in the head section i.e the
CSS is embedded within the HTML file.
External
•CSS
External CSS contains separate CSS file which contains
only style property with the help of tag attributes (For
example class, id, heading, … etc).
• CSSproperty written in a separate file with .css extension
and should be linked to the HTML document using link tag.
• This
means that for each element, style can be set only once
and that will be applied across web pages.
Examp
le