SlideShare a Scribd company logo
More HTML
Chapter 4
2
Nesting Tags
 How do you write the following in HTML?
 The wrong way:
This is <strong>really, <em>REALLY</strong> fun</em>!
This is <strong>really,</strong>
<em><strong>REALLY</strong> fun</em>!
 Tags must be correctly nested.
 A closing tag must match the most recently opened tag.
 The right way:
3
Spacing And Indentation
 Which tag is not closed?
<html><head><title>Can you find it?</title></head>
<body><p><ul><li>Not it!</li><li><ol><li>Is it here?
</li><li>Or maybe it's this one?</li></ol></li><li>
More words here</li><li>This is very hard to
read</li></p></body></html>
4
How About Now?
<html>
<head>
<title>Can you find it?</title>
</head>
<body>
<p>
<ul>
<li>Not it!</li>
<li>
<ol>
<li>Is it here?</li>
<li>Or maybe it's this one?</li>
</ol>
</li>
<li>More words here</li>
<li>This is very hard to read</li>
</p>
</body>
</html>
5
Spacing And Indentation Guidelines
 If the tag's content fits on one line, open and close
the tag on the same line.
 Otherwise, the tag's content should be indented
more than the starting and closing tags.
 If the starting and closing tags are on separate lines,
they should line up vertically, like above.
<li>Is it here</li>
<ol>
<li>Is it here?</li>
<li>Or maybe this tag is not closed?</li>
</ol>
6
Spacing And Indentation Guidelines
 Use newlines to structure the HTML.
 The wrong way:
 The right way:
<ol>
<li>Item 1</li><li>Item 2</li><li>Item 3</li>
</ol>
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
7
Extensible HTML: XHTML
 Newer version of HTML, standardized in 2000
 XHTML tags must always be …
 … in lowercase
 … closed
 … nested properly
 XHTML 1.0 Strict is the standard we will be using.
 Reference: http://www.december.com/html/x1/
8
Why Use Standards?
 Ensure interoperability across different browsers
 Can easily verify if standards-compliant
 XHTML Validation Service: http://validator.w3.org/
 Alas, not all web browsers (particularly Internet
Explorer) adhere to the standards
 http://www.webdevout.net/browser-support-summary
9
Basic XHTML Template
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>page title goes here</title>
</head>
<body>
page content goes here
</body>
</html>
10
HTML Element
11
Block vs. Inline Elements
 Block elements create "larger" structures than inline
elements.
 In general,
 block elements may contain text, inline elements, and other
block elements.
 inline elements may contain only text and other inline
elements.
 Block elements begin on new lines, inline elements
do not.
12
Block or Inline?
 Block
 h1, h2, ..., h6
 p
 ul, ol
 hr
 Inline
 br
 em
 strong
 a
 img
13
Document Flow: Block Elements
14
Document Flow: Inline Elements
15
Document Flow Example
16
Why Important?
Elements allowed
in body element
Only block
elements are
directly allowed
inside the body
element.
Image snapshot from XHTML 1.0 Strict Reference http://www.december.com/html/x1/element/body.html
17
What About Links?
 Allowable content for body:
 Illegal:
 How can a web page have links?
 One solution is to put the link in a block element.
<body>
<a href="http://www.yahoo.com">Yahoo!</a>
</body>
No a!
<body>
<p><a href="http://www.yahoo.com">Yahoo!</a></p>
</body>
18
Images In XHTML
 Requires an alt attribute describing the image
<p>
<img src="hamster.jpg" alt="Hamster eating carrot" />
</p>
 Image missing:
 Image present:
19
XHTML Validation
 Make sure your files validate!
 XHTML Validation Service: http://validator.w3.org/
 When fixing errors, fix the first error and then try
validating again.
 For example, a single missing closing tag might be
confused for several errors.
 Validation does not check for proper indentation.
20
Web 2.0
21
HTML/XHTML Resources
 W3Schools HTML Tutorial
 http://www.w3schools.com/html/default.asp
 W3Schools XHTML Tutorial
 http://www.w3schools.com/xhtml/default.asp
 Complete list of HTML tags
 http://www.w3schools.com/tags/default.asp
 XHTML 1.0 Strict Reference
 http://www.december.com/html/x1/
