SlideShare a Scribd company logo
CSS Introduction 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
CSS Syntax: The selector is normally the HTML element you want to style. Each declaration consists of a property and a value. The property is the style attribute you want to change. Each property has a value. CSS Example p { color:red; text-align:center; }
CSS Id and Class: The id Selector: The id selector is used to specify a style for a single, unique element. The id selector uses the id attribute of the HTML element, and is defined with a "#". The style rule below will be applied to the element with id="para1": #para1 { text-align:center; color:red; }  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: .center {text-align:center;}  You can also specify that only specific HTML elements should be affected by a class. p.center {text-align:center;}
CSS Background: Background Color: body {background-color:#b0c4de;}  In the example below, the h1, p, and div elements have different background colors: The background color of a page is defined in the body selector: h1 {background-color:#6495ed;} p {background-color:#e0ffff;} div {background-color:#b0c4de;} Background Image: The background image for a page can be set like this: body {background-image:url('paper.gif');}  body { background-image:url('gradient2.png'); background-repeat:repeat-x; }  If the image is repeated only horizontally (repeat-x), the background will look better:
CSS Text: Text Color: The default color for a page is defined in the body selector. body {color:blue;} h1 {color:#00ff00;} h2 {color:rgb(255,0,0);} Text Alignment: h1 {text-align:center;} p.date {text-align:right;} p.main {text-align:justify;}  h1 {text-decoration:overline;} h2 {text-decoration:line-through;} h3 {text-decoration:underline;} h4 {text-decoration:blink;} Text Decoration:

More Related Content

PPTX
Cascading style sheet
PPT
Cascading Style Sheet
PPT
CSS
PPTX
Css ppt
PPTX
Css types internal, external and inline (1)
ODP
Introduction to css & its attributes with syntax
Cascading style sheet
Cascading Style Sheet
CSS
Css ppt
Css types internal, external and inline (1)
Introduction to css & its attributes with syntax

What's hot (19)

PPT
CSS Basics
PPTX
Cascading style sheets (CSS)
PPT
Introduction to Cascading Style Sheets (CSS)
PPTX
What is CSS?
PPTX
Beginners css tutorial for web designers
PDF
Basic-CSS-tutorial
PPTX
Introduction to CSS
PPTX
Complete Lecture on Css presentation
PPT
How Cascading Style Sheets (CSS) Works
PPTX
PPTX
CSS Basics
PPT
PPTX
Week 12 CSS - Review from last week
PPTX
Cascading Style Sheet
PPTX
Introducing Cascading Style Sheets
PPTX
css.ppt
PPTX
Cascading Style Sheets (CSS)
CSS Basics
Cascading style sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
What is CSS?
Beginners css tutorial for web designers
Basic-CSS-tutorial
Introduction to CSS
Complete Lecture on Css presentation
How Cascading Style Sheets (CSS) Works
CSS Basics
Week 12 CSS - Review from last week
Cascading Style Sheet
Introducing Cascading Style Sheets
css.ppt
Cascading Style Sheets (CSS)
Ad

Viewers also liked (6)

PPT
Css Ppt
PDF
Css from scratch
PPTX
Cascading Style Sheet (CSS)
PPT
Html & Css presentation
PPTX
Web Engineering - Basic CSS Properties
Css Ppt
Css from scratch
Cascading Style Sheet (CSS)
Html & Css presentation
Web Engineering - Basic CSS Properties
Ad

Similar to Css (20)

ODP
Css.prabu
PPT
cascading style sheet ppt
PPTX
chapter-gesgsdkfhhgagfhagsdhfgdhfdhda3-css .pptx
PPT
PPTX
CSS tutorial chapter 1
PPTX
CSS Basics part One
PPTX
PPT
Basic css
PPTX
v5-introduction to html-css-210321161444.pptx
PPTX
PPT
PPT
Cascading style sheet
PPTX
css3.0.( Cascading Style Sheets ) pptx
PPTX
Embrace the Mullet: CSS is the 'Party in the Back' (a CSS How-to)
Css.prabu
cascading style sheet ppt
chapter-gesgsdkfhhgagfhagsdhfgdhfdhda3-css .pptx
CSS tutorial chapter 1
CSS Basics part One
Basic css
v5-introduction to html-css-210321161444.pptx
Cascading style sheet
css3.0.( Cascading Style Sheets ) pptx
Embrace the Mullet: CSS is the 'Party in the Back' (a CSS How-to)

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
cuic standard and advanced reporting.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
A Presentation on Artificial Intelligence
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Cloud computing and distributed systems.
Mobile App Security Testing_ A Comprehensive Guide.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Understanding_Digital_Forensics_Presentation.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Chapter 3 Spatial Domain Image Processing.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Big Data Technologies - Introduction.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
cuic standard and advanced reporting.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Machine learning based COVID-19 study performance prediction
A Presentation on Artificial Intelligence
Unlocking AI with Model Context Protocol (MCP)
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Monthly Chronicles - July 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

Css

  • 1. CSS Introduction What is CSS? CSS stands for Cascading Style Sheets
  • 2. Styles define how to display HTML elements
  • 3. Styles were added to HTML 4.0 to solve a problem
  • 4. External Style Sheets can save a lot of work
  • 5. External Style Sheets are stored in CSS files
  • 6. CSS Syntax: The selector is normally the HTML element you want to style. Each declaration consists of a property and a value. The property is the style attribute you want to change. Each property has a value. CSS Example p { color:red; text-align:center; }
  • 7. CSS Id and Class: The id Selector: The id selector is used to specify a style for a single, unique element. The id selector uses the id attribute of the HTML element, and is defined with a "#". The style rule below will be applied to the element with id="para1": #para1 { text-align:center; color:red; } 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: .center {text-align:center;} You can also specify that only specific HTML elements should be affected by a class. p.center {text-align:center;}
  • 8. CSS Background: Background Color: body {background-color:#b0c4de;} In the example below, the h1, p, and div elements have different background colors: The background color of a page is defined in the body selector: h1 {background-color:#6495ed;} p {background-color:#e0ffff;} div {background-color:#b0c4de;} Background Image: The background image for a page can be set like this: body {background-image:url('paper.gif');} body { background-image:url('gradient2.png'); background-repeat:repeat-x; } If the image is repeated only horizontally (repeat-x), the background will look better:
  • 9. CSS Text: Text Color: The default color for a page is defined in the body selector. body {color:blue;} h1 {color:#00ff00;} h2 {color:rgb(255,0,0);} Text Alignment: h1 {text-align:center;} p.date {text-align:right;} p.main {text-align:justify;} h1 {text-decoration:overline;} h2 {text-decoration:line-through;} h3 {text-decoration:underline;} h4 {text-decoration:blink;} Text Decoration:
  • 10. CSS Font: Font Family: p{font-family:"Times New Roman", Times, serif;} Font Style: p.normal {font-style:normal;} p.italic {font-style:italic;} p.oblique {font-style:oblique;} Font Size: h1 {font-size:40px;} h2 {font-size:30px;} p {font-size:14px;} Setting the text size with pixels, gives you full control over the text size This property has three values: normal - The text is shown normally italic - The text is shown in italics oblique - The text is "leaning" (oblique is very similar to italic, but less supported)
  • 11. Styling Links: CSS Links: 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 */ Text Decoration: The text-decoration property is mostly used to remove underlines from links: a:link {background-color:#B2FF99;} a:visited {background-color:#FFFF85;} a:hover {background-color:#FF704D;} a:active {background-color:#FF704D;}
  • 12. CSS Lists: List: In HTML, there are two types of lists: Unordered lists - the list items are marked with bullets Ordered lists - the list items are marked with numbers or letters Different List Item Markers: ul.a {list-style-type: circle;} ul.b {list-style-type: square;} ol.c {list-style-type: upper-roman;} ol.d {list-style-type: lower-alpha;} An Image as The List Item Marker: To specify an image as the list item marker, use the list-style-image property: ul { list-style-image: url('sqpurple.gif'); }
  • 13. CSS Tables: Table Borders: table, th, td { border: 1px solid black; } The example below specifies a black border for table, th, and td elements: Table Width and Height: The example below sets the width of the table to 100%, and the height of the th elements to 50px: table { width:100%; } th { height:50px; } Table Text Alignment: td { text-align:right; }