SlideShare a Scribd company logo
1 of 36
INTERNET
PROGRAMMING
CSS3
Cascading Style Sheet
Cascading Style Sheets
• allows you to specify the presentation of elements on a web page
(e.g., fonts, spacing, sizes, colors, positioning) separately from the
document’s structure and content (section headers, body text, links,
etc.).
• simplifies maintaining and modifying web pages, especially on large-
scale websites.
Inline Styles
• We can declare document styles
inline in the HTML5 markup, in
embedded style sheets or in
separate CSS files.
• inline styles declare an individual
element’s format using theHTML5
attribute style.
• Inline styles override any other
styles applied.
• Line 20 specifies the two
properties, font-size and color,
separated by a semicolon.
• Figure 4.2 contains the HTML
standard color set.
Embedded Style Sheets
• A second technique for using style sheets is embedded style sheets.
• enable you to embed a CSS3 document in an HTML5 document’s head
section.
The style Element and MIME Types
• The style element defines the embedded style sheet.
• Styles placed in the head apply to matching elements wherever they
appear in the body.
• The style element’s type attribute specifies the MIME (Multipurpose
Internet Mail Extensions) type that describes the style element’s content.
• Figure 4.4 lists some common MIME types used.
• first rule begins with the selector em, which selects all em elements
in the document.
• An em element indicates that its contents should be emphasized.
• Browsers usually render em elements in an italic font.
• Each rule’s body is enclosed in curly braces ({ and }).
• The property name is followed by a colon (:) and the property value.
Multiple properties are separated by semicolons (;).
• The font-weight property possible values are bold, normal (the
default), bolder (bolder than bold text) and lighter (lighter than
normal text).
Style Classes
• Line 17 declares a selector for a style class named special.
• Style-class declarations are preceded by a period (.).
font-family Property
• The font-family property (line 14) specifies the name of the font to
use.
• CSS allows you to specify a comma-separated list of fonts to use for a
particular style.
font-size Property
• Property font-size (line 15) specifies a 12-point font.
• Generally, relative font-size values are preferred over points, because
an author does not know the specific measurements of each client’s
display.
• Relative values permit more flexible viewing of web pages.
• A user may view a web page on a handheld device with a small
screen.
Applying a Style Class
• Line 22 uses the HTML5 attribute class in an h1 element to apply a
style class.
• When the browser renders the h1 element, the text appears on
screen with the properties of both an h1 element and the .special
style class applied.
Linking External Style Sheets
• With external style sheets (i.e., separate documents that contain only
CSS rules), you can provide a uniform look and feel to an entire website
(or to a portion of one).
• You can also reuse the same external style sheet across multiple
websites.
• Different pages on a site can all use the same style sheet.
• When changes to the styles are required, you need to modify only a
single CSS file to make style changes across all the pages that use those
styles. This concept is sometimes known as skinning.
Positioning Elements: Absolute Positioning, z-index
• Before CSS, controlling element positioning in HTML documents was
difficult—the browser determined positioning.
• CSS introduced the position property and a capability called absolute
positioning, which gives you greater control over how document
elements are displayed.
• The z-index property allows you
to layer overlapping elements.
• Elements that have higher z-
index values are displayed in
front of elements with lower z-
index values.
• If you do not specify a z-index or
if elements have the same z-
index value, the elements are
placed from background to
foreground in the order in which
they’re encountered in the
document.
• The default z-index value is 0.
Positioning Elements: Relative Positioning, span
• Setting the position property to relative, as in class super (lines 15–
16), lays out the element on the page and offsets it by the specified
top, bottom, left or right value.
• Class super (lines 15–16) lays out the text at the end of the sentence
as superscript and Class sub (lines 17–18) lays out the text as
subscript relative to the other text.
• Class shiftleft (lines 19–20) shifts the text at the end of the sentence
left and Class shiftright (lines 21–22) shifts the text right.
• The span’s height determines how much vertical space it will occupy.
• The font-size determines the size of the text inside the span.
• Element span is a grouping element—by default, it does not apply
any formatting to its contents. Its primary purpose is to apply CSS
rules or id attributes to a section of text.
• Element span is an inline-level element—it does not change the flow
of elements in the document.
• Examples of inline elements include span, img, a, em and strong.
Backgrounds
• CSS provides control over the
backgrounds of block-level elements.
• CSS can set a background color or add
background images to HTML5
elements.
• Figure 4.11 adds a corporate logo to
the bottom-right corner of the
document.
• This logo stays fixed in the corner even
when the user scrolls up or down the
screen.
background-image Property
• specifies the image URL for the image logo.png in the format url(fileLocation).
background-position Property
• places the image on the page.
• The keywords top, bottom, center, left and right are used individually or in
combination for vertical and horizontal positioning.
background-repeat Property
• controls background image tiling, which places multiple copies of the image
next to each other to fill the background.
• Other values include
• repeat (the default) to tile the image vertically and horizontally, repeat-x to
tile the
• image only horizontally or repeat-y to tile the image only vertically.
background-attachment: fixed Property
• background-attachment: fixed , fixes the image in the position
specified by background-position.
• Scrolling the browser window will not move the image from its
position. Default value is scroll.
font-style property
• to indent the first line of text in the element by a specified amount, in
this case 1em.
text-indent property
• allows you to set text to none, italic or oblique
Element Dimensions
• CSS rules can specify the actual dimensions of each page element.
• Specifying the width and height of an Element
 width of an element on screen should occupy 20 percent of the screen width.
 The height of an element can be set similarly, using the height property.
 This works only for block-level elements.
