SlideShare a Scribd company logo
Adding Cascading Style Sheets  (CSS) to XHTML Documents
These notes do not contain a complete list of CSS styles.  For further information see http://www.w3schools.com/css/default.asp For validation of your CSS files use http://jigsaw.w3.org/css-validator
Cascading Style Sheets (CSS) were introduced by the W3C in 1996 to provide HTML authors with more control over document formatting CSS style sheets work with XHTML, XML and HTML files and are widely accepted by Web browsers A single style sheet can be used to provide uniform formatting styles to a group of documents CSS files are plain text files and can be edited with a text editor
HTML was never intended to contain tags for formatting documents. It was intended to define the content of a document.  Eg <p>This is the page content </p> When the <font> tags and color attributes were added to the specification in V3.2 it started a nightmare for developers. These tags needed to be added to every single page making them long and expensive to produce. By V4.0 CSS had been developed and all formatting could be removed from the HTML and stored in a separate CSS file.
Why use Style Sheets? Allows the content and formatting of a page to remain separate. Allows for many pages to be formatted the same by using a  single CSS file.  (allows for consistency across a site) Allows you to change the appearance and layout of all the pages of an entire site by editing just one file. A web page can be divided into sections (using <div> tags) Each section can have a different style applied to it, this allows for multiple presentation layouts for a single document Style elements are being deprecated in the XHTML language and will not be available in future versions of XHTML past the 1.0 version
CSS rules consists of two parts: Element selector Properties declarations Above example in a text file: h1{ color:   blue ; font-size:   12px ; } CSS comments: /*  This is a comment  */   For readability the declarations are often written on separate lines
The style sheets are stored in a separate text file from the XHTML document ( with the file extension .css): h1{   color:   blue ;   font-size:   16pt ;   font-family:   arial ; } This code would make any content in a <h1> tag appear blue, arial & 12pt (assume the file is saved as example1.css) The file is attached to the XHTML file using the <link> tag in the header section of the document <link  rel=”stylesheet” href=”example1.css” type=”text/css”  />
Links CSS file Browser view example1.css
mystyles.css browser  view Link to CSS If the CSS file was in a separate folder then  href=“../css/mystyles”
Create the following CSS using Textpad, save it as act_styles.css  Modify your Activity 1 Question 2  XHTML code by linking the CSS file to it and then view in a browser. act_styles.css Browser view of Act1_Q2.html with CSS attached
Edit act_styles.css to add the style for <h2> and <p>  as shown below  Modify your Activity 2 Question 1 XHTML code by linking the CSS file to it and then view in a browser. act_styles.css Browser view of Act2_Q1.html with CSS attached shown next slide Add these }
Browser view of Act2_Q1.html with CSS
color (note American spelling of color) color can be represented by : Name – color name, like “red” Hex – a hex value, like “#ffffcc” RGB – an RGB value, like “rgb(255,0,0)” Example body{ color:blue;} h1{ color:#00ff00;} h2{ color:rgb(255,0,0);} Font Family The font-family property should hold several font names as a “fallback” system. If the browser does not support the first font, it tries the next font.  Start with the font you want and end with a generic family. If the font family name is more than one word it must be in quotes eg  font-family:”Times New Roman”, Times, serif;
Font size The font size value can be an absolute or relative size: Absolute Size Sets the text to a specified size Does not allow a user to change the text size in all browsers  (bad for accessibility) Absolute size is useful when the physical size of the output is known Relative Size Sets the size relative to surrounding elements Allows a user to change the text size in browsers If you do not specify a font size a default is used. The default for a paragraph is 16px (=1em) To avoid the resizing problem with Internet Explorer, many developers use em instead of pixels. (W3C recommends the em size unit) Do not leave a space between the size and its unit  ie  1.2em  NOT 1.2 em
All the styles we have looked at so far are applied to tags.  This means all paragraphs will look the same ie <p> tags This inflexible as you may want one paragraph to be centred but all the others to be left aligned. The class selector is used to specify a style for a group of elements It is uses the HTML class attribute and is defined by “.” eg  .centre { text-align: center; }
act_styles.css with the class style added
This paragraph will be centered
Css 2010
If you had a class style. This code applies the class style to one paragraph and not the other.
This is OK if you want the whole paragraph to be bolded but another way is needed if you only want part of the paragraph bolded
You can place a <span> tag around the words you want the class style to apply to
Css 2010
.img_right will align the image right .img_left will align the image left  class  set to img_right
Css 2010
(a) Create the following CSS using Textpad, save it as mystyles.css  mystyles.css
(b) Modify Activity 4 Question 1 (act4_q1.html) to link the CSS file and to  align the images to the right using the class styles.  Add the text as  shown and bold the words as shown using the bolded class style
Specifies a style for a single unique element The id selector uses the id attribute It is defined with a “#” It is useful when using <div> tags  (to be covered next section) Do not start an id name with a number (won’t work in firefox)
Will cover this in more detail next section
Should be used when a single page has a unique style Defined in the head section of an XHTML document within the <style> element. Can also be called embedded styles. <head> <style  type=”text/css” > <!-- p { color: red; font-family: arial; } --> </style> </head> This style would only apply to the page it is defined in and cannot be applied to other pages like an external CSS file.  The comment tags <!--  --> are included in the style tags so it is compatible with older browsers  ( will be ignored in older browsers that don’t support them)
Browser view Internal style
Inline Style – defined within an XHTML element and will apply to only that instance of the element: (should be used sparingly as it loses the advantage of separating content from formatting) <p  style=”color:red; font-family:arial” >Paragraph text</p>  Browser view
Styles can be specified Inside a HTML element Inside the head section of an HTML page In an external CSS file What style will be used when there is more than one style specified for a HTML element Styles will “cascade” into a new virtual style sheet Inline style Internal style sheet  External style sheet Browser default So inline has the highest priority, which means it will override a style defined inside the <head> tag or an external style sheet Note:  if the link to the external style sheet is placed after the internal style sheet the external sheet will override the internal style sheet
This would suggest that all paragraphs would be blue, Times New Roman and 0.8em in size But on the next slide you will see that an internal style says that paragraphs will be red, ariel and 1.2em But the first paragraph has an inline style that says that paragraphs will be Times and purple. (because the size isn’t specified it will take the size on the internal style (1.2 em)
Css 2010
Css 2010
Links can be styled differently depending on what state they are in The four link states are: a: link –  a normal, unvisited link  a:visited –  a link the user has visited a:hover –  a link when the user places the mouse over it  a:active –  a link the moment it is clicked link_style.css They must be specified in this order
Css 2010
Some designers do not like the look of an underlined link So they remove the underline unless you hover over it The following style removes the underline However Industry standards are not to make changes to links as this can affect accessibility.
(a) Create the following CSS using Textpad, save it as link_styles.css  link_styles.css
(b) Modify Activity 5 Question 1 (act5_q1.html) to link the CSS file
You are going to add a CSS file to the site you developed in Lab1 and also change the file structure. Your are to set up 3 folders  Reminder: The site consists of four pages: welcome.html baked_pears.html pumpkin_creme_brulee.html contact_me.html
Your CSS file should set the following: Heading1 has font Tahoma, 1.6em, red and aligned centre Heading2 has font Tahoma, 1.2em and indigo All the pages has a background colour of  #ffffcc Paragraph has font Verdana, 0.8em and black Image has no border Table has a background colour of #99ffff Table data (ie <td>) is bolded List item (ie <li> ) has font Georgia, 0.8em, and colour of #660033 Normal link has the colour #ffbb00 and no underline Visited link has the colour red and no underline Need a class style to align an image to the right Save your file as lab2_styles.css
Link lab2_styles to all four pages However on contact_me.html you want the heading1 to be right aligned and not centred like the other pages The images of the four pages are shown on the next four slides
welcome.html
baked _pears.html
pumpkin_creme_brulee.html
contact_me.html
If you have completed Activities 7-9 and Lab 2 then complete the CSS tutorial & quiz at the following site http://www.w3schools.com/css/default.asp
In this section you learnt how to add CSS to your web pages to change the way the page looks. Covered: Syntax External styles Internal styles Inline styles Class selector id selector Link styles We used tables to layout the welcome page in Lab1. This is considered outdated and in the next section will be looking at dividing the page into sections using <div> tags and id selector styles.

More Related Content

What's hot (18)

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
 
Customizing the Appearance and HTML Output of Visualforce Pages
Customizing the Appearance and HTML Output of VisualforcePages Customizing the Appearance and HTML Output of VisualforcePages
Customizing the Appearance and HTML Output of Visualforce Pages
Mohammed Safwat Abu Kwaik
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
fantasticdigitaltools
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
KushagraChadha1
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
vijayta
 
CSS
CSSCSS
CSS
Gouthaman V
 
Html mod1
Html mod1Html mod1
Html mod1
VARSHAKUMARI49
 
Css module1
Css module1Css module1
Css module1
VARSHAKUMARI49
 
Web Design Assignment 1
Web Design Assignment 1 Web Design Assignment 1
Web Design Assignment 1
beretta21
 
Visualforce css developer guide(by forcetree.com)
Visualforce css developer guide(by forcetree.com)Visualforce css developer guide(by forcetree.com)
Visualforce css developer guide(by forcetree.com)
Edwin Vijay R
 
html-css
html-csshtml-css
html-css
Dhirendra Chauhan
 
Creating your 1st html page
Creating your 1st html pageCreating your 1st html page
Creating your 1st html page
Sara Corpuz
 
HTML CSS Basics
HTML CSS BasicsHTML CSS Basics
HTML CSS Basics
Mai Moustafa
 
CSS - LinkedIn
CSS - LinkedInCSS - LinkedIn
CSS - LinkedIn
Gino Louie Peña, ITIL®,MOS®
 
Css
CssCss
Css
Venkat Krishnan
 
CSS
CSSCSS
CSS
anandha ganesh
 
Css
CssCss
Css
MAGNA COLLEGE OF ENGINEERING
 
CSS (Cascading Style Sheet)
CSS (Cascading Style Sheet)CSS (Cascading Style Sheet)
CSS (Cascading Style Sheet)
Harshit Srivastava
 

Viewers also liked (11)

Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)
Reshmi Rajan
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
CSS Box Model Presentation
CSS Box Model PresentationCSS Box Model Presentation
CSS Box Model Presentation
Reed Crouch
 