22
Cascading Style Sheets (CSS)
 Describe the appearance, layout, and
presentation of information on a web page
 Describe how information is to be displayed,
not what is being displayed
23
Basic CSS Rule
 A CSS file contains one or more rules.
 Rule syntax:
 selector: HTML element you wish to style
 property: attribute you wish to change
selector {
property: value;
property: value;
...
property: value;
}
24
 CSS:
 HTML:
Example
<p>Can you see me now?</p>
p {
font-family: sans-serif;
background-color: yellow;
}
25
Color Properties
 color: color of the element's text
 background-color: color that will appear behind
the element
26
Colors
 Colors are defined by three numbers (from 0 to 255) representing the
amount of red, green, and blue (RGB)
 Can specify colors by:
 Pre-defined name
 aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive,
purple, red, silver, teal, white, yellow
 RGB triplet
 rgb(R,G,B) where R, G, and B are each numbers from 0 to 255
 RGB triplet in hexadecimal format*
 #RRGGBB where RR, GG, BB are the red, green, and blue values in
hexadecimal
 ColorSchemer: http://www.colorschemer.com/online.html
*You do not need to understand hexadecimal.
27
Colors Example
 Ways to specify teal
h1 {
color: teal;
}
h1 {
color: rgb(0,128,128);
}
h1 {
color: #008080;
}
28
More Properties: Font
 font-family: which font will be used
 font-size: how large the letters will be drawn
 font-style: used to enable/disable italic style
 font-weight: used to enable/disable bold style
 For examples on how to set these and other
properties, see:
 http://www.w3schools.com/css/css_reference.asp
 http://www.tizag.com/cssT/reference.php
29
Attaching a CSS File: <link />
 Copy the rel and type attributes and their
corresponding values verbatim
 Use the href attribute to specify the location of a
stylesheet file
 Path location may be absolute or relative
<head>
<title>...</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
30
CSS Resources
 CSS property references:
 http://www.w3schools.com/css/css_reference.asp
 http://www.tizag.com/cssT/reference.php
 CSS tutorial:
 http://www.tizag.com/cssT/
 CSE 190 M (Web Programming) lecture notes:
 http://www.cs.washington.edu/education/courses/cse190m/Curre
ntQtr/lectures/slides/lecture03-basic_css.html

More Related Content

Similar to Html file for freshers

Workshop 2 Slides.pptx
Workshop 2 Slides.pptxWorkshop 2 Slides.pptx
Workshop 2 Slides.pptx
DaniyalSardar
 
html complete notes
html complete noteshtml complete notes
html complete notes
onactiontv
 
html compete notes basic to advanced
html compete notes basic to advancedhtml compete notes basic to advanced
html compete notes basic to advanced
virtualworld14
 
web development.pdf
web development.pdfweb development.pdf
web development.pdf
BagHarki
 
Learn html elements and structure cheatsheet codecademy
Learn html  elements and structure cheatsheet   codecademyLearn html  elements and structure cheatsheet   codecademy
Learn html elements and structure cheatsheet codecademy
nirmalamanjunath
 
HTML Presentation
HTML Presentation HTML Presentation
HTML Presentation
pradeepthakur87
 
htmlnotes-180924151434.pdf dafdkzndsvkdvdd
htmlnotes-180924151434.pdf dafdkzndsvkdvddhtmlnotes-180924151434.pdf dafdkzndsvkdvdd
htmlnotes-180924151434.pdf dafdkzndsvkdvdd
hemanthkalyan25
 
htmlnotes Which tells about all the basic
htmlnotes Which tells about all the basichtmlnotes Which tells about all the basic
htmlnotes Which tells about all the basic
hemanthkalyan25
 
Summary of-xhtml-basics
Summary of-xhtml-basicsSummary of-xhtml-basics
Summary of-xhtml-basics
starlanter
 
Html notes
Html notesHtml notes
Html notes
Ismail Mukiibi
 
