SlideShare a Scribd company logo
UNIT II- UI DESIGN
 Markup Language (HTML): Introduction to HTML and HTML5 -
Formatting and Fonts –Commenting Code – Anchors – Backgrounds
– Images – Hyperlinks – Lists – Tables – Frames - HTML Forms.
Cascading Style Sheet (CSS): The need for CSS, Introduction to CSS –
Basic syntax and structure -Inline Styles – Embedding Style Sheets -
Linking External Style Sheets – Backgrounds – Manipulating text -
Margins and Padding - Positioning using CSS.
Markup Language (HTML):
Introduction to HTML and HTML5
 Books  written  English
 Web page  written  HTML.
HyperText Markup Language
 Web pages are text files.
 The key to hypertext is the use of
hyperlinks, which allow you to jump from
one topic to another.
What is HTML
 HTML describes the content
content and format
format
of web pages using tags.
Ex. Title Tag: <title>A title </title>
 It’s the job of the web browser to interpret
tags and display the content accordingly.
HTML Syntax
 An HTML file contains both formatting
formatting
tags
tags and content
content
 Document content is what we see on the
webpage.
 Tags are the HTML codes that control the
appearance of the document content.
HTML Syntax
 HTML syntax:
two-sided tag:
<tag attributes>document content</tag>
Starting
tag
Properties of the
tag.
Optional!
Actual content appears in
webpage. It could be empty
Closing
tag
Examples: <p> CGS 2100 </p>
<body bgcolor = “yellow”> UCF </body>
HTML Syntax
 HTML syntax:
one-sided tag:
<tag />
e.g. Breaking line tag: <br/>
Horizontal line tag: <hr/>
Structure of the web page
 Starting with the tag <html>...</html>
<html>
.......
</html>
Everything about
the web page
should be
enclosed here
Structure of the web page
 Inside the <html></html> tag
 Each web page has a head
head part described in
<head></head> tag:
<html>
<head>
<title> CGS 2100 </title>
</head>
</html>
The title of the
web page
should be put
here
Structure of the web page
 Inside the <html></html> tag
 Each web page has a body
body part described in <body></body>
tag:
<html>
<head>
<title> CGS 2100 </title>
</head>
<body>
This is a sample HTML file.
</body>
</html>
The content of
the whole web
page should be
put here
Title
Body
Create a basic HTML file
 Open your text editor (notepad
notepad).
 Type the following lines of code into the document:
<html>
<head>
<title> CGS2100 lab section</title>
</head>
<body>
This is a sample HTML file.
</body>
</html>
Create a basic HTML file (cont)
 Save the file as sample.htm
sample.html
Formatting and Fonts in HTML
Introduction to some common tags
 Paragraph tag
 List tag
 Hyperlink tags
Paragraph tags <p>...</p>
 <html>
 <head>
 <title> CGS 2100 </title>
 </head>
 <body>
 <p> Here is the first paragraph. </p>
 <p> Here is the second paragraph. </p>
 </body>
 </html>
result
First paragraph
Second paragraph
Space between
paragraphs
List tags
Ordered list: used to display information in a numeric
order. The syntax for creating an ordered list is:
<ol > e.g. <ol >
<li>item1 </li> <li> Name: Your name </li>
<li>item2 </li> <li> Section: ### </li>
… <li> Instructor: Yuping </li>
</ol> </ol>
 Result:
List tags
Unordered list: list items are not listed in
a particular order. The syntax is:
<ul > e.g. <ul>
<li>item1 </li> <li> Name: Your name </li>
<li>item2 </li> <li> Section: ### </li>
… <li> Instructor: Yuping </li>
</ul> </ul>
 Result
Hyperlink(anchors)
 Link to another location or file
 Syntax:
<a href= “http://www.ucf.edu”> Link to UCF </a>
Starting
Starting
Tag
Tag
Attribute of the tag: the address of
Attribute of the tag: the address of
the hyperlink
the hyperlink
Content displayed on
Content displayed on
the page
the page
Ending tag
Ending tag
Result:
Link
 Link to web site
 <a href= “http://www.ucf.edu”> Link to UCF </a>
 Link to document
<a href=“http://www.eecs.ucf.edu/images/building.jpg”>Link</a>
 Email link
<a href= “mailto:name@domain.com”> Link to email </a>
Include a Picture
 <img src=“FILENAME” />
 <img src=“FILENAME” alt=“text” />
 E.g.
 <img src=“logo.gif” alt=“Google logo” />
 <img src=“logo.gif” />