CSS Box Model
CSS Box ModelCSS Box Model
CSS Box Model
Gerson Abesamis
 
Css box model
Css  box modelCss  box model
Css box model
Nicha Jutasirivongse
 
CSS, CSS Selectors, CSS Box Model
CSS, CSS Selectors, CSS Box ModelCSS, CSS Selectors, CSS Box Model
CSS, CSS Selectors, CSS Box Model
jamiecavanaugh
 
Css introduction
Css  introductionCss  introduction
Css introduction
Nicha Jutasirivongse
 
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
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
Sun Technlogies
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
10th science notes all chapters
10th science  notes all chapters10th science  notes all chapters
10th science notes all chapters
Karnataka OER
 
Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)
Reshmi Rajan
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
CSS Box Model Presentation
CSS Box Model PresentationCSS Box Model Presentation
CSS Box Model Presentation
Reed Crouch
 
CSS, CSS Selectors, CSS Box Model
CSS, CSS Selectors, CSS Box ModelCSS, CSS Selectors, CSS Box Model
CSS, CSS Selectors, CSS Box Model
jamiecavanaugh
 
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
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
Sun Technlogies
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
10th science notes all chapters
10th science  notes all chapters10th science  notes all chapters
10th science notes all chapters
Karnataka OER
 

Similar to Css 2010 (20)

