SlideShare uma empresa Scribd logo
1 de 22
RESPONSIVE WEB DESIGN
WITH
HTML5 & CSS3
ADVANCED WEB TECHNOLOGY
MODULE 2
DIVYA TIWARI
MEIT
TERNA ENGINEERING COLLEGE
INDEX
• Introduction to CSS
1. Evolution of CSS
2. Syntax of CSS
3. Exploring CSS Selectors
4. Inserting CSS in an HTML Documents
5. Defining Inheritance in CSS
• CSS3 and Responsive Web Design
1. CSS3: Selectors, Typography and Color
Modes
2. Stunning Aesthetics with CSS3
3. CSS3 Transitions, Transformations and
Animations
Evolution of CSS
• CSS was introduced in late 1996 on the recommendation of World Wide Web
Consortium (W3C).
• The CSS level 1 (CSS 1) Recommendation was published in December, 1996.
• The W3C group worked on the issues that were not addressed in CSS 1. It gave
rise to the creation of higher version of CSS 1 namely CSS level 2 (CSS 2) on
November 4, 1997.
• CSS 2 was published as a W3C Recommendation on May 12, 1998. Some CSS 2
properties that could not be successfully implemented by the Web browsers were
discarded from CSS 2.
• Later, CSS 2.1 became a Candidate Recommendation on February 25, 2004, but
was pulled back to Working Draft status on June 13, 2005, and again returned to
Candidate Recommendation status on July 19, 2007.
Syntax of CSS
• Syntax can be defined as a rule that defines the structure or the order of the
statements used in a programming language.
• It also specifies how words and symbols are put together to form statements and
expressions.
• CSS also uses syntax to apply CSS rules in an HTML document. The CSS syntax
is divided into two different parts—selector and declaration.
• Selector defines an HTML element to which the CSS style is applied and the
declaration contains the CSS properties as well as the value of these properties.
Exploring CSS Selectors
• A selector is a pattern that is used to select an element to apply the CSS style rules.
• Selectors can be used as a condition or a CSS rule to determine the elements that
match with the selector.
• The CSS rule is divided into two parts: selectors and declaration.
• The different types of selectors are as follows:
a) The universal selector
b) The type selector
c) The class selector
d) The id selector
e) The child selector
f) The descendant selector
g) The adjacent sibling selector
h) The attribute selector
i) The query selector
Inserting CSS in an HTML Documents
• A CSS style sheet can be linked to an HTML document in a variety of ways,
where each way has its own advantages and disadvantages.
• The following are three ways to apply CSS style to your HTML document:
• The internal style sheet
• The external style sheet
• The in-line style
• The Internal Style Sheet
The internal style sheet is written within the HEAD element of the HTML
document. This style is applied only to the documents in which it is defined
and not referenced by any other Web document.
<STYLE type="text/css">
selector {property: value;}
</STYLE>
• The External Style Sheet
• The syntax to create an external style sheet is same as that of creating an internal
style sheet.
• In case of internal style sheet, the CSS file is placed inside the HTML document;
whereas, in case of external style sheet, the CSS file is written outside the HTML
document and the reference of the CSS file is placed in the HTML document.
• Linking—Refers to the HTML LINK element, which is used to link a style sheet. This
element has three attributes— rel, type, and href. The rel attribute specifies what you are
linking (style sheet in this case). The type specifies the MIME type for the browser, and
the href attribute specifies the path of the .css file.
<LINK rel=”style sheet” type=”text/css” href=”test.css”/>
• Importing—Helps you in accessing the style rules from other CSS style sheets. The
@import keyword is used, followed by the Uniform Resource Identifier (URI) of the
style sheet to which you want to import the style rules.
<STYLE TYPE="text/css">
@media screen
{ body {font-size: 13px} }
</STYLE>
• The Inline style
• The inline style properties are written in a single line separated by semicolons. These
properties are placed inside the style attribute of the HTML element, on which you want
to apply the style:
<P style="background:#ccc; color:#fff; border: solid black 1px;">
Defining Inheritance in CSS
• In CSS, a property that is applied to an element is also inherited by the child
elements of that element.
• For example, if the font-family property is declared for the BODY element, it is
automatically applied to all the elements present inside the BODY element.
• This inheritance saves your time in writing the repeated code for every single
element that constitutes the Web page.
• The following code snippet shows inheritance in CSS:
<DIV style="font-family:serif; border:1px solid red; padding:10px;">
This text will be in a serif font.
<P>
This text is also in a serif font, because font is inherited by default. But the border and
padding properties are not inherited from the parent div.
</P>
</DIV>
CSS3: Selectors, Typography and Color
Modes
• CSS3 has Supported additional color properties as follows −
• RGBA colors (Red Green Blue Alpha)
• HSL colors (hue, saturation, lightness)
• HSLA colors (hue, saturation, lightness and alpha)
• Opacity
RGBA colors (Red Green Blue Alpha)
• It is an extension of CSS2, Alpha specifies the opacity of a color and parameter number
is a numerical between 0.0 to 1.0.
• A Sample syntax of RGBA as shown below −
#d1 {background-color: rgba(255, 0, 0, 0.5);}
#d2 {background-color: rgba(0, 255, 0, 0.5);}
#d3 {background-color: rgba(0, 0, 255, 0.5);}
Output
HSL colors (hue, saturation, lightness)
• HSL stands for hue, saturation, lightness.
• Here Hue is a degree on the color wheel, saturation and lightness are percentage values
between 0 to 100%.
• A Sample syntax of HSL as shown below −
#g1 {background-color: hsl(120, 100%, 50%);}
#g2 {background-color: hsl(120, 100%, 75%);}
#g3 {background-color: hsl(120, 100%, 25%);}
Output
Code –
<!DOCTYPE html>
<html>
<head>
<style>
#g1 {background-color:hsl(120,100%,50%);}
#g2 {background-color:hsl(120,100%,75%);}
#g3 {background-color:hsl(120,100%,25%);}
</style>
</head>
<body>
<p>HSL colors:</p>
<p id="g1">Green</p>
<p id="g2">Normal Green</p>
<p id="g3">Dark Green</p>
</body>
</html>
HSLA colors (hue, saturation, lightness and alpha)
• HSLA stands for hue, saturation, lightness and alpha.
• Alpha value specifies the opacity as shown RGBA.
• A Sample syntax of HSLA as shown below −
#g1 {background-color: hsla(120, 100%, 50%, 0.3);}
#g2 {background-color: hsla(120, 100%, 75%, 0.3);}
#g3 {background-color: hsla(120, 100%, 25%, 0.3);}
Output
Code –
<!DOCTYPE html>
<html>
<head>
<style>
#d1 {background-color:hsla(120,100%,50%,0.3);}
#d2 {background-color:hsla(120,100%,75%,0.3);}
#d3 {background-color:hsla(120,100%,25%,0.3);}
</style>
</head>
<body>
<p>HSLA colors:</p>
<p id="d1">Less opacity green</p>
<p id="d2">Green</p>
<p id="d3">Green</p>
</body>
</html>
Stunning Aesthetics with CSS3
• Creating text shadows with CSS3
• Creating box shadows with CSS3
• Gradient backgrounds with CSS3
Creating text shadows with CSS3
• The CSS text-shadow property applies shadow to text.
• In its simplest use, you only specify the horizontal shadow (2px) and the vertical shadow
(3px):
• Adding a blur effect to the shadow
• Adding color to the shadow
Syntax :
.element { text-shadow: 2px 3px 1px #ccc; }
Output
Code –
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-shadow: 2px 2px 5px red;
}
</style>
</head>
<body>
<h1>Text-shadow effect!</h1>
</body>
</html>
Text-shadow effect!
Creating box shadows with CSS3
• The CSS box-shadow property applies shadow to elements.
Syntax :
.shadow { box-shadow: 0px 3px 5px #444; }
Output
Code –
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 300px;
height: 100px;
padding: 15px;
background-color: yellow;
box-shadow: 10px 10px 5px grey;
}
</style>
</head>
<body>
<div>This is a div element with a box-
shadow</div>
</body>
</html>
Gradient backgrounds with CSS3
• CSS gradients let you display smooth transitions between two or more specified colors.
• CSS defines two types of gradients:
• Linear Gradients (goes down/up/left/right/diagonally)
• Radial Gradients (defined by their center)
Syntax
background: linear-gradient(direction, color-stop1, color-stop2, ...);
background: linear-gradient(angle, color-stop1, color-stop2);
background: radial-gradient(shape size at position, start-color, ..., last-color);
 The angle is specified as an angle between a horizontal line and the gradient line.
 The shape parameter defines the shape. It can take the value circle or ellipse. The
