SlideShare a Scribd company logo
Introduction to CSS By Programme Blog
http://programmerblog.net/
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 What is CSS?
 CSS stands for Cascading Style Sheets
 Styles define how to display HTML elements
 Styles were added to HTML 4.0 to solve a problem
 External Style Sheets can save a lot of work
 External Style Sheets are stored in CSS files.
 HTML was never intended to contain tags for formatting a document.
 HTML was intended to define the content of a document, like:
 <h1>This is a heading</h1>
 <p>This is a paragraph.</p>
 When tags like <font>, and color attributes were added to the HTML 3.2 specification.
 Development of large web sites, where fonts and color information were added to every
single page, became a long and expensive process.
 To solve this problem, the World Wide Web Consortium (W3C) created CSS.
 CSS Syntax
 A CSS rule has two main parts: a selector, and one or more declarations:
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 CSS declarations always ends with a semicolon, and declaration groups are surrounded by
curly brackets:
 p { color:red; text-align:center; }
 p
{
color:red;
text-align:center;
}
 The id and class Selectors
 The id Selector
 The id selector is used to specify a style for a single, unique element.
 The style rule below will be applied to the element with id="para1":
 The id selector uses the id attribute of the HTML element, and is defined with a "#".
 #para1
{
text-align:center;
color:red;
}
 Note: Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.
 The class Selector
 The class selector is used to specify a style for a group of elements. Unlike the id selector,
the class selector is most often used on several elements.
 This allows you to set a particular style for any HTML elements with the same class.
 The class selector uses the HTML class attribute, and is defined with a "."
 In the example below, all HTML elements with class="center" will be center-aligned:
 Example
 .center { text-align:center; }
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 You can also specify that only specific HTML elements should be affected by a
class.
 In the example below, all p elements with class="center" will be center-aligned:
 p.center { text-align:center; }
 Note: Do NOT start a class name with a number! This is only supported in Internet Explorer.
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 Where CSS Fits In Page
 Three Ways to Insert CSS
 There are three ways of inserting a style sheet:
 External style sheet
 Internal style sheet
 Inline style
 External Style Sheet
 An external style sheet is ideal when the style is applied to many pages. With an
external style sheet, you can change the look of an entire Web site by changing
one file. Each page must link to the style sheet using the <link> tag. The <link>
tag goes inside the head section:
 <head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
</head>
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 An external style sheet can be written in any text editor.
 The file should not contain any html tags.
 Your style sheet should be saved with a .css extension. An example of a style
sheet file is shown below:
 hr { color:sienna; }
p { margin-left:20px; }
body { background-image:url("images/back40.gif"); }
 Internal Style Sheet
 An internal style sheet should be used when a single document has a unique style. You
define internal styles in the head section of an HTML page, by using the <style> tag, like
this:
 <head>
<style type="text/css">
hr { color:sienna; }
p { margin-left:20px; }
body { background-image:url("images/back40.gif"); }
</style>
</head>
 Inline Styles
 An inline style loses many of the advantages of style sheets by mixing content
with presentation. Use this method sparingly!
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 To use inline styles you use the style attribute in the relevant tag. The style
attribute can contain any CSS property. The example shows how to change the
color and the left margin of a paragraph:
 <p style="color:sienna;margin-left:20px">This is a paragraph.</p>
 Multiple Style Sheets
 If some properties have been set for the same selector in different style sheets, the values
will be inherited from the more specific style sheet.
 For example, an external style sheet has these properties for the h3 selector:
 h3
{ color:red; text-align:left; font-size:8pt; }
And an internal style sheet has these properties for the h3 selector:
 h3
{ text-align:right; font-size:20pt; }
 If the page with the internal style sheet also links to the external style sheet the properties for
h3 will be:
 color:red;
text-align:right;
font-size:20pt;
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 Cascading order
 What style will be used when there is more than one style specified for an HTML
element?
 Generally speaking we can say that all the styles will "cascade" into a new
"virtual" style sheet by the following rules, where number four has the highest
priority:
 Browser default
 External style sheet
 Internal style sheet (in the head section)
 Inline style (inside an HTML element)
 So, an inline style (inside an HTML element) has the highest priority, which