Css introduction
Css introductionCss introduction
Css introduction
Sridhar P
 
Css introduction
Css  introductionCss  introduction
Css introduction
vishnu murthy
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
vedaste
 
This is css which compiled by alex that is impo
This is css which compiled by alex that is impoThis is css which compiled by alex that is impo
This is css which compiled by alex that is impo
AlebelAyalneh
 
Basics Of Css And Some Common Mistakes
Basics Of Css And Some Common MistakesBasics Of Css And Some Common Mistakes
Basics Of Css And Some Common Mistakes
sanjay2211
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
Dave Kelly
 
Using Cascading Style Sheets2
Using Cascading Style Sheets2Using Cascading Style Sheets2
Using Cascading Style Sheets2
Sutinder Mann
 
What is CSS.pptx power point presentation
What is CSS.pptx power point presentationWhat is CSS.pptx power point presentation
What is CSS.pptx power point presentation
Coderkids
 
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
 
Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8
RohanMistry15
 
CSS Training in Bangalore
CSS Training in BangaloreCSS Training in Bangalore
CSS Training in Bangalore
rajkamal560066
 
lecture CSS 1-2_2022_2023.pptx
lecture CSS 1-2_2022_2023.pptxlecture CSS 1-2_2022_2023.pptx
lecture CSS 1-2_2022_2023.pptx
zheerhimdad
 