default value is ellipse.
Example :-
Code –
<!DOCTYPE html>
<html>
<head>
<style>
#grad1 {
height: 100px;
background: red; /* For browsers that do not support gradients */
background: linear-gradient(to right, red , yellow); /* Standard syntax (must be last) */
}
#grad2 {
height: 100px;
background: red; /* For browsers that do not support gradients */
background: linear-gradient(-90deg, red, yellow); /* Standard syntax (must be last) */
}
#grad3 {
height: 150px;
width: 200px;
background: red; /* For browsers that do not support gradients */
background: radial-gradient(circle, red, yellow, green); /* Standard syntax (must be last) */
}
#grad4 {
height: 200px;
background: red; /* For browsers that do not support gradients */
background: repeating-linear-gradient(90deg,red,yellow 7%,green 10%); /* Standard syntax
(must be last) */
}
</style>
</head>
<body>
<h1>Linear Gradient - Left to Right</h1>
<div id="grad1"></div>
<h1>Linear Gradient - Left to Right with angle</h1>
<div id="grad2" style="text-align:center;">-90deg</div><br>
<h1>Radial Gradient - Shapes</h1>
<div id="grad3"></div>
<h1>A repeating gradient on 90deg starting red and finishing green:</h1>
<div id="grad4"></div>
</body>
</html>
Output
CSS3 Transitions, Transformations and
Animations
• CSS3 transitions allows to change property values smoothly, over a given duration.
• Properties of Transitions are:
• Transition
• Transition-delay
• Transition-duration
• Transition-property
• Transition-timing-function
Output
• CSS3 Transformation provides following transformation methods:
• Translate()
• Rotate()
• scaleX()
• scaleY()
• scale()
• skewX()
• skewY()
• skew()
• matrix()
Output
• CSS3 allows animation of HTML elements without using JavaScript or Flash.
• Properties of Animations are:
• @keyframes
• animation-name
• animation-duration
• animation-delay
• animation-iteration-count
• animation-direction
• animation-timing-function
• animation-fill-mode
Output
MU Exam Questions
May 2017
• Explain how to design a responsive web with HTML5 and CSS. 10 marks
Dec 2018
• Explain in detail Responsive web design with an example. 10 marks
• What are major differences between CSS3 and CSS2. 10 marks
May 2019
• Explain in detail Responsive web design using HTML5 and CSS3 with an example.
10 marks
• Create a web page to show how you can apply the transformation effects so that the image
rotates by 150 degree. Assume suitable parameters if required. 10 marks
Responsive web design with html5 and css3