• text-align Property
 Most elements are left-aligned by default, but this alignment can be altered.
 values for the text-align property include center-aligned, left and right.
• overflow Property and Scroll Bars
 One problem with setting both dimensions of an element is that the content
inside the element can exceed the set boundaries.
 we set the overflow property to scroll, a setting that adds scroll bars if the text
overflows the boundaries.
Box Model and Text Flow
• All block-level HTML5 elements have a virtual box drawn around
them, based on what is known as the box model.
• When the browser renders an element using the box model, the
content is surrounded by padding, a border and a margin (Fig. 4.13).
• CSS controls the border using three properties: border-width, border-
color and border-style.
• The border-width property may be set to any valid CSS length (e.g.,
em, ex, px) or to the predefined value of thin, medium or thick.
• The border-color property sets the color.
• The border-style options are none, hidden, dotted, dashed, solid,
double, groove, ridge, inset and outset.
Drop-Down Menus
• Drop-down menus are a good way to provide navigation links without
using a lot of screen space.
• The :hover pseudo-class used to change a link’s style when the mouse
hovers over it.
• The display property allows you to decide whether an element is
rendered on the page or not.
• Possible values include block, inline and none.
• The block and inline values display the element as a block element or
an inline element, while none stops the element from being
rendered.
Text Shadows
• The CSS3 text-shadow property has four values: -4px, 4px, 6px and
DimGrey, which represent:
 Horizontal offset of the shadow—the number of pixels that the text-shadow
will appear to the left or the right of the text. A negative value moves the text-
shadow to the left; a positive value moves it to the right.
 Vertical offset of the shadow—the number of pixels that the text-shadow will be
shifted up or down from the text. A negative value moves the shadow up,
whereas a positive value moves it down.
 blur radius—the blur (in pixels) of the shadow. A blur-radius of 0px would
result in a shadow with a sharp edge (no blur). The greater the value, the
greater the blurring of the edges.
 color—determines the color of the text-shadow.