Css
CssCss
Css
NIRMAL FELIX
 
PHP HTML CSS Notes
PHP HTML CSS  NotesPHP HTML CSS  Notes
PHP HTML CSS Notes
Tushar Rajput
 
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
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
Bulldogs83
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
Bulldogs83
 
CSS Part I
CSS Part ICSS Part I
CSS Part I
Doncho Minkov
 
Css training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsCss training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentials
QA TrainingHub
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
vishal choudhary
 
Css introduction
Css introductionCss introduction
Css introduction
Sridhar P
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
vedaste
 
This is css which compiled by alex that is impo
This is css which compiled by alex that is impoThis is css which compiled by alex that is impo
This is css which compiled by alex that is impo
AlebelAyalneh
 
Basics Of Css And Some Common Mistakes
Basics Of Css And Some Common MistakesBasics Of Css And Some Common Mistakes
Basics Of Css And Some Common Mistakes
sanjay2211
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
Dave Kelly
 
Using Cascading Style Sheets2
Using Cascading Style Sheets2Using Cascading Style Sheets2
Using Cascading Style Sheets2
Sutinder Mann
 
What is CSS.pptx power point presentation
What is CSS.pptx power point presentationWhat is CSS.pptx power point presentation
What is CSS.pptx power point presentation
Coderkids
 
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
 
Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8
RohanMistry15
 
CSS Training in Bangalore
CSS Training in BangaloreCSS Training in Bangalore
CSS Training in Bangalore
rajkamal560066
 
lecture CSS 1-2_2022_2023.pptx
lecture CSS 1-2_2022_2023.pptxlecture CSS 1-2_2022_2023.pptx
lecture CSS 1-2_2022_2023.pptx
zheerhimdad
 
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
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
Bulldogs83
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
Bulldogs83
 
Css training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsCss training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentials
QA TrainingHub
 

Recently uploaded (20)

MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCPMCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
Sambhav Kothari
 
Splunk Leadership Forum Wien - 20.05.2025
Splunk Leadership Forum Wien - 20.05.2025Splunk Leadership Forum Wien - 20.05.2025
Splunk Leadership Forum Wien - 20.05.2025
Splunk
 
Introducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and ARIntroducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and AR
Safe Software
 
Droidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing HealthcareDroidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing Healthcare
Droidal LLC
 