Mais conteĂşdo relacionado

Mais procurados

Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
St. Petersburg College
 
Html Expression Web
Html Expression WebHtml Expression Web
Html Expression Web
Mark Frydenberg
 

Mais procurados (20)

Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
Css
CssCss
Css
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
 
CSS
CSS CSS
CSS
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
Css ppt
Css pptCss ppt
Css ppt
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Html Expression Web
Html Expression WebHtml Expression Web
Html Expression Web
 
HTML CSS Basics
HTML CSS BasicsHTML CSS Basics
HTML CSS Basics
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
Css
CssCss
Css
 
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
CSS
CSSCSS
CSS
 

Semelhante a Responsive web design with html5 and css3

Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
Cascading Style Sheets for web browser.pptx
Cascading Style Sheets for web browser.pptxCascading Style Sheets for web browser.pptx
Cascading Style Sheets for web browser.pptx
alvindalejoyosa1
 
Css present
Css presentCss present
Css present
MissaGiles
 

Semelhante a Responsive web design with html5 and css3 (20)

Css
CssCss
Css
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
 
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...
 
4. Web Technology CSS Basics-1
4. Web Technology CSS Basics-14. Web Technology CSS Basics-1
4. Web Technology CSS Basics-1
 
2 introduction css
2 introduction css2 introduction css
2 introduction css
 
Cascading Style Sheets for web browser.pptx
Cascading Style Sheets for web browser.pptxCascading Style Sheets for web browser.pptx
Cascading Style Sheets for web browser.pptx
 
Week11 Lecture: CSS
Week11 Lecture: CSSWeek11 Lecture: CSS
Week11 Lecture: CSS
 
Unit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptxUnit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptx
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
BITM3730 9-19.pptx
BITM3730 9-19.pptxBITM3730 9-19.pptx
BITM3730 9-19.pptx
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Kick start @ css
Kick start @ cssKick start @ css
Kick start @ css
 
