SlideShare a Scribd company logo
1 of 4
Chapter 4: CSS
CSS Properties
There are various properties that can be set for elements in CSS. Some are-
1. Font
2. Color and Background
3. Text
4. Borders
5. Padding
6. Margin
7. Lists
8. Tables
1. Font Properties: CSS provide several properties for styling the font of the text, including
changing their face, controlling their size and boldness and the style of a text etc.
The font-family property lists one or more font families, separated by commas from highest priority
to lowest. There are two types of font family names-
1. Family name
2. Generic family
family-name: The name of a specific font family. For example, Times and Helvetica are font
families. Font family names containing whitespace should be quoted.
Attributes Description Values
Font-family A comma delimited sequence of
font-family names.
Font-family : “Times New Roman”, Garamond,
serif
Font-family : Arial, veranda, Helvetica, sans-serif
Font-style The font-style property allows
specifying the font style the browser
uses to render a character.
normal, italic, oblique
Font-size The font-size property sets the size of
the text.
Absolute size (xx-small, x-small, small,
medium, large x-large, xx-large)
Relative sizes (larger, smaller)
Percentage; relative to the parent value)
Length inherit (inherited from parent)
Font-
weight
The property specifies the weight i.e.,
boldness or lightness of a font.
Normal(=400), bold(=700),
bolder(=900), lighter(=100),
100,200,300,400,500,600,700,800,900
(Here 100 is the thinnest, 900 is the thickest and 400 is the
normal value)
Font-
variant
The font-variant property
specifies how lowercase letters are
displayed.
normal
small-caps:Display lowercase letters with smaller-font
uppercase letters
Chapter 4: CSS
Generic family: A generic font family is used as a general fall back mechanism when an authors
desired font choices are not available. The generic family is added at the last to let the browser
pick a similar font in the generic family if no other fonts are available. They are written in
lowercase and without quotation. Example of generic families are monospace, serif, sans-serif,
cursive , fantasy etc.
PROG-1
<html>
<head>
<style>
.serif {font-family: “Times New Roman”, Times, serif;}
.sansserif {font-family: Arial, Helvetica, sans-serif;}
.monospace {font-family: “Lucida Console”, Courier, monospace;}
</style>
</head>
<body>
<h1>CSS font-family Example</h1>
<p class="serif">This paragraph will be shown in the Times New Roman
font.</p>
<p class="sansserif">This paragraph will be shown in the Arial font.</p>
<p class="monospace">This paragraph will be shown in the Lucida Console
font.</p>
</body>
</html>
2. Color and Background Properties: CSS color and background properties are used to
define the color and background effects for elements.
Attributes Description Values
color Sets an elements text color Colors are specified using predefined
color names, or RGB, HEX, HSL,
RGBA, HSLA values.
Background-
color
Specifies the color in an elements background Same as above
Background-
image
Used to set the background image by the following way
Background-image: url("image.jpg");
Background-
repeat
By default, the background image property repeats an
image both horizontally and vertically. This attribute can
be set up to repeat the image in a customized way
Repeat-x (repeats horizontally)
Repeat-y (repeats vertically)
Output of PROG-1
Chapter 4: CSS
throughout the page.
No repeat.
Background
position
The position of the image is specified by the background-
position property:
left top
left center
left bottom
right top
right center
right bottom
center top
center center
center bottom
PROG-2
<HTML>
<HEAD>
<TITLE> Working with Style Sheets using Color and Background Attributes</TITLE>
<STYLE>
H1 {font-family : Arial, Helvetica, sans-serif; font-size:26pt; background-color : lightblue;}
H2 {font-family : “Lucida Console”, Courier, monospace; font-size : 26pt; background-color
: lightpink;}
Body {background-image : url("block_texture.jpg");}
P {font-size :12pt; font-style: italic; font-weight : bold; color : #23238e; background-color :
red;}
</STYLE>
</HEAD>
<BODY>
<H1> Silicon Chip Technologies</H1>
<P>A private limited company, which was founded in December 1989. The vision of this
company is to provide any corporate client a single entity which addresses all their
Software Development, Technical and User Documentation, Training and Manpower
Recruitment needs. </P></br>
<H2> Silicon Chip Technologies</H2>
</BODY>
</HTML>
Output of PROG-2
Chapter 4: CSS

More Related Content

Similar to CSS properties.docx

Similar to CSS properties.docx (20)

Chapter 12: CSS Part 2
Chapter 12: CSS Part 2Chapter 12: CSS Part 2
Chapter 12: CSS Part 2
 
Introduction 2 css
Introduction 2 cssIntroduction 2 css
Introduction 2 css
 
CSS
CSSCSS
CSS
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
 
CSS Presentation Notes.pptx
CSS Presentation Notes.pptxCSS Presentation Notes.pptx
CSS Presentation Notes.pptx
 
css.docx
css.docxcss.docx
css.docx
 