means that it will override a style defined inside the <head> tag, or in an external
style sheet, or in a browser (a default value).
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 CSS Styling
 CSS background properties are used to define the background effects of an element.
 CSS properties used for background effects:
 background-color
 background-image
 background-repeat
 background-attachment
 background-position
 name - a color name, like "red"
 RGB - an RGB value, like "rgb(255,0,0)"
 Hex - a hex value, like "#ff0000"
 h1 { background-color:#6495ed; }
p { background-color:#e0ffff; }
div { background-color:#b0c4de; }
 body { background-image:url('bgdesert.jpg'); }
 background-repeat:no-repeat; OR repeat-x OR repeat-y
 Short - Hand for Background
 body { background:#ffffff url('img_tree.png') no-repeat right top; }
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 Text Color
 body { color:blue; }
 Text Alignment
 h1 { text-align:center ;}
 Text Decoration
 The text-decoration property is mostly used to remove underlines from links for design
purposes.
 a { text-decoration:none; }
 Text Transformation
 Text Indentation
 The text-indentation property is used to specify the indentation of the first line of a text.
 p { text-indent:50px; }
 CSS- FONT
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 CSS Font Families
 In CSS, there are two types of font family names:
 generic family - a group of font families with a similar look (like "Serif" or "Monospace")
 font family - a specific font family (like "Times New Roman" or "Arial")
 p{ font-family:"Times New Roman", Times, serif; }
 p.normal { font-style:normal; }
 h1 { font-size:40px; }
 Styling Links
 Links can be styled with any CSS property (e.g. color, font-family, background, etc.).
 The four links states are:
 a:link - a normal, unvisited link
 a:visited - a link the user has visited
 a:hover - a link when the user mouses over it
 a:active - a link the moment it is clicked
 a:link { color:#FF0000; } /* unvisited link */
a:visited { color:#00FF00; } /* visited link */
a:hover { color:#FF00FF; } /* mouse over link */
a:active { color:#0000FF; } /* selected link */
 a:visited { text-decoration:none; }
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 CSS Tables
 Table Borders

To specify table borders in CSS, use the border property.
 table, th, td {
border: 1px solid black; }
 Table will have double borders. This is because both the table, th, and td elements have
separate borders.
 Collapse Borders
 The border-collapse property sets whether the table borders are collapsed into a single
border or separated: table
{
border-collapse:collapse;
}
table,th, td
{
border: 1px solid black;
}
 Table Width and Height
 Width and height of a table is defined by the width and height properties.
 table { width:100%; }
th { height:50px; }
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
 Table Text Alignment
 The text in a table is aligned with the text-align and vertical-align properties.
 td { text-align:right; }
 Table Color & Table Padding
 td
{ padding:15px; }
 table, td, th
{
border:1px solid green;
}
th
{
background-color:green;
color:white;
}
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
Thank you for viewing this slide.
Hope this is helpful for you.
Please visit our blog
http://programmerblog.net/
Follow us on twitter https://twitter.com/progblogdotnet/
By ProgrammerBlog.net
http://programmerblog.net/
CSS – Cascading Style Sheets
By Programmer Blog http://programmerblog.net/
Ad

More Related Content

What's hot (20)

An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
Fahim Abdullah
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Amit Tyagi
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
Sanjeev Kumar
 
Css notes
Css notesCss notes
Css notes
Computer Hardware & Trouble shooting
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
WordPress Memphis
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
Css introduction
Css introductionCss introduction
Css introduction
Sridhar P
 
Css
CssCss
Css
Hemant Saini
 
Css
CssCss
Css
jayakarthi
 
CSS
CSSCSS
CSS
People Strategists
 
Css Basics
Css BasicsCss Basics
Css Basics
Jay Patel
 
HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!
Syahmi RH
 
CSS Refresher
CSS RefresherCSS Refresher
CSS Refresher
Gerson Abesamis
 
CSS notes
CSS notesCSS notes
CSS notes
Rajendra Prasad
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1
Gheyath M. Othman
 
html-css
html-csshtml-css
html-css
Dhirendra Chauhan
 
Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3
Gheyath M. Othman
 
HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1
Sanjeev Kumar
 
Css module1
Css module1Css module1
Css module1
VARSHAKUMARI49
 

Similar to Introduction to css by programmerblog.net (20)

Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Folasade Adedeji
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
Tesfaye Yenealem
 
css-ppt.pdf
css-ppt.pdfcss-ppt.pdf
css-ppt.pdf
EktaDesai14
 
CSCADING style sheet. Internal external inline
CSCADING style sheet. Internal external inlineCSCADING style sheet. Internal external inline
CSCADING style sheet. Internal external inline
Ranjeet Reddy
 
cdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdf
cdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdfcdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdf
cdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdf
hinalsomani93
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
Joseph Gabriel
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)
Rafi Haidari
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptIP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).ppt
kassahungebrie
 
Web - CSS 1.pptx
Web - CSS 1.pptxWeb - CSS 1.pptx
Web - CSS 1.pptx
haroon451422
 
Cascading style sheet, CSS Box model, Table in CSS
Cascading style sheet, CSS Box model, Table in CSSCascading style sheet, CSS Box model, Table in CSS
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
 
CSS
CSSCSS
CSS
DivyaKS12
 
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
Unitegergergegegegetgegegegegegeg-2-CSS.pptxUnitegergergegegegetgegegegegegeg-2-CSS.pptx
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
VikasTuwar1
 
HTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptxHTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptx
JJFajardo1
 
Css
CssCss
Css
actacademy
 
Css
CssCss
Css
actacademy
 
v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptxv5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptxv5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smithaps4
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
Tesfaye Yenealem
 
CSCADING style sheet. Internal external inline
CSCADING style sheet. Internal external inlineCSCADING style sheet. Internal external inline
CSCADING style sheet. Internal external inline
Ranjeet Reddy
 
cdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdf
cdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdfcdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdf
cdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdf
hinalsomani93
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)
Rafi Haidari
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptIP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).ppt
kassahungebrie
 
Cascading style sheet, CSS Box model, Table in CSS
Cascading style sheet, CSS Box model, Table in CSSCascading style sheet, CSS Box model, Table in CSS
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
 
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
Unitegergergegegegetgegegegegegeg-2-CSS.pptxUnitegergergegegegetgegegegegegeg-2-CSS.pptx
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
VikasTuwar1
 
HTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptxHTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptx
JJFajardo1
 
v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptxv5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptxv5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smithaps4
 
Ad

Recently uploaded (19)

highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
Ad

Introduction to css by programmerblog.net

  • 1. Introduction to CSS By Programme Blog http://programmerblog.net/
  • 2. CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/  What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added to HTML 4.0 to solve a problem  External Style Sheets can save a lot of work  External Style Sheets are stored in CSS files.  HTML was never intended to contain tags for formatting a document.  HTML was intended to define the content of a document, like:  <h1>This is a heading</h1>  <p>This is a paragraph.</p>  When tags like <font>, and color attributes were added to the HTML 3.2 specification.  Development of large web sites, where fonts and color information were added to every single page, became a long and expensive process.  To solve this problem, the World Wide Web Consortium (W3C) created CSS.  CSS Syntax  A CSS rule has two main parts: a selector, and one or more declarations:
  • 3. CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/  CSS declarations always ends with a semicolon, and declaration groups are surrounded by curly brackets:  p { color:red; text-align:center; }  p { color:red; text-align:center; }
  • 4.  The id and class Selectors  The id Selector  The id selector is used to specify a style for a single, unique element.  The style rule below will be applied to the element with id="para1":  The id selector uses the id attribute of the HTML element, and is defined with a "#".  #para1 { text-align:center; color:red; }  Note: Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.  The class Selector  The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements.  This allows you to set a particular style for any HTML elements with the same class.  The class selector uses the HTML class attribute, and is defined with a "."  In the example below, all HTML elements with class="center" will be center-aligned:  Example  .center { text-align:center; } CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 5.  You can also specify that only specific HTML elements should be affected by a class.  In the example below, all p elements with class="center" will be center-aligned:  p.center { text-align:center; }  Note: Do NOT start a class name with a number! This is only supported in Internet Explorer. CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 6.  Where CSS Fits In Page  Three Ways to Insert CSS  There are three ways of inserting a style sheet:  External style sheet  Internal style sheet  Inline style  External Style Sheet  An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section:  <head> <link rel="stylesheet" type="text/css" href="mystyle.css" /> </head> CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 7.  An external style sheet can be written in any text editor.  The file should not contain any html tags.  Your style sheet should be saved with a .css extension. An example of a style sheet file is shown below:  hr { color:sienna; } p { margin-left:20px; } body { background-image:url("images/back40.gif"); }  Internal Style Sheet  An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section of an HTML page, by using the <style> tag, like this:  <head> <style type="text/css"> hr { color:sienna; } p { margin-left:20px; } body { background-image:url("images/back40.gif"); } </style> </head>  Inline Styles  An inline style loses many of the advantages of style sheets by mixing content with presentation. Use this method sparingly! CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 8.  To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a paragraph:  <p style="color:sienna;margin-left:20px">This is a paragraph.</p>  Multiple Style Sheets  If some properties have been set for the same selector in different style sheets, the values will be inherited from the more specific style sheet.  For example, an external style sheet has these properties for the h3 selector:  h3 { color:red; text-align:left; font-size:8pt; } And an internal style sheet has these properties for the h3 selector:  h3 { text-align:right; font-size:20pt; }  If the page with the internal style sheet also links to the external style sheet the properties for h3 will be:  color:red; text-align:right; font-size:20pt; CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 9.  Cascading order  What style will be used when there is more than one style specified for an HTML element?  Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority:  Browser default  External style sheet  Internal style sheet (in the head section)  Inline style (inside an HTML element)  So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style defined inside the <head> tag, or in an external style sheet, or in a browser (a default value). CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 10.  CSS Styling  CSS background properties are used to define the background effects of an element.  CSS properties used for background effects:  background-color  background-image  background-repeat  background-attachment  background-position  name - a color name, like "red"  RGB - an RGB value, like "rgb(255,0,0)"  Hex - a hex value, like "#ff0000"  h1 { background-color:#6495ed; } p { background-color:#e0ffff; } div { background-color:#b0c4de; }  body { background-image:url('bgdesert.jpg'); }  background-repeat:no-repeat; OR repeat-x OR repeat-y  Short - Hand for Background  body { background:#ffffff url('img_tree.png') no-repeat right top; } CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 11.  Text Color  body { color:blue; }  Text Alignment  h1 { text-align:center ;}  Text Decoration  The text-decoration property is mostly used to remove underlines from links for design purposes.  a { text-decoration:none; }  Text Transformation  Text Indentation  The text-indentation property is used to specify the indentation of the first line of a text.  p { text-indent:50px; }  CSS- FONT CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 12.  CSS Font Families  In CSS, there are two types of font family names:  generic family - a group of font families with a similar look (like "Serif" or "Monospace")  font family - a specific font family (like "Times New Roman" or "Arial")  p{ font-family:"Times New Roman", Times, serif; }  p.normal { font-style:normal; }  h1 { font-size:40px; }  Styling Links  Links can be styled with any CSS property (e.g. color, font-family, background, etc.).  The four links states are:  a:link - a normal, unvisited link  a:visited - a link the user has visited  a:hover - a link when the user mouses over it  a:active - a link the moment it is clicked  a:link { color:#FF0000; } /* unvisited link */ a:visited { color:#00FF00; } /* visited link */ a:hover { color:#FF00FF; } /* mouse over link */ a:active { color:#0000FF; } /* selected link */  a:visited { text-decoration:none; } CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 13.  CSS Tables  Table Borders  To specify table borders in CSS, use the border property.  table, th, td { border: 1px solid black; }  Table will have double borders. This is because both the table, th, and td elements have separate borders.  Collapse Borders  The border-collapse property sets whether the table borders are collapsed into a single border or separated: table { border-collapse:collapse; } table,th, td { border: 1px solid black; }  Table Width and Height  Width and height of a table is defined by the width and height properties.  table { width:100%; } th { height:50px; } CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 14.  Table Text Alignment  The text in a table is aligned with the text-align and vertical-align properties.  td { text-align:right; }  Table Color & Table Padding  td { padding:15px; }  table, td, th { border:1px solid green; } th { background-color:green; color:white; } CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/
  • 15. Thank you for viewing this slide. Hope this is helpful for you. Please visit our blog http://programmerblog.net/ Follow us on twitter https://twitter.com/progblogdotnet/ By ProgrammerBlog.net http://programmerblog.net/ CSS – Cascading Style Sheets By Programmer Blog http://programmerblog.net/