Html basics NOTE
Html basics NOTEHtml basics NOTE
LEARN HTML IN A DAY
LEARN HTML IN A DAYLEARN HTML IN A DAY
LEARN HTML IN A DAY
AWK Internet Technologies
 
Html introduction
Html introductionHtml introduction
Html introduction
vishnu murthy
 
Html xhtml tag-sheet
Html xhtml tag-sheetHtml xhtml tag-sheet
Html xhtml tag-sheet
Daniel Downs
 
PHP HTML CSS Notes
PHP HTML CSS  NotesPHP HTML CSS  Notes
PHP HTML CSS Notes
Tushar Rajput
 
Html example
Html exampleHtml example
Html example
Dorothy Dominic
 
Html Workshop
Html WorkshopHtml Workshop
Html Workshop
vardanyan99
 
Html ppt computer
Html ppt computerHtml ppt computer
Html ppt computer
Anmol Pant
 
Eye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easilyEye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easily
shabab shihan
 
Learn html from www
Learn html from wwwLearn html from www
Learn html from www
alvinblue1212
 

Similar to Html file for freshers (20)

Workshop 2 Slides.pptx
Workshop 2 Slides.pptxWorkshop 2 Slides.pptx
Workshop 2 Slides.pptx
 
html complete notes
html complete noteshtml complete notes
html complete notes
 
html compete notes basic to advanced
html compete notes basic to advancedhtml compete notes basic to advanced
html compete notes basic to advanced
 
web development.pdf
web development.pdfweb development.pdf
web development.pdf
 
Learn html elements and structure cheatsheet codecademy
Learn html  elements and structure cheatsheet   codecademyLearn html  elements and structure cheatsheet   codecademy
Learn html elements and structure cheatsheet codecademy
 
HTML Presentation
HTML Presentation HTML Presentation
HTML Presentation
 
htmlnotes-180924151434.pdf dafdkzndsvkdvdd
htmlnotes-180924151434.pdf dafdkzndsvkdvddhtmlnotes-180924151434.pdf dafdkzndsvkdvdd
htmlnotes-180924151434.pdf dafdkzndsvkdvdd
 
htmlnotes Which tells about all the basic
htmlnotes Which tells about all the basichtmlnotes Which tells about all the basic
htmlnotes Which tells about all the basic
 
Summary of-xhtml-basics
Summary of-xhtml-basicsSummary of-xhtml-basics
Summary of-xhtml-basics
 
Html notes
Html notesHtml notes
Html notes
 
Html basics NOTE
Html basics NOTEHtml basics NOTE
Html basics NOTE
 
LEARN HTML IN A DAY
LEARN HTML IN A DAYLEARN HTML IN A DAY
LEARN HTML IN A DAY
 
Html introduction
Html introductionHtml introduction
Html introduction
 
Html xhtml tag-sheet
Html xhtml tag-sheetHtml xhtml tag-sheet
Html xhtml tag-sheet
 
PHP HTML CSS Notes
PHP HTML CSS  NotesPHP HTML CSS  Notes
PHP HTML CSS Notes
 
Html example
Html exampleHtml example
Html example
 
Html Workshop
Html WorkshopHtml Workshop
Html Workshop
 
Html ppt computer
Html ppt computerHtml ppt computer
Html ppt computer
 
Eye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easilyEye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easily
 
Learn html from www
Learn html from wwwLearn html from www
Learn html from www
 

Recently uploaded

How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
NWEXAM
 
IT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a RoadmapIT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a Roadmap
Base Camp
 
thyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatialthyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatial
Aditya Raghav
 
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
GabrielleSinaga
 
All Of My Java Codes With A Sample Output.docx
All Of My Java Codes With A Sample Output.docxAll Of My Java Codes With A Sample Output.docx
All Of My Java Codes With A Sample Output.docx
adhitya5119
 
A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024
Bruce Bennett
 
0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf
Thomas GIRARD BDes
 
Lbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdfLbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdf
ashiquepa3
 
Learnings from Successful Jobs Searchers
Learnings from Successful Jobs SearchersLearnings from Successful Jobs Searchers
Learnings from Successful Jobs Searchers
Bruce Bennett
 