Web topic 17 font family in css
Web topic 17  font family in cssWeb topic 17  font family in css
Web topic 17 font family in css
 
Cascading style sheet part 2
Cascading style sheet   part 2Cascading style sheet   part 2
Cascading style sheet part 2
 
Css1 properties
Css1 propertiesCss1 properties
Css1 properties
 
Css
CssCss
Css
 
Css
CssCss
Css
 
Intro to css & sass
Intro to css & sassIntro to css & sass
Intro to css & sass
 
Session 3
Session 3Session 3
Session 3
 
Css
CssCss
Css
 
Css ppt
Css pptCss ppt
Css ppt
 
Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
 
Css
CssCss
Css
 
Web Typography
Web TypographyWeb Typography
Web Typography
 
Css Founder.com | Cssfounder in
Css Founder.com | Cssfounder inCss Founder.com | Cssfounder in
Css Founder.com | Cssfounder in
 

Recently uploaded

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 

Recently uploaded (20)

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 

CSS properties.docx

  • 1. Chapter 4: CSS CSS Properties There are various properties that can be set for elements in CSS. Some are- 1. Font 2. Color and Background 3. Text 4. Borders 5. Padding 6. Margin 7. Lists 8. Tables 1. Font Properties: CSS provide several properties for styling the font of the text, including changing their face, controlling their size and boldness and the style of a text etc. The font-family property lists one or more font families, separated by commas from highest priority to lowest. There are two types of font family names- 1. Family name 2. Generic family family-name: The name of a specific font family. For example, Times and Helvetica are font families. Font family names containing whitespace should be quoted. Attributes Description Values Font-family A comma delimited sequence of font-family names. Font-family : “Times New Roman”, Garamond, serif Font-family : Arial, veranda, Helvetica, sans-serif Font-style The font-style property allows specifying the font style the browser uses to render a character. normal, italic, oblique Font-size The font-size property sets the size of the text. Absolute size (xx-small, x-small, small, medium, large x-large, xx-large) Relative sizes (larger, smaller) Percentage; relative to the parent value) Length inherit (inherited from parent) Font- weight The property specifies the weight i.e., boldness or lightness of a font. Normal(=400), bold(=700), bolder(=900), lighter(=100), 100,200,300,400,500,600,700,800,900 (Here 100 is the thinnest, 900 is the thickest and 400 is the normal value) Font- variant The font-variant property specifies how lowercase letters are displayed. normal small-caps:Display lowercase letters with smaller-font uppercase letters
  • 2. Chapter 4: CSS Generic family: A generic font family is used as a general fall back mechanism when an authors desired font choices are not available. The generic family is added at the last to let the browser pick a similar font in the generic family if no other fonts are available. They are written in lowercase and without quotation. Example of generic families are monospace, serif, sans-serif, cursive , fantasy etc. PROG-1 <html> <head> <style> .serif {font-family: “Times New Roman”, Times, serif;} .sansserif {font-family: Arial, Helvetica, sans-serif;} .monospace {font-family: “Lucida Console”, Courier, monospace;} </style> </head> <body> <h1>CSS font-family Example</h1> <p class="serif">This paragraph will be shown in the Times New Roman font.</p> <p class="sansserif">This paragraph will be shown in the Arial font.</p> <p class="monospace">This paragraph will be shown in the Lucida Console font.</p> </body> </html> 2. Color and Background Properties: CSS color and background properties are used to define the color and background effects for elements. Attributes Description Values color Sets an elements text color Colors are specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values. Background- color Specifies the color in an elements background Same as above Background- image Used to set the background image by the following way Background-image: url("image.jpg"); Background- repeat By default, the background image property repeats an image both horizontally and vertically. This attribute can be set up to repeat the image in a customized way Repeat-x (repeats horizontally) Repeat-y (repeats vertically) Output of PROG-1
  • 3. Chapter 4: CSS throughout the page. No repeat. Background position The position of the image is specified by the background- position property: left top left center left bottom right top right center right bottom center top center center center bottom PROG-2 <HTML> <HEAD> <TITLE> Working with Style Sheets using Color and Background Attributes</TITLE> <STYLE> H1 {font-family : Arial, Helvetica, sans-serif; font-size:26pt; background-color : lightblue;} H2 {font-family : “Lucida Console”, Courier, monospace; font-size : 26pt; background-color : lightpink;} Body {background-image : url("block_texture.jpg");} P {font-size :12pt; font-style: italic; font-weight : bold; color : #23238e; background-color : red;} </STYLE> </HEAD> <BODY> <H1> Silicon Chip Technologies</H1> <P>A private limited company, which was founded in December 1989. The vision of this company is to provide any corporate client a single entity which addresses all their Software Development, Technical and User Documentation, Training and Manpower Recruitment needs. </P></br> <H2> Silicon Chip Technologies</H2> </BODY> </HTML> Output of PROG-2