cloudgenesis cloud workshop , gdg on campus mita
cloudgenesis cloud workshop , gdg on campus mitacloudgenesis cloud workshop , gdg on campus mita
cloudgenesis cloud workshop , gdg on campus mita
siyaldhande02
 
Marko.js - Unsung Hero of Scalable Web Frameworks (DevDays 2025)
Marko.js - Unsung Hero of Scalable Web Frameworks (DevDays 2025)Marko.js - Unsung Hero of Scalable Web Frameworks (DevDays 2025)
Marko.js - Unsung Hero of Scalable Web Frameworks (DevDays 2025)
Eugene Fidelin
 
What is DePIN? The Hottest Trend in Web3 Right Now!
What is DePIN? The Hottest Trend in Web3 Right Now!What is DePIN? The Hottest Trend in Web3 Right Now!
What is DePIN? The Hottest Trend in Web3 Right Now!
cryptouniversityoffi
 
TrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy ContractingTrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy Contracting
TrustArc
 
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AISAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
Peter Spielvogel
 
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World TipsMuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
Patryk Bandurski
 
Building Agents with LangGraph & Gemini
Building Agents with LangGraph &  GeminiBuilding Agents with LangGraph &  Gemini
Building Agents with LangGraph & Gemini
HusseinMalikMammadli
 
AI against disinformation and why it is not enough
AI against disinformation and why it is not enoughAI against disinformation and why it is not enough
AI against disinformation and why it is not enough
Yiannis Kompatsiaris
 
Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025
Prasta Maha
 
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AI Emotional Actors:  “When Machines Learn to Feel and Perform"AI Emotional Actors:  “When Machines Learn to Feel and Perform"
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AkashKumar809858
 
Introducing Ensemble Cloudlet vRouter
Introducing Ensemble  Cloudlet vRouterIntroducing Ensemble  Cloudlet vRouter
Introducing Ensemble Cloudlet vRouter
Adtran
 
Security Operations and the Defense Analyst - Splunk Certificate
Security Operations and the Defense Analyst - Splunk CertificateSecurity Operations and the Defense Analyst - Splunk Certificate
Security Operations and the Defense Analyst - Splunk Certificate
VICTOR MAESTRE RAMIREZ
 
System Card: Claude Opus 4 & Claude Sonnet 4
System Card: Claude Opus 4 & Claude Sonnet 4System Card: Claude Opus 4 & Claude Sonnet 4
System Card: Claude Opus 4 & Claude Sonnet 4
Razin Mustafiz
 
With Claude 4, Anthropic redefines AI capabilities, effectively unleashing a ...
With Claude 4, Anthropic redefines AI capabilities, effectively unleashing a ...With Claude 4, Anthropic redefines AI capabilities, effectively unleashing a ...
With Claude 4, Anthropic redefines AI capabilities, effectively unleashing a ...
SOFTTECHHUB
 
Build your own NES Emulator... with Kotlin
Build your own NES Emulator... with KotlinBuild your own NES Emulator... with Kotlin
Build your own NES Emulator... with Kotlin
Artur Skowroński
 
John Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 TalkJohn Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 Talk
Razin Mustafiz
 
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCPMCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
Sambhav Kothari
 
Splunk Leadership Forum Wien - 20.05.2025
Splunk Leadership Forum Wien - 20.05.2025Splunk Leadership Forum Wien - 20.05.2025
Splunk Leadership Forum Wien - 20.05.2025
Splunk
 
Introducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and ARIntroducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and AR
Safe Software
 
Droidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing HealthcareDroidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing Healthcare
Droidal LLC
 
cloudgenesis cloud workshop , gdg on campus mita
cloudgenesis cloud workshop , gdg on campus mitacloudgenesis cloud workshop , gdg on campus mita
cloudgenesis cloud workshop , gdg on campus mita
siyaldhande02
 