Leadership Ambassador club Adventist module
Leadership Ambassador club Adventist moduleLeadership Ambassador club Adventist module
Leadership Ambassador club Adventist module
kakomaeric00
 
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
2zjra9bn
 
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
2zjra9bn
 
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdfSwitching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
SocMediaFin - Joyce Sullivan
 
Connect to Grow: The power of building networks
Connect to Grow: The power of building networksConnect to Grow: The power of building networks
Connect to Grow: The power of building networks
Eirini SYKA-LERIOTI
 
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employeesLeave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Sreenivas702647
 
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAANBUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
cahgading001
 
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
dsnow9802
 
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
taqyea
 
Tape Measure Training & Practice Assessments.pdf
Tape Measure Training & Practice Assessments.pdfTape Measure Training & Practice Assessments.pdf
Tape Measure Training & Practice Assessments.pdf
KateRobinson68
 

Recently uploaded (19)

How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
 
IT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a RoadmapIT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a Roadmap
 
thyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatialthyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatial
 
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
 
All Of My Java Codes With A Sample Output.docx
All Of My Java Codes With A Sample Output.docxAll Of My Java Codes With A Sample Output.docx
All Of My Java Codes With A Sample Output.docx
 
A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024
 
0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf
 
Lbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdfLbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdf
 
Learnings from Successful Jobs Searchers
Learnings from Successful Jobs SearchersLearnings from Successful Jobs Searchers
Learnings from Successful Jobs Searchers
 
Leadership Ambassador club Adventist module
Leadership Ambassador club Adventist moduleLeadership Ambassador club Adventist module
Leadership Ambassador club Adventist module
 
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
 
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
 
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdfSwitching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
 
Connect to Grow: The power of building networks
Connect to Grow: The power of building networksConnect to Grow: The power of building networks
Connect to Grow: The power of building networks
 
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employeesLeave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employees
 
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAANBUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
 
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
 
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
 
Tape Measure Training & Practice Assessments.pdf
Tape Measure Training & Practice Assessments.pdfTape Measure Training & Practice Assessments.pdf
Tape Measure Training & Practice Assessments.pdf
 