CSS(Cascading Stylesheet)
CSS(Cascading Stylesheet)CSS(Cascading Stylesheet)
CSS(Cascading Stylesheet)
 
BITM3730 9-20.pptx
BITM3730 9-20.pptxBITM3730 9-20.pptx
BITM3730 9-20.pptx
 
Css present
Css presentCss present
Css present
 
Css
CssCss
Css
 
Css
CssCss
Css
 
CSS
CSSCSS
CSS
 
CSS-part-1.ppt
CSS-part-1.pptCSS-part-1.ppt
CSS-part-1.ppt
 

Mais de Divya Tiwari

Mais de Divya Tiwari (13)

Digital stick by Divya & Kanti
Digital stick by Divya & KantiDigital stick by Divya & Kanti
Digital stick by Divya & Kanti
 
Predicting house price
Predicting house pricePredicting house price
Predicting house price
 
Testing strategies -2
Testing strategies -2Testing strategies -2
Testing strategies -2
 
Testing strategies part -1
Testing strategies part -1Testing strategies part -1
Testing strategies part -1
 
Performance measures
Performance measuresPerformance measures
Performance measures
 
Programming using MPI and OpenMP
Programming using MPI and OpenMPProgramming using MPI and OpenMP
Programming using MPI and OpenMP
 
IoT applications and use cases part-2
IoT applications and use cases part-2IoT applications and use cases part-2
IoT applications and use cases part-2
 
Io t applications and use cases part-1
Io t applications and use cases part-1Io t applications and use cases part-1
Io t applications and use cases part-1
 
Planning for security and security audit process
Planning for security and security audit processPlanning for security and security audit process
Planning for security and security audit process
 
Security management concepts and principles
Security management concepts and principlesSecurity management concepts and principles
Security management concepts and principles
 
Web services
Web servicesWeb services
Web services
 
Mac protocols for ad hoc wireless networks
Mac protocols for ad hoc wireless networks Mac protocols for ad hoc wireless networks
Mac protocols for ad hoc wireless networks
 
Routing protocols for ad hoc wireless networks
Routing protocols for ad hoc wireless networks Routing protocols for ad hoc wireless networks
Routing protocols for ad hoc wireless networks
 

Último

Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Último (20)

Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 