Marko.js - Unsung Hero of Scalable Web Frameworks (DevDays 2025)
Marko.js - Unsung Hero of Scalable Web Frameworks (DevDays 2025)Marko.js - Unsung Hero of Scalable Web Frameworks (DevDays 2025)
Marko.js - Unsung Hero of Scalable Web Frameworks (DevDays 2025)
Eugene Fidelin
 
What is DePIN? The Hottest Trend in Web3 Right Now!
What is DePIN? The Hottest Trend in Web3 Right Now!What is DePIN? The Hottest Trend in Web3 Right Now!
What is DePIN? The Hottest Trend in Web3 Right Now!
cryptouniversityoffi
 
TrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy ContractingTrustArc Webinar: Mastering Privacy Contracting
TrustArc Webinar: Mastering Privacy Contracting
TrustArc
 
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AISAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
SAP Sapphire 2025 ERP1612 Enhancing User Experience with SAP Fiori and AI
Peter Spielvogel
 
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World TipsMuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
Patryk Bandurski
 
Building Agents with LangGraph & Gemini
Building Agents with LangGraph &  GeminiBuilding Agents with LangGraph &  Gemini
Building Agents with LangGraph & Gemini
HusseinMalikMammadli
 
AI against disinformation and why it is not enough
AI against disinformation and why it is not enoughAI against disinformation and why it is not enough
AI against disinformation and why it is not enough
Yiannis Kompatsiaris
 
Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025
Prasta Maha
 
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AI Emotional Actors:  “When Machines Learn to Feel and Perform"AI Emotional Actors:  “When Machines Learn to Feel and Perform"
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AkashKumar809858
 
Introducing Ensemble Cloudlet vRouter
Introducing Ensemble  Cloudlet vRouterIntroducing Ensemble  Cloudlet vRouter
Introducing Ensemble Cloudlet vRouter
Adtran
 
Security Operations and the Defense Analyst - Splunk Certificate
Security Operations and the Defense Analyst - Splunk CertificateSecurity Operations and the Defense Analyst - Splunk Certificate
Security Operations and the Defense Analyst - Splunk Certificate
VICTOR MAESTRE RAMIREZ
 
System Card: Claude Opus 4 & Claude Sonnet 4
System Card: Claude Opus 4 & Claude Sonnet 4System Card: Claude Opus 4 & Claude Sonnet 4
System Card: Claude Opus 4 & Claude Sonnet 4
Razin Mustafiz
 
With Claude 4, Anthropic redefines AI capabilities, effectively unleashing a ...
With Claude 4, Anthropic redefines AI capabilities, effectively unleashing a ...With Claude 4, Anthropic redefines AI capabilities, effectively unleashing a ...
With Claude 4, Anthropic redefines AI capabilities, effectively unleashing a ...
SOFTTECHHUB
 
Build your own NES Emulator... with Kotlin
Build your own NES Emulator... with KotlinBuild your own NES Emulator... with Kotlin
Build your own NES Emulator... with Kotlin
Artur Skowroński
 
John Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 TalkJohn Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 Talk
Razin Mustafiz
 