HTML – Tables
Why tables are important:
• to maintain the elements of your website
• to be creative with the design of pages
• to separate & organize different formatting styles
• map out your table(s) on paper first (pg. 144)
• figure out how many rows and columns
• determine the width (600 pixels is standard)
• keeping your table simple at first helps
• look for ideas on the internet (sample), save
the page, and then view it in Dreamweaver.
Creating Tables:
<table> to begin table
<tr> defines beginning of first row
<td> defines beginning of the cell
</td> to complete cell
</tr> to complete row
</table> to end table
Basic Table tags:
Table Code: in Notepad
These attributes all rest inside the first table tag:
<table
border=0 (invisible border – very common)
border=10 (by default takes up 2 pixels of space)
bordercolor=“red”
bgcolor=“yellow”
width=320 (there is a height tag but not often used)
align=center (left or right) (allows text to wrap)
<br clear=left or right or all> (to stop wrap)
valign=top (top, middle, bottom or baseline)
hspace=20 vspace=20 (border around picture)
colspan=2 (cell spanning more then one column)
rowspan=2 (cell spanning more then one row)
>
Table Code: Exploring Different Attributes
cellspacing=0 determines the number of pixels
between each cell
(default is 2 pixels)
cellpadding=0 determines the number of pixels
between the contents and the cell
wall
(default is 1 pixel)
Setting cells to =0 is common in layout design
<!--browsers can be finicky so make sure to set
border=0 to ensure there is no space between any
web page elements (if desired)-->
Table Code: cellspacing and cellpadding (pg. 155)
HTML – Lists (11% of test)
(pg. 135)
Why lists are important:
• they are widely used on links pages
• they help in the organization of data
• they are quick and easy to create
Creating Lists:
• first determine the style of list
• then determine the content
(sometimes writing this out first helps)
• there are two main types of lists:
• ordered lists: perfect for giving step-by-step
instructions to a visitor
(numbers, roman numerals or letters)
• unordered lists: mostly used to simply list items
on a web page such as links
(discs, round or square bullets)
<ol> to begin ordered list
<li> list item </li>
</ol> to end ordered list
<ul> to begin unordered list
<li> list item </li>
</ul> to end unordered list
Basic List tags:
List Code: in Notepad
These all rest inside the first list tag:
<ol
type=I or i (for large or small roman numerals)
type=A or a (for capital or small letters)
type=1 (for numbers, which is the default)
>
<ul
type=disc (the default for first level lists)
type=round (the default for second level lists)
type=square (the default for third level lists)
>
List Code: Exploring Different Attributes
Nested Lists are useful for creating website
site maps , and are simply just lists inside of lists:
<ol>
<li> Introduction </li>
<ol> <!-- indenting helps organize code -->
<li> Are lists fun? </li>
<li> Are lists not fun? </li>
</ol>
<li> Conclusion </li>
<ol>
<li> Lists are fun  </li>
<li> Lists are not fun  </li>
</ol>
</ol>
List Code: Nested Lists (pg.141)
HTML – Links (9% of test)
(pg. 117)
Why links are important:
• to let visitors easily browse your webpages
• to execute or download files (ie. movies, pdf’s, etc.)
• to create the ability to browse via a text or image
• to let users easily move to & from a particular spot
Links have three parts: destination, label & target
• destination: determines where link will go
(another page, a movie or an anchor)
• label: determines what visitors see and click on
(text, image or combination)
• target: determines where destination is seen
(in new window or frame, etc.) (pg. 122)
Creating Links:
• Absolute: shows entire path to file “elephant.jpg”
(http://www.site.com/web/images/elephant.jpg)
• Relative: seen when on website (zoo.html)
(“images/elephant.jpg”)
Another type of link is:
• Local: an anchor to and from a particular spot
(not on test)
(<a href=“#bottom”>Go to Bottom</a>)
(<a name=“bottom”></a>)
Two types of Links: Absolute & Relative
Relative: as if going to page on your site
<a href=“welcome.html”>Welcome</a>
Absolute: as if going to another site
<a href=
“http://www.ibm.com/web/home.html”>
IBM Home</a>
Basic Link tags:
Link Code: in Notepad
Changing the color of links:
Must reside in the <body tag:
link= changes color of link not used yet
vlink= changes color of link already visited
alink= changes color of link when clicked
> example: (<body link=“black”>)
<!-- used to coordinate colors on pages.
If a clients website is black & red, you may not want to
have the standard blue links.
Viewers still need to know it’s a link-->
Link Code: Exploring Different Attributes
Link Pages to Make a Website:
aboutus.htm l services.htm l contactus.htm l
m arketing.htm l
hom e.htm l
index.htm l
Write out an organization chart for the
pages your website will contain.
* most browsers only
look for index.html
(contain meta tags)
Link Pages to Make a Website:
• create a new folder on your desktop
(site name?) (remember to use lowercase)
• in notepad create index.html (in folder)
• in notepad create the home, aboutus,
services and contactus pages
• create folder in website called marketing
and create a page called marketing.html
• link all the pages
Frames
 use one or more
frameset elements
rather than one body
element
43
Forms
 radio button vs.
checkbox
 entity reference
44
Cascading Style Sheets (CSS)
The need for CSS..
 HTML markup can be used to represent
 Semantics: h1 means that an element is a top-level heading
 Presentation: h1 elements look a certain way
 It’s advisable to separate semantics from presentation
because:
 It’s easier to present documents on multiple platforms
(browser, cell phone, spoken, …)
 It’s easier to generate documents with consistent look
 Semantic and presentation changes can be made
independently of one another (division of labor)
 User control of presentation is facilitated
Style Sheet Languages
 Cascading Style Sheets (CSS)
Applies to (X)HTML as well as XML documents
in general
Focus of this chapter
 Extensible Stylesheet Language (XSL)
Often used to transform one XML document to
another form, but can also add style
XSL Transformations covered in later chapter
CSS Introduction
 A styled HTML document
produced by the style sheet style1.css:
CSS Introduction
link element associates style sheet with doc.
CSS Introduction
type attribute specifies style language used
CSS Introduction
href attribute provides style sheet URL
CSS Introduction
title attribute provides style sheet name
CSS Introduction
Alternative, user selectable style sheets
can be specified
CSS Introduction
CSS Introduction
 A styled HTML document
produced by the style sheet style2.css:
CSS Introduction
Note that alternate, user selectable style is
not widely supported: firefox 3 and IE 8 do,
but IE 6, IE 7 and Chrome don’t.
CSS Introduction
 Single document can be displayed on multiple
media platforms by tailoring style sheets:
This document will be printed differently than
it is displayed.
BASIC SYNTAX AND STRUCTURE…
 Parts of a style rule (or statement)
CSS Syntax:
Selector Strings
 Single element type:
 Multiple element types:
 All element types:
 Specific elements by id:
CSS Syntax:
Selector Strings
CSS Syntax:
Selector Strings
 Elements belonging to a style class:
Referencing a style class in HTML:
 Elements of a certain type and class:
class selector: begins with a period .
CSS Syntax:
Selector Strings
 Elements belonging to a style class:
Referencing a style class in HTML:
 Elements of a certain type and class:
this span belongs to three style classes
CSS Syntax:
Selector Strings
 Elements belonging to a style class:
Referencing a style class in HTML:
 Elements of a certain type and class:
this rule applies only to span’s belonging to class special
CSS Syntax:
Selector Strings
 Source anchor elements:
 Element types that are descendents:
pseudo-classes
CSS Syntax:
Selector Strings
 Source anchor elements:
 Element types that are descendants:
rule applies to li element that is
CSS Syntax:
Selector Strings
 Source anchor elements:
 Element types that are descendants:
rule applies to li element that is
part of the content of an ol element
CSS Syntax:
Selector Strings
 Source anchor elements:
 Element types that are descendants:
rule applies to li element that is
part of the content of an ol element
that is part of the content of a ul element
CSS Syntax
 Style rules covered thus far follow ruleset
syntax
 At-rule is a second type of rule
Reads style rules from specified URL
Must appear at beginning of style sheet
URL relative to style sheet URL
Style Sheets and HTML
 Style sheets referenced by link HTML element
are called external style sheets
 Style sheets can be embedded directly in HTML
document using style element
 Most HTML elements have style attribute (value
is list of style declarations)
Style sheet & HTML
 If any XML special characters, such as
less-than (<) or ampersand (&), appears in
style rules then the character must be
replaced by appropriate entity or character
reference.
 Such reference should not be use in
external stylesheet.
Style Sheets & HTML
 HTML 4.01 suggests enclosing the content of style
element within an SGML comment. For example.
<style type=“text/css”>
<!—
H1,h2{background-color:aqua}

</style>
Media attributes
<link rel=“stylesheet” type=“Text/css”
media=“screen, tv, projection”/>
<link rel=“stylesheet” type=“Text/css”
media=“handheld,print”/>
CSS Rule Cascade
 What if more than one style declaration
applies to a property of an element?
 The CSS rule cascade determines which
style rule’s declaration applies
CSS Rule Cascade
To find the value for an element/property
combination, user agents must apply the
following sorting order:
1- Find all declarations that apply to the
element and property in question, for the
target media type. Declarations apply if the
associated selector matches the element in
question.
CSS Rule Cascade
2- The primary sort of the declarations is
by weight and origin: for normal
declarations, author style sheets
override user style sheets which
override the default style sheet. For "!
important" declarations, user style
sheets override author style sheets
which override the default style sheet. "!
important" declaration override normal
declarations. An imported style sheet
has the same origin as the style sheet
that imported it.
Five origin/weight levels:
1. user/important
2. author/important
3. author/normal
4. user/normal
5. user agent/normal
CSS Rule Cascade
3- The secondary sort is by specificity of selector: more
specific selectors will override more general ones.
Pseudo-elements and pseudo-classes are counted as
normal elements and classes, respectively.
Specificity:
1. style attribute
2. rule with selector:
1. ID
2. class/pseudo-class
3. descendant/element type
4. universal
3. HTML attribute
CSS Rule Cascade
4- Finally, sort by order specified: if two rules have the
same weight, origin and specificity, the latter specified
wins. Rules in imported style sheets are considered to
be before any rules in the style sheet itself.
Conceptually, create one
long style sheet. Later
style rules have higher
priority than earlier rules.
CSS Inheritance
 What if no style declaration applies to a
property of an element?
 Generally, the property value is inherited from
the nearest ancestor element that has a value
for the property
 If no ancestor has a value (or the property
does not inherit) then CSS defines an initial
value that is used
CSS Inheritance
CSS Inheritance
 Property values:
Specified: value contained in declaration
 Absolute: value can be determined without reference to
context (e.g., 2cm)
 Relative: value depends on context (e.g., larger)
Computed: absolute representation of relative
value (e.g., larger might be 1.2 x parent font
size)
Actual: value actually used by browser (e.g.,
computed value might be rounded)
CSS Inheritance
 Most properties inherit computed value
Exception discussed later: line-height
 A little thought can usually tell you whether
a property inherits or not
Example: height does not inherit
 Inline Styles – Embedding Style Sheets -
Linking External Style Sheets – Backgrounds
– Manipulating text - Margins and Padding -
Positioning using CSS.
CSS Font Properties
Glyph (visual representation)
character cell
(content area)
 A font is a mapping from code points to glyphs
CSS Font Properties
 A font is a mapping from code points to glyphs
glyphs do not necessary stay inside cells!
CSS Font Properties
 A font family is a collection of related fonts
(typically differ in size, weight, etc.)
 font-family property can accept a list of
families, including generic font families
first choice font
CSS Font Properties
 A font family is a collection of related fonts
(typically differ in size, weight, etc.)
 font-family property can accept a list of
families, including generic font families
second choice font
CSS Font Properties
 A font family is a collection of related fonts
(typically differ in size, weight, etc.)
 font-family property can accept a list of
families, including generic font families
generic
CSS Font Properties
generic
fonts are
system-
specific
CSS Font Properties
 Note that most generic font can be easily
set on Firefox and Chrome, but such
option doesn’t seem to be available on IE
7 and 8. IE will still default to something
although maybe not what you had hoped
for!
CSS Font Properties
 Many properties, such as font-size, have a value that
is a CSS length
 All CSS length values except 0 need units
CSS Font Properties
Computed value
of font-size
property
CSS Font Properties
 Reference font defines em and ex units
Normally, reference font is the font of the
element being styled
Exception: Using em/ex to specify value for
font-size
parent element’s font is
reference font
CSS Font Properties
 Other ways to specify value for
font-size:
Percentage (of parent font-size)
Absolute size keyword: xx-small, x-small,
small, medium (initial value), large,
x-large, xx-large
 User agent specific; should differ by ~ 20%
Relative size keyword: smaller, larger
 Relative to parent element’s font
CSS Font Properties
CSS Font Properties
 Text is rendered using line boxes
 Height of line box given by line-height
 Initial value: normal (i.e., cell height; relationship with
em height is font-specific)
 Other values (following are equivalent):
CSS Font Properties
 When line-height is greater than cell height:
 Inheritance of line-height:
Specified value if normal or unit-less number
Computed value otherwise
CSS Font Properties
 font shortcut property:
CSS Font Properties
 font shortcut property:
Initial values used if no value specified in font
property list (that is, potentially reset)
CSS Font Properties
 font shortcut property:
specifying line-height (here, twice cell height)
any order size and family required,
order-dependent
CSS Text Formatting
CSS Text Color
 Font color specified by color property
 Two primary ways of specifying colors:
Color name: black, gray, silver, white, red,
lime, blue, yellow, aqua, fuchsia, maroon,
green, navy, olive, teal, purple, full list at
http://www.w3.org/TR/SVG11/types.html#Colo
rKeywords
red/green/blue (RGB) values
CSS Text Color
CSS Text Color
CSS Box Model
 Every rendered element occupies a box:
(or inner edge)
(or outer edge)
CSS Box Model
CSS Box Model
CSS Box Model
CSS Box Model
CSS Box Model
CSS Box Model
CSS Box Model
CSS Box Model
CSS Box Model
 If multiple declarations apply to a property,
the last declaration overrides earlier
specifications
Left border is 30px wide,
inset style, and red
Backgrounds
 background-color
Specifies background color for content, padding,
and border areas
Margin area is always transparent
Not inherited; initial value transparent
 background-image
Specifies (using url() function) image that will
be tiled over an element
Backgrounds
<body style="background-image:url('CucumberFlowerPot.png')">
Normal Flow Layout
 In normal flow processing, each displayed
element has a corresponding box
html element box is called initial containing block and
corresponds to entire document
Boxes of child elements are contained in boxes of
parent
Sibling block elements are laid out one on top of the
other
Sibling inline elements are one after the other
Normal Flow Layout
(body)
(html)
Normal Flow Layout
Block
elements
only
Normal Flow Layout
html
body
div d1
div d2
div d3
div d4
Top edges of
block boxes are
in document order
Normal Flow Layout
 What is a “block element”?
Element with value block specified for its
display property
User agent style sheet (not CSS) specifies default
values; typical block elements include html, body,
p, pre, div, form, ol, ul, dl, hr, h1 through h6
Most other elements except li and table-related
have inline specified for display
Normal Flow Layout
 When blocks stack, adjacent margins are
collapsed to the size of the larger margin
Normal Flow Layout
 Initial value of width property is auto, which for
block boxes means to make the content area as
wide as possible within margin/padding
constraints:
Width of block boxes
increases as browser
client area is widened
Normal Flow Layout
 Can also specify CSS length or
percentage (of parent’s content width) for
width property
By default, width of right margin is
adjusted to accommodate a change to
width
Normal Flow Layout
 Can also specify CSS length or
percentage (of parent’s content width) for
width property
Centering can be achieved by setting
both margins to auto
Normal Flow Layout
 Boxes corresponding to character cells
and inline elements are laid out side by
side in line boxes that are stacked one on
top of the other
Character cells aligned by baseline
Heights
based on
content
Normal Flow Layout
Padding/borders/margins affect width
but not height of inline boxes
Normal Flow Layout
 Specify value for vertical-align to
position an inline element within line box:
initial
value of
vertical-
align
Beyond Normal Flow
 CSS allows for boxes to be positioned
outside the normal flow:
Relative positioning
span’s shifted backwards relative to normal flow
Beyond Normal Flow
 CSS allows for boxes to be positioned
outside the normal flow:
Float positioning
span taken out of normal
flow and “floated” to the
left of its line box
Beyond Normal Flow
 CSS allows for boxes to be positioned
outside the normal flow:
Absolute positioning
span’s removed from
normal flow and
positioned relative
to another box
Beyond Normal Flow
 Properties used to specify positioning:
position: static (initial value), relative, or
absolute
 Element is positioned if this property not static
 Properties left, right, top, bottom apply to positioned
elements
 Primary values are auto (initial value) or CSS length
float: none, left, or right
 Applies to elements with static and relative positioning
only
Beyond Normal Flow
 Relative positioning
Specifying positive value for right property
of relatively positioned box moves it to left
<span style="background-color:red">&nbsp;&nbsp;&nbsp;&nbsp;
</span><span class="right">Red</span>
span
containing
text moves
left
Beyond Normal Flow
 Relative positioning
Specifying negative value for left property
also moves box to left
<span style="background-color:red">&nbsp;&nbsp;&nbsp;&nbsp;
</span><span class="right">Red</span>
same
effect as
before
Beyond Normal Flow
 Float positioning
Specify value for float property
Beyond Normal Flow
 Float positioning
Specify value for float property
Floated element becomes a CSS block
element (e.g., can set height and width)
Beyond Normal Flow
 Absolute positioning
Specify location for corner of box relative to
positioned containing block
margin area
padding area
containing
block
This second paragraph has a
note.
p elements are positioned (but don’t move!)
Beyond Normal Flow
 Absolute positioning
Specify location for edges of box relative to
positioned containing block
Beyond Normal Flow
 Absolute positioning
10em padding top
edge
padding left
edge
Beyond Normal Flow
 Absolute positioning
8em
Beyond Normal Flow
 Absolutely positioned box does not affect
positioning of other boxes!
Second absolutely
positioned box
obscures first
CSS Position-Related Properties
 z-index: drawing order for overlaid
boxes (largest number drawn last)
CSS Position-Related Properties
 display: value none means that element
and its descendants are not rendered and
do not affect normal flow
 visibility: value hidden (initial value
is visible) means that element and its
descendants are not rendered but still do
affect normal flow
 UNIT 2…CONCLUDES
Ad

More Related Content

Similar to Introduction to HTML, CSS, and Scripting In the world of web development, three core technologies form the foundation of every website and web application (20)

Chapter 2 Notes, MCQs, and QA (HTML and CSS).pdf
Chapter 2 Notes, MCQs, and QA (HTML and CSS).pdfChapter 2 Notes, MCQs, and QA (HTML and CSS).pdf
Chapter 2 Notes, MCQs, and QA (HTML and CSS).pdf
rehansayyadgolden07
 
Html
HtmlHtml
Html
yugank_gupta
 
Introduction to Web Techniques_Key componenets_HTML Basics
Introduction to Web Techniques_Key componenets_HTML BasicsIntroduction to Web Techniques_Key componenets_HTML Basics
Introduction to Web Techniques_Key componenets_HTML Basics
DeepakUlape2
 
Html4
Html4Html4
Html4
BalaKrishna Kolliboina
 
UNIT 3 presentation for subj ITWS 01.pptx
UNIT 3 presentation for subj ITWS 01.pptxUNIT 3 presentation for subj ITWS 01.pptx
UNIT 3 presentation for subj ITWS 01.pptx
MarkAnthonyArenasGio
 
Workshop 2 Slides.pptx
Workshop 2 Slides.pptxWorkshop 2 Slides.pptx
Workshop 2 Slides.pptx
DaniyalSardar
 
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
brianbyamukama302
 
Html
HtmlHtml
Html
Alisha Kalidhar
 
IntroHTMzczczscasasaklahduasihiaSUJScgGJKKL.ppt
IntroHTMzczczscasasaklahduasihiaSUJScgGJKKL.pptIntroHTMzczczscasasaklahduasihiaSUJScgGJKKL.ppt
IntroHTMzczczscasasaklahduasihiaSUJScgGJKKL.ppt
diciembrejatcs
 
Week 2-intro-html
Week 2-intro-htmlWeek 2-intro-html
Week 2-intro-html
Shawn Calvert
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
butest
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
butest
 
PHP HTML CSS Notes
PHP HTML CSS  NotesPHP HTML CSS  Notes
PHP HTML CSS Notes
Tushar Rajput
 
Intro to html revised2
Intro to html revised2Intro to html revised2
Intro to html revised2
mmvidanes29
 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop Notes
Pamela Fox
 
Html
HtmlHtml
Html
-jyothish kumar sirigidi
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
Abzetdin Adamov
 
HTML introduction for beginners Slides .pptx
HTML introduction for beginners Slides .pptxHTML introduction for beginners Slides .pptx
HTML introduction for beginners Slides .pptx
wewit44414
 
Teched Inetrgation ppt and lering in simple
Teched Inetrgation ppt  and lering in simpleTeched Inetrgation ppt  and lering in simple
Teched Inetrgation ppt and lering in simple
JagadishBabuParri
 
Html, css and jquery introduction
Html, css and jquery introductionHtml, css and jquery introduction
Html, css and jquery introduction
cncwebworld
 
Chapter 2 Notes, MCQs, and QA (HTML and CSS).pdf
Chapter 2 Notes, MCQs, and QA (HTML and CSS).pdfChapter 2 Notes, MCQs, and QA (HTML and CSS).pdf
Chapter 2 Notes, MCQs, and QA (HTML and CSS).pdf
rehansayyadgolden07
 
Introduction to Web Techniques_Key componenets_HTML Basics
Introduction to Web Techniques_Key componenets_HTML BasicsIntroduction to Web Techniques_Key componenets_HTML Basics
Introduction to Web Techniques_Key componenets_HTML Basics
DeepakUlape2
 
UNIT 3 presentation for subj ITWS 01.pptx
UNIT 3 presentation for subj ITWS 01.pptxUNIT 3 presentation for subj ITWS 01.pptx
UNIT 3 presentation for subj ITWS 01.pptx
MarkAnthonyArenasGio
 
Workshop 2 Slides.pptx
Workshop 2 Slides.pptxWorkshop 2 Slides.pptx
Workshop 2 Slides.pptx
DaniyalSardar
 
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
brianbyamukama302
 
IntroHTMzczczscasasaklahduasihiaSUJScgGJKKL.ppt
IntroHTMzczczscasasaklahduasihiaSUJScgGJKKL.pptIntroHTMzczczscasasaklahduasihiaSUJScgGJKKL.ppt
IntroHTMzczczscasasaklahduasihiaSUJScgGJKKL.ppt
diciembrejatcs
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
butest
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
butest
 
Intro to html revised2
Intro to html revised2Intro to html revised2
Intro to html revised2
mmvidanes29
 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop Notes
Pamela Fox
 
HTML introduction for beginners Slides .pptx
HTML introduction for beginners Slides .pptxHTML introduction for beginners Slides .pptx
HTML introduction for beginners Slides .pptx
wewit44414
 
Teched Inetrgation ppt and lering in simple
Teched Inetrgation ppt  and lering in simpleTeched Inetrgation ppt  and lering in simple
Teched Inetrgation ppt and lering in simple
JagadishBabuParri
 
Html, css and jquery introduction
Html, css and jquery introductionHtml, css and jquery introduction
Html, css and jquery introduction
cncwebworld
 

Recently uploaded (20)

IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
Compiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptxCompiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptx
RushaliDeshmukh2
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
Compiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptxCompiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptx
RushaliDeshmukh2
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
Ad

Introduction to HTML, CSS, and Scripting In the world of web development, three core technologies form the foundation of every website and web application

  • 1. UNIT II- UI DESIGN  Markup Language (HTML): Introduction to HTML and HTML5 - Formatting and Fonts –Commenting Code – Anchors – Backgrounds – Images – Hyperlinks – Lists – Tables – Frames - HTML Forms. Cascading Style Sheet (CSS): The need for CSS, Introduction to CSS – Basic syntax and structure -Inline Styles – Embedding Style Sheets - Linking External Style Sheets – Backgrounds – Manipulating text - Margins and Padding - Positioning using CSS.
  • 2. Markup Language (HTML): Introduction to HTML and HTML5  Books  written  English  Web page  written  HTML. HyperText Markup Language  Web pages are text files.  The key to hypertext is the use of hyperlinks, which allow you to jump from one topic to another.
  • 3. What is HTML  HTML describes the content content and format format of web pages using tags. Ex. Title Tag: <title>A title </title>  It’s the job of the web browser to interpret tags and display the content accordingly.
  • 4. HTML Syntax  An HTML file contains both formatting formatting tags tags and content content  Document content is what we see on the webpage.  Tags are the HTML codes that control the appearance of the document content.
  • 5. HTML Syntax  HTML syntax: two-sided tag: <tag attributes>document content</tag> Starting tag Properties of the tag. Optional! Actual content appears in webpage. It could be empty Closing tag Examples: <p> CGS 2100 </p> <body bgcolor = “yellow”> UCF </body>
  • 6. HTML Syntax  HTML syntax: one-sided tag: <tag /> e.g. Breaking line tag: <br/> Horizontal line tag: <hr/>
  • 7. Structure of the web page  Starting with the tag <html>...</html> <html> ....... </html> Everything about the web page should be enclosed here
  • 8. Structure of the web page  Inside the <html></html> tag  Each web page has a head head part described in <head></head> tag: <html> <head> <title> CGS 2100 </title> </head> </html> The title of the web page should be put here
  • 9. Structure of the web page  Inside the <html></html> tag  Each web page has a body body part described in <body></body> tag: <html> <head> <title> CGS 2100 </title> </head> <body> This is a sample HTML file. </body> </html> The content of the whole web page should be put here
  • 11. Create a basic HTML file  Open your text editor (notepad notepad).  Type the following lines of code into the document: <html> <head> <title> CGS2100 lab section</title> </head> <body> This is a sample HTML file. </body> </html>
  • 12. Create a basic HTML file (cont)  Save the file as sample.htm
  • 15. Introduction to some common tags  Paragraph tag  List tag  Hyperlink tags
  • 16. Paragraph tags <p>...</p>  <html>  <head>  <title> CGS 2100 </title>  </head>  <body>  <p> Here is the first paragraph. </p>  <p> Here is the second paragraph. </p>  </body>  </html>
  • 18. List tags Ordered list: used to display information in a numeric order. The syntax for creating an ordered list is: <ol > e.g. <ol > <li>item1 </li> <li> Name: Your name </li> <li>item2 </li> <li> Section: ### </li> … <li> Instructor: Yuping </li> </ol> </ol>  Result:
  • 19. List tags Unordered list: list items are not listed in a particular order. The syntax is: <ul > e.g. <ul> <li>item1 </li> <li> Name: Your name </li> <li>item2 </li> <li> Section: ### </li> … <li> Instructor: Yuping </li> </ul> </ul>  Result
  • 20. Hyperlink(anchors)  Link to another location or file  Syntax: <a href= “http://www.ucf.edu”> Link to UCF </a> Starting Starting Tag Tag Attribute of the tag: the address of Attribute of the tag: the address of the hyperlink the hyperlink Content displayed on Content displayed on the page the page Ending tag Ending tag Result:
  • 21. Link  Link to web site  <a href= “http://www.ucf.edu”> Link to UCF </a>  Link to document <a href=“http://www.eecs.ucf.edu/images/building.jpg”>Link</a>  Email link <a href= “mailto:name@domain.com”> Link to email </a>
  • 22. Include a Picture  <img src=“FILENAME” />  <img src=“FILENAME” alt=“text” />  E.g.  <img src=“logo.gif” alt=“Google logo” />  <img src=“logo.gif” />
  • 23. HTML – Tables Why tables are important: • to maintain the elements of your website • to be creative with the design of pages • to separate & organize different formatting styles
  • 24. • map out your table(s) on paper first (pg. 144) • figure out how many rows and columns • determine the width (600 pixels is standard) • keeping your table simple at first helps • look for ideas on the internet (sample), save the page, and then view it in Dreamweaver. Creating Tables:
  • 25. <table> to begin table <tr> defines beginning of first row <td> defines beginning of the cell </td> to complete cell </tr> to complete row </table> to end table Basic Table tags:
  • 26. Table Code: in Notepad
  • 27. These attributes all rest inside the first table tag: <table border=0 (invisible border – very common) border=10 (by default takes up 2 pixels of space) bordercolor=“red” bgcolor=“yellow” width=320 (there is a height tag but not often used) align=center (left or right) (allows text to wrap) <br clear=left or right or all> (to stop wrap) valign=top (top, middle, bottom or baseline) hspace=20 vspace=20 (border around picture) colspan=2 (cell spanning more then one column) rowspan=2 (cell spanning more then one row) > Table Code: Exploring Different Attributes
  • 28. cellspacing=0 determines the number of pixels between each cell (default is 2 pixels) cellpadding=0 determines the number of pixels between the contents and the cell wall (default is 1 pixel) Setting cells to =0 is common in layout design <!--browsers can be finicky so make sure to set border=0 to ensure there is no space between any web page elements (if desired)--> Table Code: cellspacing and cellpadding (pg. 155)
  • 29. HTML – Lists (11% of test) (pg. 135) Why lists are important: • they are widely used on links pages • they help in the organization of data • they are quick and easy to create
  • 30. Creating Lists: • first determine the style of list • then determine the content (sometimes writing this out first helps) • there are two main types of lists: • ordered lists: perfect for giving step-by-step instructions to a visitor (numbers, roman numerals or letters) • unordered lists: mostly used to simply list items on a web page such as links (discs, round or square bullets)
  • 31. <ol> to begin ordered list <li> list item </li> </ol> to end ordered list <ul> to begin unordered list <li> list item </li> </ul> to end unordered list Basic List tags:
  • 32. List Code: in Notepad
  • 33. These all rest inside the first list tag: <ol type=I or i (for large or small roman numerals) type=A or a (for capital or small letters) type=1 (for numbers, which is the default) > <ul type=disc (the default for first level lists) type=round (the default for second level lists) type=square (the default for third level lists) > List Code: Exploring Different Attributes
  • 34. Nested Lists are useful for creating website site maps , and are simply just lists inside of lists: <ol> <li> Introduction </li> <ol> <!-- indenting helps organize code --> <li> Are lists fun? </li> <li> Are lists not fun? </li> </ol> <li> Conclusion </li> <ol> <li> Lists are fun  </li> <li> Lists are not fun  </li> </ol> </ol> List Code: Nested Lists (pg.141)
  • 35. HTML – Links (9% of test) (pg. 117) Why links are important: • to let visitors easily browse your webpages • to execute or download files (ie. movies, pdf’s, etc.) • to create the ability to browse via a text or image • to let users easily move to & from a particular spot
  • 36. Links have three parts: destination, label & target • destination: determines where link will go (another page, a movie or an anchor) • label: determines what visitors see and click on (text, image or combination) • target: determines where destination is seen (in new window or frame, etc.) (pg. 122) Creating Links:
  • 37. • Absolute: shows entire path to file “elephant.jpg” (http://www.site.com/web/images/elephant.jpg) • Relative: seen when on website (zoo.html) (“images/elephant.jpg”) Another type of link is: • Local: an anchor to and from a particular spot (not on test) (<a href=“#bottom”>Go to Bottom</a>) (<a name=“bottom”></a>) Two types of Links: Absolute & Relative
  • 38. Relative: as if going to page on your site <a href=“welcome.html”>Welcome</a> Absolute: as if going to another site <a href= “http://www.ibm.com/web/home.html”> IBM Home</a> Basic Link tags:
  • 39. Link Code: in Notepad
  • 40. Changing the color of links: Must reside in the <body tag: link= changes color of link not used yet vlink= changes color of link already visited alink= changes color of link when clicked > example: (<body link=“black”>) <!-- used to coordinate colors on pages. If a clients website is black & red, you may not want to have the standard blue links. Viewers still need to know it’s a link--> Link Code: Exploring Different Attributes
  • 41. Link Pages to Make a Website: aboutus.htm l services.htm l contactus.htm l m arketing.htm l hom e.htm l index.htm l Write out an organization chart for the pages your website will contain. * most browsers only look for index.html (contain meta tags)
  • 42. Link Pages to Make a Website: • create a new folder on your desktop (site name?) (remember to use lowercase) • in notepad create index.html (in folder) • in notepad create the home, aboutus, services and contactus pages • create folder in website called marketing and create a page called marketing.html • link all the pages
  • 43. Frames  use one or more frameset elements rather than one body element 43
  • 44. Forms  radio button vs. checkbox  entity reference 44
  • 46. The need for CSS..  HTML markup can be used to represent  Semantics: h1 means that an element is a top-level heading  Presentation: h1 elements look a certain way  It’s advisable to separate semantics from presentation because:  It’s easier to present documents on multiple platforms (browser, cell phone, spoken, …)  It’s easier to generate documents with consistent look  Semantic and presentation changes can be made independently of one another (division of labor)  User control of presentation is facilitated
  • 47. Style Sheet Languages  Cascading Style Sheets (CSS) Applies to (X)HTML as well as XML documents in general Focus of this chapter  Extensible Stylesheet Language (XSL) Often used to transform one XML document to another form, but can also add style XSL Transformations covered in later chapter
  • 48. CSS Introduction  A styled HTML document produced by the style sheet style1.css:
  • 49. CSS Introduction link element associates style sheet with doc.
  • 50. CSS Introduction type attribute specifies style language used
  • 51. CSS Introduction href attribute provides style sheet URL
  • 52. CSS Introduction title attribute provides style sheet name
  • 53. CSS Introduction Alternative, user selectable style sheets can be specified
  • 55. CSS Introduction  A styled HTML document produced by the style sheet style2.css:
  • 56. CSS Introduction Note that alternate, user selectable style is not widely supported: firefox 3 and IE 8 do, but IE 6, IE 7 and Chrome don’t.
  • 57. CSS Introduction  Single document can be displayed on multiple media platforms by tailoring style sheets: This document will be printed differently than it is displayed.
  • 58. BASIC SYNTAX AND STRUCTURE…  Parts of a style rule (or statement)
  • 59. CSS Syntax: Selector Strings  Single element type:  Multiple element types:  All element types:  Specific elements by id:
  • 61. CSS Syntax: Selector Strings  Elements belonging to a style class: Referencing a style class in HTML:  Elements of a certain type and class: class selector: begins with a period .
  • 62. CSS Syntax: Selector Strings  Elements belonging to a style class: Referencing a style class in HTML:  Elements of a certain type and class: this span belongs to three style classes
  • 63. CSS Syntax: Selector Strings  Elements belonging to a style class: Referencing a style class in HTML:  Elements of a certain type and class: this rule applies only to span’s belonging to class special
  • 64. CSS Syntax: Selector Strings  Source anchor elements:  Element types that are descendents: pseudo-classes
  • 65. CSS Syntax: Selector Strings  Source anchor elements:  Element types that are descendants: rule applies to li element that is
  • 66. CSS Syntax: Selector Strings  Source anchor elements:  Element types that are descendants: rule applies to li element that is part of the content of an ol element
  • 67. CSS Syntax: Selector Strings  Source anchor elements:  Element types that are descendants: rule applies to li element that is part of the content of an ol element that is part of the content of a ul element
  • 68. CSS Syntax  Style rules covered thus far follow ruleset syntax  At-rule is a second type of rule Reads style rules from specified URL Must appear at beginning of style sheet URL relative to style sheet URL
  • 69. Style Sheets and HTML  Style sheets referenced by link HTML element are called external style sheets  Style sheets can be embedded directly in HTML document using style element  Most HTML elements have style attribute (value is list of style declarations)
  • 70. Style sheet & HTML  If any XML special characters, such as less-than (<) or ampersand (&), appears in style rules then the character must be replaced by appropriate entity or character reference.  Such reference should not be use in external stylesheet.
  • 71. Style Sheets & HTML  HTML 4.01 suggests enclosing the content of style element within an SGML comment. For example. <style type=“text/css”> <!— H1,h2{background-color:aqua}  </style>
  • 72. Media attributes <link rel=“stylesheet” type=“Text/css” media=“screen, tv, projection”/> <link rel=“stylesheet” type=“Text/css” media=“handheld,print”/>
  • 73. CSS Rule Cascade  What if more than one style declaration applies to a property of an element?  The CSS rule cascade determines which style rule’s declaration applies
  • 74. CSS Rule Cascade To find the value for an element/property combination, user agents must apply the following sorting order: 1- Find all declarations that apply to the element and property in question, for the target media type. Declarations apply if the associated selector matches the element in question.
  • 75. CSS Rule Cascade 2- The primary sort of the declarations is by weight and origin: for normal declarations, author style sheets override user style sheets which override the default style sheet. For "! important" declarations, user style sheets override author style sheets which override the default style sheet. "! important" declaration override normal declarations. An imported style sheet has the same origin as the style sheet that imported it. Five origin/weight levels: 1. user/important 2. author/important 3. author/normal 4. user/normal 5. user agent/normal
  • 76. CSS Rule Cascade 3- The secondary sort is by specificity of selector: more specific selectors will override more general ones. Pseudo-elements and pseudo-classes are counted as normal elements and classes, respectively. Specificity: 1. style attribute 2. rule with selector: 1. ID 2. class/pseudo-class 3. descendant/element type 4. universal 3. HTML attribute
  • 77. CSS Rule Cascade 4- Finally, sort by order specified: if two rules have the same weight, origin and specificity, the latter specified wins. Rules in imported style sheets are considered to be before any rules in the style sheet itself. Conceptually, create one long style sheet. Later style rules have higher priority than earlier rules.
  • 78. CSS Inheritance  What if no style declaration applies to a property of an element?  Generally, the property value is inherited from the nearest ancestor element that has a value for the property  If no ancestor has a value (or the property does not inherit) then CSS defines an initial value that is used
  • 80. CSS Inheritance  Property values: Specified: value contained in declaration  Absolute: value can be determined without reference to context (e.g., 2cm)  Relative: value depends on context (e.g., larger) Computed: absolute representation of relative value (e.g., larger might be 1.2 x parent font size) Actual: value actually used by browser (e.g., computed value might be rounded)
  • 81. CSS Inheritance  Most properties inherit computed value Exception discussed later: line-height  A little thought can usually tell you whether a property inherits or not Example: height does not inherit
  • 82.  Inline Styles – Embedding Style Sheets - Linking External Style Sheets – Backgrounds – Manipulating text - Margins and Padding - Positioning using CSS.
  • 83. CSS Font Properties Glyph (visual representation) character cell (content area)  A font is a mapping from code points to glyphs
  • 84. CSS Font Properties  A font is a mapping from code points to glyphs glyphs do not necessary stay inside cells!
  • 85. CSS Font Properties  A font family is a collection of related fonts (typically differ in size, weight, etc.)  font-family property can accept a list of families, including generic font families first choice font
  • 86. CSS Font Properties  A font family is a collection of related fonts (typically differ in size, weight, etc.)  font-family property can accept a list of families, including generic font families second choice font
  • 87. CSS Font Properties  A font family is a collection of related fonts (typically differ in size, weight, etc.)  font-family property can accept a list of families, including generic font families generic
  • 88. CSS Font Properties generic fonts are system- specific
  • 89. CSS Font Properties  Note that most generic font can be easily set on Firefox and Chrome, but such option doesn’t seem to be available on IE 7 and 8. IE will still default to something although maybe not what you had hoped for!
  • 90. CSS Font Properties  Many properties, such as font-size, have a value that is a CSS length  All CSS length values except 0 need units
  • 91. CSS Font Properties Computed value of font-size property
  • 92. CSS Font Properties  Reference font defines em and ex units Normally, reference font is the font of the element being styled Exception: Using em/ex to specify value for font-size parent element’s font is reference font
  • 93. CSS Font Properties  Other ways to specify value for font-size: Percentage (of parent font-size) Absolute size keyword: xx-small, x-small, small, medium (initial value), large, x-large, xx-large  User agent specific; should differ by ~ 20% Relative size keyword: smaller, larger  Relative to parent element’s font
  • 95. CSS Font Properties  Text is rendered using line boxes  Height of line box given by line-height  Initial value: normal (i.e., cell height; relationship with em height is font-specific)  Other values (following are equivalent):
  • 96. CSS Font Properties  When line-height is greater than cell height:  Inheritance of line-height: Specified value if normal or unit-less number Computed value otherwise
  • 97. CSS Font Properties  font shortcut property:
  • 98. CSS Font Properties  font shortcut property: Initial values used if no value specified in font property list (that is, potentially reset)
  • 99. CSS Font Properties  font shortcut property: specifying line-height (here, twice cell height) any order size and family required, order-dependent
  • 101. CSS Text Color  Font color specified by color property  Two primary ways of specifying colors: Color name: black, gray, silver, white, red, lime, blue, yellow, aqua, fuchsia, maroon, green, navy, olive, teal, purple, full list at http://www.w3.org/TR/SVG11/types.html#Colo rKeywords red/green/blue (RGB) values
  • 104. CSS Box Model  Every rendered element occupies a box: (or inner edge) (or outer edge)
  • 113. CSS Box Model  If multiple declarations apply to a property, the last declaration overrides earlier specifications Left border is 30px wide, inset style, and red
  • 114. Backgrounds  background-color Specifies background color for content, padding, and border areas Margin area is always transparent Not inherited; initial value transparent  background-image Specifies (using url() function) image that will be tiled over an element
  • 116. Normal Flow Layout  In normal flow processing, each displayed element has a corresponding box html element box is called initial containing block and corresponds to entire document Boxes of child elements are contained in boxes of parent Sibling block elements are laid out one on top of the other Sibling inline elements are one after the other
  • 119. Normal Flow Layout html body div d1 div d2 div d3 div d4 Top edges of block boxes are in document order
  • 120. Normal Flow Layout  What is a “block element”? Element with value block specified for its display property User agent style sheet (not CSS) specifies default values; typical block elements include html, body, p, pre, div, form, ol, ul, dl, hr, h1 through h6 Most other elements except li and table-related have inline specified for display
  • 121. Normal Flow Layout  When blocks stack, adjacent margins are collapsed to the size of the larger margin
  • 122. Normal Flow Layout  Initial value of width property is auto, which for block boxes means to make the content area as wide as possible within margin/padding constraints: Width of block boxes increases as browser client area is widened
  • 123. Normal Flow Layout  Can also specify CSS length or percentage (of parent’s content width) for width property By default, width of right margin is adjusted to accommodate a change to width
  • 124. Normal Flow Layout  Can also specify CSS length or percentage (of parent’s content width) for width property Centering can be achieved by setting both margins to auto
  • 125. Normal Flow Layout  Boxes corresponding to character cells and inline elements are laid out side by side in line boxes that are stacked one on top of the other Character cells aligned by baseline Heights based on content
  • 126. Normal Flow Layout Padding/borders/margins affect width but not height of inline boxes
  • 127. Normal Flow Layout  Specify value for vertical-align to position an inline element within line box: initial value of vertical- align
  • 128. Beyond Normal Flow  CSS allows for boxes to be positioned outside the normal flow: Relative positioning span’s shifted backwards relative to normal flow
  • 129. Beyond Normal Flow  CSS allows for boxes to be positioned outside the normal flow: Float positioning span taken out of normal flow and “floated” to the left of its line box
  • 130. Beyond Normal Flow  CSS allows for boxes to be positioned outside the normal flow: Absolute positioning span’s removed from normal flow and positioned relative to another box
  • 131. Beyond Normal Flow  Properties used to specify positioning: position: static (initial value), relative, or absolute  Element is positioned if this property not static  Properties left, right, top, bottom apply to positioned elements  Primary values are auto (initial value) or CSS length float: none, left, or right  Applies to elements with static and relative positioning only
  • 132. Beyond Normal Flow  Relative positioning Specifying positive value for right property of relatively positioned box moves it to left <span style="background-color:red">&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="right">Red</span> span containing text moves left
  • 133. Beyond Normal Flow  Relative positioning Specifying negative value for left property also moves box to left <span style="background-color:red">&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="right">Red</span> same effect as before
  • 134. Beyond Normal Flow  Float positioning Specify value for float property
  • 135. Beyond Normal Flow  Float positioning Specify value for float property Floated element becomes a CSS block element (e.g., can set height and width)
  • 136. Beyond Normal Flow  Absolute positioning Specify location for corner of box relative to positioned containing block margin area padding area containing block This second paragraph has a note. p elements are positioned (but don’t move!)
  • 137. Beyond Normal Flow  Absolute positioning Specify location for edges of box relative to positioned containing block
  • 138. Beyond Normal Flow  Absolute positioning 10em padding top edge padding left edge
  • 139. Beyond Normal Flow  Absolute positioning 8em
  • 140. Beyond Normal Flow  Absolutely positioned box does not affect positioning of other boxes! Second absolutely positioned box obscures first
  • 141. CSS Position-Related Properties  z-index: drawing order for overlaid boxes (largest number drawn last)
  • 142. CSS Position-Related Properties  display: value none means that element and its descendants are not rendered and do not affect normal flow  visibility: value hidden (initial value is visible) means that element and its descendants are not rendered but still do affect normal flow