Responsive web design with html5 and css3

  • 1. RESPONSIVE WEB DESIGN WITH HTML5 & CSS3 ADVANCED WEB TECHNOLOGY MODULE 2 DIVYA TIWARI MEIT TERNA ENGINEERING COLLEGE
  • 2. INDEX • Introduction to CSS 1. Evolution of CSS 2. Syntax of CSS 3. Exploring CSS Selectors 4. Inserting CSS in an HTML Documents 5. Defining Inheritance in CSS • CSS3 and Responsive Web Design 1. CSS3: Selectors, Typography and Color Modes 2. Stunning Aesthetics with CSS3 3. CSS3 Transitions, Transformations and Animations
  • 3. Evolution of CSS • CSS was introduced in late 1996 on the recommendation of World Wide Web Consortium (W3C). • The CSS level 1 (CSS 1) Recommendation was published in December, 1996. • The W3C group worked on the issues that were not addressed in CSS 1. It gave rise to the creation of higher version of CSS 1 namely CSS level 2 (CSS 2) on November 4, 1997. • CSS 2 was published as a W3C Recommendation on May 12, 1998. Some CSS 2 properties that could not be successfully implemented by the Web browsers were discarded from CSS 2. • Later, CSS 2.1 became a Candidate Recommendation on February 25, 2004, but was pulled back to Working Draft status on June 13, 2005, and again returned to Candidate Recommendation status on July 19, 2007.
  • 4. Syntax of CSS • Syntax can be defined as a rule that defines the structure or the order of the statements used in a programming language. • It also specifies how words and symbols are put together to form statements and expressions. • CSS also uses syntax to apply CSS rules in an HTML document. The CSS syntax is divided into two different parts—selector and declaration. • Selector defines an HTML element to which the CSS style is applied and the declaration contains the CSS properties as well as the value of these properties.
  • 5. Exploring CSS Selectors • A selector is a pattern that is used to select an element to apply the CSS style rules. • Selectors can be used as a condition or a CSS rule to determine the elements that match with the selector. • The CSS rule is divided into two parts: selectors and declaration. • The different types of selectors are as follows: a) The universal selector b) The type selector c) The class selector d) The id selector e) The child selector f) The descendant selector g) The adjacent sibling selector h) The attribute selector i) The query selector
  • 6. Inserting CSS in an HTML Documents • A CSS style sheet can be linked to an HTML document in a variety of ways, where each way has its own advantages and disadvantages. • The following are three ways to apply CSS style to your HTML document: • The internal style sheet • The external style sheet • The in-line style • The Internal Style Sheet The internal style sheet is written within the HEAD element of the HTML document. This style is applied only to the documents in which it is defined and not referenced by any other Web document. <STYLE type="text/css"> selector {property: value;} </STYLE>
  • 7. • The External Style Sheet • The syntax to create an external style sheet is same as that of creating an internal style sheet. • In case of internal style sheet, the CSS file is placed inside the HTML document; whereas, in case of external style sheet, the CSS file is written outside the HTML document and the reference of the CSS file is placed in the HTML document. • Linking—Refers to the HTML LINK element, which is used to link a style sheet. This element has three attributes— rel, type, and href. The rel attribute specifies what you are linking (style sheet in this case). The type specifies the MIME type for the browser, and the href attribute specifies the path of the .css file. <LINK rel=”style sheet” type=”text/css” href=”test.css”/> • Importing—Helps you in accessing the style rules from other CSS style sheets. The @import keyword is used, followed by the Uniform Resource Identifier (URI) of the style sheet to which you want to import the style rules. <STYLE TYPE="text/css"> @media screen { body {font-size: 13px} } </STYLE>
  • 8. • The Inline style • The inline style properties are written in a single line separated by semicolons. These properties are placed inside the style attribute of the HTML element, on which you want to apply the style: <P style="background:#ccc; color:#fff; border: solid black 1px;">
  • 9. Defining Inheritance in CSS • In CSS, a property that is applied to an element is also inherited by the child elements of that element. • For example, if the font-family property is declared for the BODY element, it is automatically applied to all the elements present inside the BODY element. • This inheritance saves your time in writing the repeated code for every single element that constitutes the Web page. • The following code snippet shows inheritance in CSS: <DIV style="font-family:serif; border:1px solid red; padding:10px;"> This text will be in a serif font. <P> This text is also in a serif font, because font is inherited by default. But the border and padding properties are not inherited from the parent div. </P> </DIV>
  • 10. CSS3: Selectors, Typography and Color Modes • CSS3 has Supported additional color properties as follows − • RGBA colors (Red Green Blue Alpha) • HSL colors (hue, saturation, lightness) • HSLA colors (hue, saturation, lightness and alpha) • Opacity RGBA colors (Red Green Blue Alpha) • It is an extension of CSS2, Alpha specifies the opacity of a color and parameter number is a numerical between 0.0 to 1.0. • A Sample syntax of RGBA as shown below − #d1 {background-color: rgba(255, 0, 0, 0.5);} #d2 {background-color: rgba(0, 255, 0, 0.5);} #d3 {background-color: rgba(0, 0, 255, 0.5);} Output
  • 11. HSL colors (hue, saturation, lightness) • HSL stands for hue, saturation, lightness. • Here Hue is a degree on the color wheel, saturation and lightness are percentage values between 0 to 100%. • A Sample syntax of HSL as shown below − #g1 {background-color: hsl(120, 100%, 50%);} #g2 {background-color: hsl(120, 100%, 75%);} #g3 {background-color: hsl(120, 100%, 25%);} Output Code – <!DOCTYPE html> <html> <head> <style> #g1 {background-color:hsl(120,100%,50%);} #g2 {background-color:hsl(120,100%,75%);} #g3 {background-color:hsl(120,100%,25%);} </style> </head> <body> <p>HSL colors:</p> <p id="g1">Green</p> <p id="g2">Normal Green</p> <p id="g3">Dark Green</p> </body> </html>
  • 12. HSLA colors (hue, saturation, lightness and alpha) • HSLA stands for hue, saturation, lightness and alpha. • Alpha value specifies the opacity as shown RGBA. • A Sample syntax of HSLA as shown below − #g1 {background-color: hsla(120, 100%, 50%, 0.3);} #g2 {background-color: hsla(120, 100%, 75%, 0.3);} #g3 {background-color: hsla(120, 100%, 25%, 0.3);} Output Code – <!DOCTYPE html> <html> <head> <style> #d1 {background-color:hsla(120,100%,50%,0.3);} #d2 {background-color:hsla(120,100%,75%,0.3);} #d3 {background-color:hsla(120,100%,25%,0.3);} </style> </head> <body> <p>HSLA colors:</p> <p id="d1">Less opacity green</p> <p id="d2">Green</p> <p id="d3">Green</p> </body> </html>
  • 13. Stunning Aesthetics with CSS3 • Creating text shadows with CSS3 • Creating box shadows with CSS3 • Gradient backgrounds with CSS3
  • 14. Creating text shadows with CSS3 • The CSS text-shadow property applies shadow to text. • In its simplest use, you only specify the horizontal shadow (2px) and the vertical shadow (3px): • Adding a blur effect to the shadow • Adding color to the shadow Syntax : .element { text-shadow: 2px 3px 1px #ccc; } Output Code – <!DOCTYPE html> <html> <head> <style> h1 { text-shadow: 2px 2px 5px red; } </style> </head> <body> <h1>Text-shadow effect!</h1> </body> </html> Text-shadow effect!
  • 15. Creating box shadows with CSS3 • The CSS box-shadow property applies shadow to elements. Syntax : .shadow { box-shadow: 0px 3px 5px #444; } Output Code – <!DOCTYPE html> <html> <head> <style> div { width: 300px; height: 100px; padding: 15px; background-color: yellow; box-shadow: 10px 10px 5px grey; } </style> </head> <body> <div>This is a div element with a box- shadow</div> </body> </html>
  • 16. Gradient backgrounds with CSS3 • CSS gradients let you display smooth transitions between two or more specified colors. • CSS defines two types of gradients: • Linear Gradients (goes down/up/left/right/diagonally) • Radial Gradients (defined by their center) Syntax background: linear-gradient(direction, color-stop1, color-stop2, ...); background: linear-gradient(angle, color-stop1, color-stop2); background: radial-gradient(shape size at position, start-color, ..., last-color);  The angle is specified as an angle between a horizontal line and the gradient line.  The shape parameter defines the shape. It can take the value circle or ellipse. The default value is ellipse.
  • 17. Example :- Code – <!DOCTYPE html> <html> <head> <style> #grad1 { height: 100px; background: red; /* For browsers that do not support gradients */ background: linear-gradient(to right, red , yellow); /* Standard syntax (must be last) */ } #grad2 { height: 100px; background: red; /* For browsers that do not support gradients */ background: linear-gradient(-90deg, red, yellow); /* Standard syntax (must be last) */ } #grad3 { height: 150px; width: 200px; background: red; /* For browsers that do not support gradients */ background: radial-gradient(circle, red, yellow, green); /* Standard syntax (must be last) */ } #grad4 { height: 200px; background: red; /* For browsers that do not support gradients */ background: repeating-linear-gradient(90deg,red,yellow 7%,green 10%); /* Standard syntax (must be last) */ } </style> </head> <body> <h1>Linear Gradient - Left to Right</h1> <div id="grad1"></div> <h1>Linear Gradient - Left to Right with angle</h1> <div id="grad2" style="text-align:center;">-90deg</div><br> <h1>Radial Gradient - Shapes</h1> <div id="grad3"></div> <h1>A repeating gradient on 90deg starting red and finishing green:</h1> <div id="grad4"></div> </body> </html> Output
  • 18. CSS3 Transitions, Transformations and Animations • CSS3 transitions allows to change property values smoothly, over a given duration. • Properties of Transitions are: • Transition • Transition-delay • Transition-duration • Transition-property • Transition-timing-function Output
  • 19. • CSS3 Transformation provides following transformation methods: • Translate() • Rotate() • scaleX() • scaleY() • scale() • skewX() • skewY() • skew() • matrix() Output
  • 20. • CSS3 allows animation of HTML elements without using JavaScript or Flash. • Properties of Animations are: • @keyframes • animation-name • animation-duration • animation-delay • animation-iteration-count • animation-direction • animation-timing-function • animation-fill-mode Output
  • 21. MU Exam Questions May 2017 • Explain how to design a responsive web with HTML5 and CSS. 10 marks Dec 2018 • Explain in detail Responsive web design with an example. 10 marks • What are major differences between CSS3 and CSS2. 10 marks May 2019 • Explain in detail Responsive web design using HTML5 and CSS3 with an example. 10 marks • Create a web page to show how you can apply the transformation effects so that the image rotates by 150 degree. Assume suitable parameters if required. 10 marks