Css 2010

  • 1. Adding Cascading Style Sheets (CSS) to XHTML Documents
  • 2. These notes do not contain a complete list of CSS styles. For further information see http://www.w3schools.com/css/default.asp For validation of your CSS files use http://jigsaw.w3.org/css-validator
  • 3. Cascading Style Sheets (CSS) were introduced by the W3C in 1996 to provide HTML authors with more control over document formatting CSS style sheets work with XHTML, XML and HTML files and are widely accepted by Web browsers A single style sheet can be used to provide uniform formatting styles to a group of documents CSS files are plain text files and can be edited with a text editor
  • 4. HTML was never intended to contain tags for formatting documents. It was intended to define the content of a document. Eg <p>This is the page content </p> When the <font> tags and color attributes were added to the specification in V3.2 it started a nightmare for developers. These tags needed to be added to every single page making them long and expensive to produce. By V4.0 CSS had been developed and all formatting could be removed from the HTML and stored in a separate CSS file.
  • 5. Why use Style Sheets? Allows the content and formatting of a page to remain separate. Allows for many pages to be formatted the same by using a single CSS file. (allows for consistency across a site) Allows you to change the appearance and layout of all the pages of an entire site by editing just one file. A web page can be divided into sections (using <div> tags) Each section can have a different style applied to it, this allows for multiple presentation layouts for a single document Style elements are being deprecated in the XHTML language and will not be available in future versions of XHTML past the 1.0 version
  • 6. CSS rules consists of two parts: Element selector Properties declarations Above example in a text file: h1{ color: blue ; font-size: 12px ; } CSS comments: /* This is a comment */ For readability the declarations are often written on separate lines
  • 7. The style sheets are stored in a separate text file from the XHTML document ( with the file extension .css): h1{ color: blue ; font-size: 16pt ; font-family: arial ; } This code would make any content in a <h1> tag appear blue, arial & 12pt (assume the file is saved as example1.css) The file is attached to the XHTML file using the <link> tag in the header section of the document <link rel=”stylesheet” href=”example1.css” type=”text/css” />
  • 8. Links CSS file Browser view example1.css
  • 9. mystyles.css browser view Link to CSS If the CSS file was in a separate folder then href=“../css/mystyles”
  • 10. Create the following CSS using Textpad, save it as act_styles.css Modify your Activity 1 Question 2 XHTML code by linking the CSS file to it and then view in a browser. act_styles.css Browser view of Act1_Q2.html with CSS attached
  • 11. Edit act_styles.css to add the style for <h2> and <p> as shown below Modify your Activity 2 Question 1 XHTML code by linking the CSS file to it and then view in a browser. act_styles.css Browser view of Act2_Q1.html with CSS attached shown next slide Add these }
  • 12. Browser view of Act2_Q1.html with CSS
  • 13. color (note American spelling of color) color can be represented by : Name – color name, like “red” Hex – a hex value, like “#ffffcc” RGB – an RGB value, like “rgb(255,0,0)” Example body{ color:blue;} h1{ color:#00ff00;} h2{ color:rgb(255,0,0);} Font Family The font-family property should hold several font names as a “fallback” system. If the browser does not support the first font, it tries the next font. Start with the font you want and end with a generic family. If the font family name is more than one word it must be in quotes eg font-family:”Times New Roman”, Times, serif;
  • 14. Font size The font size value can be an absolute or relative size: Absolute Size Sets the text to a specified size Does not allow a user to change the text size in all browsers (bad for accessibility) Absolute size is useful when the physical size of the output is known Relative Size Sets the size relative to surrounding elements Allows a user to change the text size in browsers If you do not specify a font size a default is used. The default for a paragraph is 16px (=1em) To avoid the resizing problem with Internet Explorer, many developers use em instead of pixels. (W3C recommends the em size unit) Do not leave a space between the size and its unit ie 1.2em NOT 1.2 em
  • 15. All the styles we have looked at so far are applied to tags. This means all paragraphs will look the same ie <p> tags This inflexible as you may want one paragraph to be centred but all the others to be left aligned. The class selector is used to specify a style for a group of elements It is uses the HTML class attribute and is defined by “.” eg .centre { text-align: center; }
  • 16. act_styles.css with the class style added
  • 17. This paragraph will be centered
  • 19. If you had a class style. This code applies the class style to one paragraph and not the other.
  • 20. This is OK if you want the whole paragraph to be bolded but another way is needed if you only want part of the paragraph bolded
  • 21. You can place a <span> tag around the words you want the class style to apply to
  • 23. .img_right will align the image right .img_left will align the image left class set to img_right
  • 25. (a) Create the following CSS using Textpad, save it as mystyles.css mystyles.css
  • 26. (b) Modify Activity 4 Question 1 (act4_q1.html) to link the CSS file and to align the images to the right using the class styles. Add the text as shown and bold the words as shown using the bolded class style
  • 27. Specifies a style for a single unique element The id selector uses the id attribute It is defined with a “#” It is useful when using <div> tags (to be covered next section) Do not start an id name with a number (won’t work in firefox)
  • 28. Will cover this in more detail next section
  • 29. Should be used when a single page has a unique style Defined in the head section of an XHTML document within the <style> element. Can also be called embedded styles. <head> <style type=”text/css” > <!-- p { color: red; font-family: arial; } --> </style> </head> This style would only apply to the page it is defined in and cannot be applied to other pages like an external CSS file. The comment tags <!-- --> are included in the style tags so it is compatible with older browsers ( will be ignored in older browsers that don’t support them)
  • 31. Inline Style – defined within an XHTML element and will apply to only that instance of the element: (should be used sparingly as it loses the advantage of separating content from formatting) <p style=”color:red; font-family:arial” >Paragraph text</p> Browser view
  • 32. Styles can be specified Inside a HTML element Inside the head section of an HTML page In an external CSS file What style will be used when there is more than one style specified for a HTML element Styles will “cascade” into a new virtual style sheet Inline style Internal style sheet External style sheet Browser default So inline has the highest priority, which means it will override a style defined inside the <head> tag or an external style sheet Note: if the link to the external style sheet is placed after the internal style sheet the external sheet will override the internal style sheet
  • 33. This would suggest that all paragraphs would be blue, Times New Roman and 0.8em in size But on the next slide you will see that an internal style says that paragraphs will be red, ariel and 1.2em But the first paragraph has an inline style that says that paragraphs will be Times and purple. (because the size isn’t specified it will take the size on the internal style (1.2 em)
  • 36. Links can be styled differently depending on what state they are in The four link states are: a: link – a normal, unvisited link a:visited – a link the user has visited a:hover – a link when the user places the mouse over it a:active – a link the moment it is clicked link_style.css They must be specified in this order
  • 38. Some designers do not like the look of an underlined link So they remove the underline unless you hover over it The following style removes the underline However Industry standards are not to make changes to links as this can affect accessibility.
  • 39. (a) Create the following CSS using Textpad, save it as link_styles.css link_styles.css
  • 40. (b) Modify Activity 5 Question 1 (act5_q1.html) to link the CSS file
  • 41. You are going to add a CSS file to the site you developed in Lab1 and also change the file structure. Your are to set up 3 folders Reminder: The site consists of four pages: welcome.html baked_pears.html pumpkin_creme_brulee.html contact_me.html
  • 42. Your CSS file should set the following: Heading1 has font Tahoma, 1.6em, red and aligned centre Heading2 has font Tahoma, 1.2em and indigo All the pages has a background colour of #ffffcc Paragraph has font Verdana, 0.8em and black Image has no border Table has a background colour of #99ffff Table data (ie <td>) is bolded List item (ie <li> ) has font Georgia, 0.8em, and colour of #660033 Normal link has the colour #ffbb00 and no underline Visited link has the colour red and no underline Need a class style to align an image to the right Save your file as lab2_styles.css
  • 43. Link lab2_styles to all four pages However on contact_me.html you want the heading1 to be right aligned and not centred like the other pages The images of the four pages are shown on the next four slides
  • 48. If you have completed Activities 7-9 and Lab 2 then complete the CSS tutorial & quiz at the following site http://www.w3schools.com/css/default.asp
  • 49. In this section you learnt how to add CSS to your web pages to change the way the page looks. Covered: Syntax External styles Internal styles Inline styles Class selector id selector Link styles We used tables to layout the welcome page in Lab1. This is considered outdated and in the next section will be looking at dividing the page into sections using <div> tags and id selector styles.