Html file for freshers

  • 2. 2 Nesting Tags  How do you write the following in HTML?  The wrong way: This is <strong>really, <em>REALLY</strong> fun</em>! This is <strong>really,</strong> <em><strong>REALLY</strong> fun</em>!  Tags must be correctly nested.  A closing tag must match the most recently opened tag.  The right way:
  • 3. 3 Spacing And Indentation  Which tag is not closed? <html><head><title>Can you find it?</title></head> <body><p><ul><li>Not it!</li><li><ol><li>Is it here? </li><li>Or maybe it's this one?</li></ol></li><li> More words here</li><li>This is very hard to read</li></p></body></html>
  • 4. 4 How About Now? <html> <head> <title>Can you find it?</title> </head> <body> <p> <ul> <li>Not it!</li> <li> <ol> <li>Is it here?</li> <li>Or maybe it's this one?</li> </ol> </li> <li>More words here</li> <li>This is very hard to read</li> </p> </body> </html>
  • 5. 5 Spacing And Indentation Guidelines  If the tag's content fits on one line, open and close the tag on the same line.  Otherwise, the tag's content should be indented more than the starting and closing tags.  If the starting and closing tags are on separate lines, they should line up vertically, like above. <li>Is it here</li> <ol> <li>Is it here?</li> <li>Or maybe this tag is not closed?</li> </ol>
  • 6. 6 Spacing And Indentation Guidelines  Use newlines to structure the HTML.  The wrong way:  The right way: <ol> <li>Item 1</li><li>Item 2</li><li>Item 3</li> </ol> <ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ol>
  • 7. 7 Extensible HTML: XHTML  Newer version of HTML, standardized in 2000  XHTML tags must always be …  … in lowercase  … closed  … nested properly  XHTML 1.0 Strict is the standard we will be using.  Reference: http://www.december.com/html/x1/
  • 8. 8 Why Use Standards?  Ensure interoperability across different browsers  Can easily verify if standards-compliant  XHTML Validation Service: http://validator.w3.org/  Alas, not all web browsers (particularly Internet Explorer) adhere to the standards  http://www.webdevout.net/browser-support-summary
  • 9. 9 Basic XHTML Template <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>page title goes here</title> </head> <body> page content goes here </body> </html>
  • 11. 11 Block vs. Inline Elements  Block elements create "larger" structures than inline elements.  In general,  block elements may contain text, inline elements, and other block elements.  inline elements may contain only text and other inline elements.  Block elements begin on new lines, inline elements do not.
  • 12. 12 Block or Inline?  Block  h1, h2, ..., h6  p  ul, ol  hr  Inline  br  em  strong  a  img
  • 16. 16 Why Important? Elements allowed in body element Only block elements are directly allowed inside the body element. Image snapshot from XHTML 1.0 Strict Reference http://www.december.com/html/x1/element/body.html
  • 17. 17 What About Links?  Allowable content for body:  Illegal:  How can a web page have links?  One solution is to put the link in a block element. <body> <a href="http://www.yahoo.com">Yahoo!</a> </body> No a! <body> <p><a href="http://www.yahoo.com">Yahoo!</a></p> </body>
  • 18. 18 Images In XHTML  Requires an alt attribute describing the image <p> <img src="hamster.jpg" alt="Hamster eating carrot" /> </p>  Image missing:  Image present:
  • 19. 19 XHTML Validation  Make sure your files validate!  XHTML Validation Service: http://validator.w3.org/  When fixing errors, fix the first error and then try validating again.  For example, a single missing closing tag might be confused for several errors.  Validation does not check for proper indentation.
  • 21. 21 HTML/XHTML Resources  W3Schools HTML Tutorial  http://www.w3schools.com/html/default.asp  W3Schools XHTML Tutorial  http://www.w3schools.com/xhtml/default.asp  Complete list of HTML tags  http://www.w3schools.com/tags/default.asp  XHTML 1.0 Strict Reference  http://www.december.com/html/x1/
  • 22. 22 Cascading Style Sheets (CSS)  Describe the appearance, layout, and presentation of information on a web page  Describe how information is to be displayed, not what is being displayed
  • 23. 23 Basic CSS Rule  A CSS file contains one or more rules.  Rule syntax:  selector: HTML element you wish to style  property: attribute you wish to change selector { property: value; property: value; ... property: value; }
  • 24. 24  CSS:  HTML: Example <p>Can you see me now?</p> p { font-family: sans-serif; background-color: yellow; }
  • 25. 25 Color Properties  color: color of the element's text  background-color: color that will appear behind the element
  • 26. 26 Colors  Colors are defined by three numbers (from 0 to 255) representing the amount of red, green, and blue (RGB)  Can specify colors by:  Pre-defined name  aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, yellow  RGB triplet  rgb(R,G,B) where R, G, and B are each numbers from 0 to 255  RGB triplet in hexadecimal format*  #RRGGBB where RR, GG, BB are the red, green, and blue values in hexadecimal  ColorSchemer: http://www.colorschemer.com/online.html *You do not need to understand hexadecimal.
  • 27. 27 Colors Example  Ways to specify teal h1 { color: teal; } h1 { color: rgb(0,128,128); } h1 { color: #008080; }
  • 28. 28 More Properties: Font  font-family: which font will be used  font-size: how large the letters will be drawn  font-style: used to enable/disable italic style  font-weight: used to enable/disable bold style  For examples on how to set these and other properties, see:  http://www.w3schools.com/css/css_reference.asp  http://www.tizag.com/cssT/reference.php
  • 29. 29 Attaching a CSS File: <link />  Copy the rel and type attributes and their corresponding values verbatim  Use the href attribute to specify the location of a stylesheet file  Path location may be absolute or relative <head> <title>...</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head>
  • 30. 30 CSS Resources  CSS property references:  http://www.w3schools.com/css/css_reference.asp  http://www.tizag.com/cssT/reference.php  CSS tutorial:  http://www.tizag.com/cssT/  CSE 190 M (Web Programming) lecture notes:  http://www.cs.washington.edu/education/courses/cse190m/Curre ntQtr/lectures/slides/lecture03-basic_css.html