Rounded Corners
• allows you to add rounded corners to an element.
• Solid Navy borders adds slightly rounded corners to the rectangle.
• We increase the border-radius to 50px, making the left and right sides
completely round.
• We can also specify the radius for each corner with border-top-left-
radius, border-top-right-radius, border-bottom- left-radius and
border-bottom-right-radius.
Color
• CSS3 allows you to express color in several ways in addition to
standard color names (such as Aqua) or hexadecimal RGB values
(such as #00FFFF for Aqua).
• RGB (Red, Green, Blue) or RGBA (Red, Green, Blue, Alpha) gives you
greater control over the exact colors in your web pages.
• The value for each color—red, green and blue—can range from 0 to
255.
• The alpha value—which represents opacity—can be any value in the
range 0.0 (fully transparent) through 1.0 (fully opaque).
background: rgba(255, 0, 0, 0.5);
• CSS3 also allows you to express color using HSL (hue, saturation,
lightness) or HSLA (hue, saturation, lightness, alpha) values.
• The hue is a color or shade expressed as a value from 0 to 359
representing the degrees on a color wheel (a wheel is 360 degrees).
• The colors on the wheel progress in the order of the colors of the
rainbow—red, orange, yellow, green, blue, indigo and violet.
• The saturation— the intensity of the hue—is expressed as a
percentage, where 100% is fully saturated (the full color) and 0% is
gray.
• Lightness—the intensity of light or luminance of the hue— is also
expressed as a percentage.
background: hsla(0, 100%, 50%, 0.5);
• The resulting color would be a half-opaque red.

More Related Content

Similar to css3.pptx

Journey To The Front End World - Part2 - The Cosmetic
Journey To The Front End World - Part2 - The  CosmeticJourney To The Front End World - Part2 - The  Cosmetic
Journey To The Front End World - Part2 - The CosmeticIrfan Maulana
 
Unit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptxUnit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptxTanu524249
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1jeweltutin
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learnerYoeung Vibol
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfelayelily
 
Understanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company indiaUnderstanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company indiaJignesh Aakoliya
 
CSS3 basics for beginners - Imrokraft
CSS3 basics for beginners - ImrokraftCSS3 basics for beginners - Imrokraft
CSS3 basics for beginners - Imrokraftimrokraft
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxkarthiksmart21
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheetMichael Jhon
 
Webpage style with CSS
Webpage style with CSSWebpage style with CSS
Webpage style with CSSHemant Patidar
 

Similar to css3.pptx (20)

Journey To The Front End World - Part2 - The Cosmetic
Journey To The Front End World - Part2 - The  CosmeticJourney To The Front End World - Part2 - The  Cosmetic
Journey To The Front End World - Part2 - The Cosmetic
 
Css
CssCss
Css
 
CSS
CSSCSS
CSS
 
Unit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptxUnit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptx
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1
 
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
 
Introduction 2 css
Introduction 2 cssIntroduction 2 css
Introduction 2 css
 
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
 
Understanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company indiaUnderstanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company india
 
CSS3 basics for beginners - Imrokraft
CSS3 basics for beginners - ImrokraftCSS3 basics for beginners - Imrokraft
CSS3 basics for beginners - Imrokraft
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
 
CSS
CSSCSS
CSS
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Basic css
Basic cssBasic css
Basic css
 
Html
HtmlHtml
Html
 
Webpage style with CSS
Webpage style with CSSWebpage style with CSS
Webpage style with CSS
 

Recently uploaded

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Recently uploaded (20)

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

css3.pptx

  • 2. Cascading Style Sheets • allows you to specify the presentation of elements on a web page (e.g., fonts, spacing, sizes, colors, positioning) separately from the document’s structure and content (section headers, body text, links, etc.). • simplifies maintaining and modifying web pages, especially on large- scale websites.
  • 3. Inline Styles • We can declare document styles inline in the HTML5 markup, in embedded style sheets or in separate CSS files. • inline styles declare an individual element’s format using theHTML5 attribute style. • Inline styles override any other styles applied. • Line 20 specifies the two properties, font-size and color, separated by a semicolon. • Figure 4.2 contains the HTML standard color set.
  • 4.
  • 5. Embedded Style Sheets • A second technique for using style sheets is embedded style sheets. • enable you to embed a CSS3 document in an HTML5 document’s head section.
  • 6.
  • 7. The style Element and MIME Types • The style element defines the embedded style sheet. • Styles placed in the head apply to matching elements wherever they appear in the body. • The style element’s type attribute specifies the MIME (Multipurpose Internet Mail Extensions) type that describes the style element’s content. • Figure 4.4 lists some common MIME types used.
  • 8. • first rule begins with the selector em, which selects all em elements in the document. • An em element indicates that its contents should be emphasized. • Browsers usually render em elements in an italic font. • Each rule’s body is enclosed in curly braces ({ and }). • The property name is followed by a colon (:) and the property value. Multiple properties are separated by semicolons (;). • The font-weight property possible values are bold, normal (the default), bolder (bolder than bold text) and lighter (lighter than normal text).
  • 9. Style Classes • Line 17 declares a selector for a style class named special. • Style-class declarations are preceded by a period (.). font-family Property • The font-family property (line 14) specifies the name of the font to use. • CSS allows you to specify a comma-separated list of fonts to use for a particular style.
  • 10. font-size Property • Property font-size (line 15) specifies a 12-point font. • Generally, relative font-size values are preferred over points, because an author does not know the specific measurements of each client’s display. • Relative values permit more flexible viewing of web pages. • A user may view a web page on a handheld device with a small screen.
  • 11. Applying a Style Class • Line 22 uses the HTML5 attribute class in an h1 element to apply a style class. • When the browser renders the h1 element, the text appears on screen with the properties of both an h1 element and the .special style class applied.
  • 12. Linking External Style Sheets • With external style sheets (i.e., separate documents that contain only CSS rules), you can provide a uniform look and feel to an entire website (or to a portion of one). • You can also reuse the same external style sheet across multiple websites. • Different pages on a site can all use the same style sheet. • When changes to the styles are required, you need to modify only a single CSS file to make style changes across all the pages that use those styles. This concept is sometimes known as skinning.
  • 13.
  • 14. Positioning Elements: Absolute Positioning, z-index • Before CSS, controlling element positioning in HTML documents was difficult—the browser determined positioning. • CSS introduced the position property and a capability called absolute positioning, which gives you greater control over how document elements are displayed.
  • 15.
  • 16. • The z-index property allows you to layer overlapping elements. • Elements that have higher z- index values are displayed in front of elements with lower z- index values. • If you do not specify a z-index or if elements have the same z- index value, the elements are placed from background to foreground in the order in which they’re encountered in the document. • The default z-index value is 0.
  • 17. Positioning Elements: Relative Positioning, span • Setting the position property to relative, as in class super (lines 15– 16), lays out the element on the page and offsets it by the specified top, bottom, left or right value. • Class super (lines 15–16) lays out the text at the end of the sentence as superscript and Class sub (lines 17–18) lays out the text as subscript relative to the other text. • Class shiftleft (lines 19–20) shifts the text at the end of the sentence left and Class shiftright (lines 21–22) shifts the text right. • The span’s height determines how much vertical space it will occupy. • The font-size determines the size of the text inside the span.
  • 18.
  • 19. • Element span is a grouping element—by default, it does not apply any formatting to its contents. Its primary purpose is to apply CSS rules or id attributes to a section of text. • Element span is an inline-level element—it does not change the flow of elements in the document. • Examples of inline elements include span, img, a, em and strong.
  • 20. Backgrounds • CSS provides control over the backgrounds of block-level elements. • CSS can set a background color or add background images to HTML5 elements. • Figure 4.11 adds a corporate logo to the bottom-right corner of the document. • This logo stays fixed in the corner even when the user scrolls up or down the screen.
  • 21.
  • 22. background-image Property • specifies the image URL for the image logo.png in the format url(fileLocation). background-position Property • places the image on the page. • The keywords top, bottom, center, left and right are used individually or in combination for vertical and horizontal positioning. background-repeat Property • controls background image tiling, which places multiple copies of the image next to each other to fill the background. • Other values include • repeat (the default) to tile the image vertically and horizontally, repeat-x to tile the • image only horizontally or repeat-y to tile the image only vertically.
  • 23. background-attachment: fixed Property • background-attachment: fixed , fixes the image in the position specified by background-position. • Scrolling the browser window will not move the image from its position. Default value is scroll. font-style property • to indent the first line of text in the element by a specified amount, in this case 1em. text-indent property • allows you to set text to none, italic or oblique
  • 24. Element Dimensions • CSS rules can specify the actual dimensions of each page element. • Specifying the width and height of an Element  width of an element on screen should occupy 20 percent of the screen width.  The height of an element can be set similarly, using the height property.  This works only for block-level elements. • text-align Property  Most elements are left-aligned by default, but this alignment can be altered.  values for the text-align property include center-aligned, left and right. • overflow Property and Scroll Bars  One problem with setting both dimensions of an element is that the content inside the element can exceed the set boundaries.  we set the overflow property to scroll, a setting that adds scroll bars if the text overflows the boundaries.
  • 25.
  • 26. Box Model and Text Flow • All block-level HTML5 elements have a virtual box drawn around them, based on what is known as the box model. • When the browser renders an element using the box model, the content is surrounded by padding, a border and a margin (Fig. 4.13). • CSS controls the border using three properties: border-width, border- color and border-style.
  • 27.
  • 28. • The border-width property may be set to any valid CSS length (e.g., em, ex, px) or to the predefined value of thin, medium or thick. • The border-color property sets the color. • The border-style options are none, hidden, dotted, dashed, solid, double, groove, ridge, inset and outset.
  • 29. Drop-Down Menus • Drop-down menus are a good way to provide navigation links without using a lot of screen space. • The :hover pseudo-class used to change a link’s style when the mouse hovers over it. • The display property allows you to decide whether an element is rendered on the page or not. • Possible values include block, inline and none. • The block and inline values display the element as a block element or an inline element, while none stops the element from being rendered.
  • 30.
  • 31. Text Shadows • The CSS3 text-shadow property has four values: -4px, 4px, 6px and DimGrey, which represent:  Horizontal offset of the shadow—the number of pixels that the text-shadow will appear to the left or the right of the text. A negative value moves the text- shadow to the left; a positive value moves it to the right.  Vertical offset of the shadow—the number of pixels that the text-shadow will be shifted up or down from the text. A negative value moves the shadow up, whereas a positive value moves it down.  blur radius—the blur (in pixels) of the shadow. A blur-radius of 0px would result in a shadow with a sharp edge (no blur). The greater the value, the greater the blurring of the edges.  color—determines the color of the text-shadow.
  • 32.
  • 33. Rounded Corners • allows you to add rounded corners to an element. • Solid Navy borders adds slightly rounded corners to the rectangle. • We increase the border-radius to 50px, making the left and right sides completely round. • We can also specify the radius for each corner with border-top-left- radius, border-top-right-radius, border-bottom- left-radius and border-bottom-right-radius.
  • 34.
  • 35. Color • CSS3 allows you to express color in several ways in addition to standard color names (such as Aqua) or hexadecimal RGB values (such as #00FFFF for Aqua). • RGB (Red, Green, Blue) or RGBA (Red, Green, Blue, Alpha) gives you greater control over the exact colors in your web pages. • The value for each color—red, green and blue—can range from 0 to 255. • The alpha value—which represents opacity—can be any value in the range 0.0 (fully transparent) through 1.0 (fully opaque). background: rgba(255, 0, 0, 0.5); • CSS3 also allows you to express color using HSL (hue, saturation, lightness) or HSLA (hue, saturation, lightness, alpha) values. • The hue is a color or shade expressed as a value from 0 to 359 representing the degrees on a color wheel (a wheel is 360 degrees).
  • 36. • The colors on the wheel progress in the order of the colors of the rainbow—red, orange, yellow, green, blue, indigo and violet. • The saturation— the intensity of the hue—is expressed as a percentage, where 100% is fully saturated (the full color) and 0% is gray. • Lightness—the intensity of light or luminance of the hue— is also expressed as a percentage. background: hsla(0, 100%, 50%, 0.5); • The resulting color would be a half-opaque red.