SlideShare a Scribd company logo
1 of 61
HTML & CSS
Agenda
■ HTML History
■ An HTML Document
■ HTML and Browser
2
Agenda
■ HTML History
■ An HTML Document
■ HTML and Browser
3
HTML History
■ Internet
■ WorldWideWeb (WWW) –
The WorldWide Web (WWW), also called the Web, is an information space where
documents and other web resources are identified by Uniform Resource Locators (URLs),
interlinked by hypertext links, and accessible via the Internet(wiki)
– HTML (Language to create and share doc)
– URL / URI
– HTTP ( Language used to communicate b/w browser and server)
4
Ingredients for web
5
Agenda
■ HTML History
■ An HTML Document
■ HTML and Browser
6
HTML Documents
■ HTML was created to share documents
– text , data , images all linked together
■ HTML is a markup language
– Mean to be processed by a client application( browser )
7
Anatomy of HTML document
■ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><title>Title of the document</title></head>
<body>…Content…</body>
</html>
■ DOCTYPE:
Valid DTD List : https://www.w3.org/QA/2002/04/valid-dtd-list.html
Validate HTML : https://validator.w3.org/
8
Anatomy of HTML document ( Contd.,)
■ Head :
– <title>
– <meta>
<meta name=“keywords” content=“html , html5 ”>
– <script>
<script type=“text/javascript”> window.onload = function (){};</script>
– <style>
<style type=“text/css”> body {color: red }</style>
– <link>
<link rel=“stylesheet” type=“text/css” href=“abc.css”/>
– <base>
<base href=“/”>
9
Anatomy of HTML document ( Contd.,)
■ BODY can have
– Text
– List
– Links
– Tables
– Images / Objects
10
Anatomy of HTML document ( Contd.,)
■ BODY can have
– Text
– List
– Links
– Tables
– Images / Objects
11
BODY -TEXT ( Contd.,)
■ Heading
– Section Heading
■ H1 – Used by search engine ( once per page )
■ H2- H6 – Sub Headings
■ BlockVs Inline Elements
■ Text breaking and whitespace(Ignored in block and inline elements)
■ <pre> whitespace is respected
■ <br/>
■ <hr/>
■ Character entities ( &nbsp; &lt; &gt)
■ Document elements
– <sub> , <sup> , < abbr title=“”>ASAP</abbr> , <accronym> , <strong>
12
Anatomy of HTML document ( Contd.,)
■ BODY can have
– Text
– List
– Links
– Tables
– Images / Objects
13
Anatomy of HTML document ( Contd.,)
■ BODY can have
– Text
– List
– Links
– Tables
– Images / Objects
14
BODY - List ( Contd.,)
■ Un Ordered:
<ul >
■ Attr
– style="list-style-type:none/square/circle/disc“
■ Ordered:
<ol >
■ Attr
– type=“a/A/i/1”
– start=“50”
15
Anatomy of HTML document ( Contd.,)
■ BODY can have
– Text
– List
– Links
– Tables
– Images / Objects
16
Anatomy of HTML document ( Contd.,)
■ BODY can have
– Text
– List
– Links
– Tables
– Images / Objects
17
BODY - Link ( Contd.,)
■ Anchor
– As Source <a name=“abc”/>
■ Eg: <a id=“abc” title=“go there”>TO GO </a>
– <a href=“#abc”>im here</a>
– AsTarget <a href=“.abc.html”
18
Anatomy of HTML document ( Contd.,)
■ BODY can have
– Text
– List
– Links
– Tables
– Images / Objects
19
Anatomy of HTML document ( Contd.,)
■ BODY can have
– Text
– List
– Links
– Tables (rowspan , colspan)
– Images / Objects
20
Anatomy of HTML document ( Contd.,)
■ BODY can have
– Text
– List
– Links
– Tables
– Images / Objects
21
BODY – Images & Objects ( Contd.,)
■ Images
– Reference to image file
■ Objects
– Plugins (Flash/Silverlight etc)
– Videos / Audio
■ <video width="" height="" controls>
<source src=“abc.mp4" type="video/mp4">
Your browser does not support the video tag.</video>
22
Agenda
■ HTML History
■ An HTML Document
■ HTML and Browser
23
24
CSS
CSS History
26
The good, the bad and the… ugly!
27
output
<font size=“1" color="red">Red</font>
<font size=“2" face="verdana"
color="green">Green</font>
<font size=“3" color="blue">Blue</font>
Cascading Style Sheets (CSS)
■ Describes the appearance, layout, and presentation of information on a web page
– HTML describes the content of the page
■ Describes how information is to be displayed, not what is being displayed
■ Can be embedded in HTML document or placed into separate .css file
28
How CSSWorks — Matching
■ Every HTML document represents a document tree
■ The browser uses the tree to determine which rules apply
■ What about inheritance? And conflicts?
29
Basic CSS Style syntax
■ A CSS file consists of one or more rules
■ Each rule starts with a selector
■ A selector specifies an HTML element(s) and then applies style
properties to them
30
selector {
property: value;
property: value;
...
property: value;
} CSS
Selector Property Value
p { font-family: times; }
Note the punctuation:The property is followed by a colon (:) and the value is
followed by a semicolon(;)
CSS
Attaching a CSS file
■ Inline CSS
■ Embedded CSS
■ External CSS
31
Attaching a CSS file – Inline CSS(Contd.,)
■ Higher precedence than embedded or linked styles
■ Used for one-time overrides and styling a particular element
■ Bad style and should be avoided when possible (why?)
32
<p style="font-family: sans-serif; color: red;">
This is a paragraph</p>
HTML
This is a paragraph
output
Attaching a CSS file – Embedded
CSS(Contd.,)
■ CSS code can be embedded within the head of an HTML
page
■ Bad style and should be avoided when possible (why?)
33
<head>
<style type="text/css">
p { font-family: sans-serif; color: red; }
h2 { background-color: yellow; }
</style>
</head>
HTML
Attaching a CSS file – External
CSS(Contd.,)
■ A page can link to multiple style sheet files
– In case of a conflict (two sheets define a style for the same HTML
element), the latter sheet's properties will be used
34
<head>
...
<link href="filename" type="text/css" rel="stylesheet" />
...
</head> HTML
<link href="style.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css“
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/c
ss/bootstrap.min.css"/>
HTML
Box Model
35
CSS Selectors
■ Single element type:
– p {background-color: green }
■ Multiple element types:
– h1, h2 , h3 {background-color: green}
■ All element types:
– * {font-weight: bold}
■ Specific elements by id:
– #a {color : red}
■ Elements belonging to a style class:
– .abc {color : red}
36
CSS Selector ( Contd ., )
■ Elements of a certain type and class:
< span class=“abc”> </span>
■ span.abc {font-size : x-large}
■ Source anchor elements:
37
CSS properties for colors
38
p {
color: green;
background-color: yellow;
}
CSS
This paragraph uses the style above output
property description
color color of the element's text
background-color
color that will appear behind the
element
Specifying colors
■ color names: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy,
olive, purple, red, silver, teal, white (white), yellow
■ RGB codes: red, green, and blue values from 0 (none) to 255 (full)
■ hex codes: RGB values in base-16 from 00 (0, none) to FF (255, full)
39
p { color: green; }
h2 { color: rgb(128, 0, 196); }
h4 { color: #FF0000; }
CSS
This paragraph uses the first style above
This h2 uses the second style above.
This h4 uses the third style above.
output
Grouping styles
■ A style can select multiple elements separated by commas
■ The individual elements can also have their own styles
40
p, h1, h2 {
color: red;
}
h2 {
background-color: yellow;
} CSS
This paragraph uses the above style.
output
This h2 uses the above styles.
CSS comments /*…*/
■ CSS (like HTML) is usually not commented as rigorously as
programming languages such as Java
■ The // single-line comment style is NOT supported in CSS
■ The <!-- ... --> HTML comment style is also NOT supported in CSS
41
/* This is a comment.
It can span many lines in the CSS file. */
p {
color: red; background-color: aqua;
} CSS
CSS properties for fonts
property description
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
42
Complete list of font properties
font-family
■ Enclose multi-word font names in quotes
43
p {
font-family: Georgia;
}
h2 {
font-family: "Courier New";
} CSS
This paragraph uses the first style above.
This h2 uses the second style above.
output
More about font-family
■ We can specify multiple fonts from highest to lowest priority
■ Generic font names:
– serif, sans-serif, cursive, Roboto
■ If the first font is not found on the user's computer, the next is tried
■ Placing a generic font name at the end of your font-family value, ensures that every computer will use a valid
font
44
p {
font-family: Garamond, "Times New Roman", serif;
} CSS
This paragraph uses the above style.
output
font-size
■ units: pixels (px) vs. point (pt) vs. m-size (em)
16px, 16pt, 1.16em
■ vague font sizes: xx-small, x-small, small, medium, large, x-large, xx-large, smaller, larger
■ percentage font sizes, e.g.: 90%, 120%
45
p {
font-size: 24pt;
} CSS
This paragraph uses the style above.
output
font-size
■ pt specifies number of point, where a point is 1/72 of an inch onscreen
■ px specifies a number of pixels on the screen
■ em specifies number of m-widths, where 1 em is equal to the font's current
size
46
p {
font-size: 24pt;
} CSS
This paragraph uses the style above.
output
font-weight, font-style
■ Either of the above can be set to normal to turn them off
(e.g. headings)
47
p {
font-weight: bold;
font-style: italic;
} CSS
This paragraph uses the style above.
output
CSS properties for text
property description
text-align alignment of text within its element
text-decoration decorations such as underlining
line-height,
word-spacing,
letter-spacing
gaps between the various portions of
the text
text-indent
indents the first letter of each
paragraph
48
text-align
■ text-align can be left, right, center, or
justify
49
h2 { text-align: center; }
CSS
Title
Upper Roller lower Roller
output
text-decoration
■ can also be overline, line-through, blink, or
none
■ effects can be combined:
text-decoration: overline underline;
50
p {
text-decoration: underline;
} CSS
This paragraph uses the style above.
output
The list-style-type property
■ Possible values:
i. none : No marker
ii. disc (default), circle, square
iii. Decimal: 1, 2, 3, etc.
iv. decimal-leading-zero: 01, 02, 03, etc.
v. lower-roman: i, ii, iii, iv, v, etc.
vi. upper-roman: I, II, III, IV, V, etc.
vii. lower-alpha: a, b, c, d, e, etc.
viii. upper-alpha: A, B, C, D, E, etc.
x. lower-greek: alpha, beta, gamma, etc.
others: hebrew,armenian,georgian, cjk-ideographic, hiragana…
51
ol { list-style-type: lower-roman; }
CSS
Body styles
■ Applies a style to the entire body of your page
■ Saves you from manually applying a style to each element
52
body {
font-size: 16px;
}
CSS
Cascading Style Sheets
■ Properties of an element cascade together in this order:
– browser's default styles
– external style sheet files (in a <link> tag)
– internal style sheets (inside a <style> tag in the page's header)
– inline style (the style attribute of the HTML element)
53
Inheriting styles
■ when multiple styles apply to an element, they are inherited
■ a more tightly matching rule can override a more general
inherited rule
54
body { font-family: sans-serif; background-color: yellow;
}
p { color: red; background-color: aqua; }
a { text-decoration: underline; }
h2 { font-weight: bold; text-align: center; }
CSS
This is a heading
• A bulleted list output
A styled paragraph. Previous slides are available on the website.
Styles that conflict
■ when two styles set conflicting values for the same property,
the latter style takes precedence
55
p, h1, h2 { color: blue; font-style: italic; }
h2 { color: red; background-color: yellow; }
CSS
This paragraph uses the first style above.
output
This heading uses both styles above.
CSS properties for backgrounds
property description
background-color color to fill background
background-image image to place in background
background-position
placement of bg image within
element
background-repeat
whether/how bg image should be
repeated
background-attachment whether bg image scrolls with page
background
shorthand to set all background
properties
56
background-image
■ background image/color fills the element's content area
57
body {
background-image: url("images/draft.jpg");
}
CSS
background-position
■ value consists of two tokens, each of which can be top, left,
right, bottom, center, a percentage, or a length value in px,
pt, etc.
■ value can be negative to shift left/up by a given amount
58
body {
background-image: url("images/draft.jpg");
background-repeat: no-repeat;
background-position: 370px 20px;
} CSS
Responsive
■ @media only screen and (max-width: 600px) {
body {
background-color: white;
}
}
59
W3C CSSValidator
■ jigsaw.w3.org/css-validator/
■ checks yourCSS to make sure it meets the official CSS
specifications
60
Reference
■ https://css-tricks.com/almanac/
■ http://jigsaw.w3.org/css-validator/ ( CSSValidator )
61

More Related Content

Similar to Html&amp;css slideshare

Similar to Html&amp;css slideshare (20)

ch04-css-basics_final.ppt
ch04-css-basics_final.pptch04-css-basics_final.ppt
ch04-css-basics_final.ppt
 
Web Typography
Web TypographyWeb Typography
Web Typography
 
2 introduction css
2 introduction css2 introduction css
2 introduction css
 
CSS-part-1.ppt
CSS-part-1.pptCSS-part-1.ppt
CSS-part-1.ppt
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
 
WEB DEVELOPMENT
WEB DEVELOPMENTWEB DEVELOPMENT
WEB DEVELOPMENT
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
HTML_JavaScript_Malaysia_2008 (2).ppt
HTML_JavaScript_Malaysia_2008 (2).pptHTML_JavaScript_Malaysia_2008 (2).ppt
HTML_JavaScript_Malaysia_2008 (2).ppt
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
CSS
CSSCSS
CSS
 
Session ii(html)
Session ii(html)Session ii(html)
Session ii(html)
 
CSS
CSSCSS
CSS
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
 
Introduction to css by programmerblog.net
Introduction to css by programmerblog.netIntroduction to css by programmerblog.net
Introduction to css by programmerblog.net
 
Web technology Unit-II Part-C
Web technology Unit-II Part-CWeb technology Unit-II Part-C
Web technology Unit-II Part-C
 
Fwd week2 tw-20120903
Fwd week2 tw-20120903Fwd week2 tw-20120903
Fwd week2 tw-20120903
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
 
CSS Overview
CSS OverviewCSS Overview
CSS Overview
 
Rapid HTML Prototyping with Bootstrap 4
Rapid HTML Prototyping with Bootstrap 4Rapid HTML Prototyping with Bootstrap 4
Rapid HTML Prototyping with Bootstrap 4
 

Recently uploaded

Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 

Html&amp;css slideshare

  • 2. Agenda ■ HTML History ■ An HTML Document ■ HTML and Browser 2
  • 3. Agenda ■ HTML History ■ An HTML Document ■ HTML and Browser 3
  • 4. HTML History ■ Internet ■ WorldWideWeb (WWW) – The WorldWide Web (WWW), also called the Web, is an information space where documents and other web resources are identified by Uniform Resource Locators (URLs), interlinked by hypertext links, and accessible via the Internet(wiki) – HTML (Language to create and share doc) – URL / URI – HTTP ( Language used to communicate b/w browser and server) 4
  • 6. Agenda ■ HTML History ■ An HTML Document ■ HTML and Browser 6
  • 7. HTML Documents ■ HTML was created to share documents – text , data , images all linked together ■ HTML is a markup language – Mean to be processed by a client application( browser ) 7
  • 8. Anatomy of HTML document ■ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head><title>Title of the document</title></head> <body>…Content…</body> </html> ■ DOCTYPE: Valid DTD List : https://www.w3.org/QA/2002/04/valid-dtd-list.html Validate HTML : https://validator.w3.org/ 8
  • 9. Anatomy of HTML document ( Contd.,) ■ Head : – <title> – <meta> <meta name=“keywords” content=“html , html5 ”> – <script> <script type=“text/javascript”> window.onload = function (){};</script> – <style> <style type=“text/css”> body {color: red }</style> – <link> <link rel=“stylesheet” type=“text/css” href=“abc.css”/> – <base> <base href=“/”> 9
  • 10. Anatomy of HTML document ( Contd.,) ■ BODY can have – Text – List – Links – Tables – Images / Objects 10
  • 11. Anatomy of HTML document ( Contd.,) ■ BODY can have – Text – List – Links – Tables – Images / Objects 11
  • 12. BODY -TEXT ( Contd.,) ■ Heading – Section Heading ■ H1 – Used by search engine ( once per page ) ■ H2- H6 – Sub Headings ■ BlockVs Inline Elements ■ Text breaking and whitespace(Ignored in block and inline elements) ■ <pre> whitespace is respected ■ <br/> ■ <hr/> ■ Character entities ( &nbsp; &lt; &gt) ■ Document elements – <sub> , <sup> , < abbr title=“”>ASAP</abbr> , <accronym> , <strong> 12
  • 13. Anatomy of HTML document ( Contd.,) ■ BODY can have – Text – List – Links – Tables – Images / Objects 13
  • 14. Anatomy of HTML document ( Contd.,) ■ BODY can have – Text – List – Links – Tables – Images / Objects 14
  • 15. BODY - List ( Contd.,) ■ Un Ordered: <ul > ■ Attr – style="list-style-type:none/square/circle/disc“ ■ Ordered: <ol > ■ Attr – type=“a/A/i/1” – start=“50” 15
  • 16. Anatomy of HTML document ( Contd.,) ■ BODY can have – Text – List – Links – Tables – Images / Objects 16
  • 17. Anatomy of HTML document ( Contd.,) ■ BODY can have – Text – List – Links – Tables – Images / Objects 17
  • 18. BODY - Link ( Contd.,) ■ Anchor – As Source <a name=“abc”/> ■ Eg: <a id=“abc” title=“go there”>TO GO </a> – <a href=“#abc”>im here</a> – AsTarget <a href=“.abc.html” 18
  • 19. Anatomy of HTML document ( Contd.,) ■ BODY can have – Text – List – Links – Tables – Images / Objects 19
  • 20. Anatomy of HTML document ( Contd.,) ■ BODY can have – Text – List – Links – Tables (rowspan , colspan) – Images / Objects 20
  • 21. Anatomy of HTML document ( Contd.,) ■ BODY can have – Text – List – Links – Tables – Images / Objects 21
  • 22. BODY – Images & Objects ( Contd.,) ■ Images – Reference to image file ■ Objects – Plugins (Flash/Silverlight etc) – Videos / Audio ■ <video width="" height="" controls> <source src=“abc.mp4" type="video/mp4"> Your browser does not support the video tag.</video> 22
  • 23. Agenda ■ HTML History ■ An HTML Document ■ HTML and Browser 23
  • 24. 24
  • 25. CSS
  • 27. The good, the bad and the… ugly! 27 output <font size=“1" color="red">Red</font> <font size=“2" face="verdana" color="green">Green</font> <font size=“3" color="blue">Blue</font>
  • 28. Cascading Style Sheets (CSS) ■ Describes the appearance, layout, and presentation of information on a web page – HTML describes the content of the page ■ Describes how information is to be displayed, not what is being displayed ■ Can be embedded in HTML document or placed into separate .css file 28
  • 29. How CSSWorks — Matching ■ Every HTML document represents a document tree ■ The browser uses the tree to determine which rules apply ■ What about inheritance? And conflicts? 29
  • 30. Basic CSS Style syntax ■ A CSS file consists of one or more rules ■ Each rule starts with a selector ■ A selector specifies an HTML element(s) and then applies style properties to them 30 selector { property: value; property: value; ... property: value; } CSS Selector Property Value p { font-family: times; } Note the punctuation:The property is followed by a colon (:) and the value is followed by a semicolon(;) CSS
  • 31. Attaching a CSS file ■ Inline CSS ■ Embedded CSS ■ External CSS 31
  • 32. Attaching a CSS file – Inline CSS(Contd.,) ■ Higher precedence than embedded or linked styles ■ Used for one-time overrides and styling a particular element ■ Bad style and should be avoided when possible (why?) 32 <p style="font-family: sans-serif; color: red;"> This is a paragraph</p> HTML This is a paragraph output
  • 33. Attaching a CSS file – Embedded CSS(Contd.,) ■ CSS code can be embedded within the head of an HTML page ■ Bad style and should be avoided when possible (why?) 33 <head> <style type="text/css"> p { font-family: sans-serif; color: red; } h2 { background-color: yellow; } </style> </head> HTML
  • 34. Attaching a CSS file – External CSS(Contd.,) ■ A page can link to multiple style sheet files – In case of a conflict (two sheets define a style for the same HTML element), the latter sheet's properties will be used 34 <head> ... <link href="filename" type="text/css" rel="stylesheet" /> ... </head> HTML <link href="style.css" type="text/css" rel="stylesheet" /> <link rel="stylesheet" type="text/css“ href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/c ss/bootstrap.min.css"/> HTML
  • 36. CSS Selectors ■ Single element type: – p {background-color: green } ■ Multiple element types: – h1, h2 , h3 {background-color: green} ■ All element types: – * {font-weight: bold} ■ Specific elements by id: – #a {color : red} ■ Elements belonging to a style class: – .abc {color : red} 36
  • 37. CSS Selector ( Contd ., ) ■ Elements of a certain type and class: < span class=“abc”> </span> ■ span.abc {font-size : x-large} ■ Source anchor elements: 37
  • 38. CSS properties for colors 38 p { color: green; background-color: yellow; } CSS This paragraph uses the style above output property description color color of the element's text background-color color that will appear behind the element
  • 39. Specifying colors ■ color names: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white (white), yellow ■ RGB codes: red, green, and blue values from 0 (none) to 255 (full) ■ hex codes: RGB values in base-16 from 00 (0, none) to FF (255, full) 39 p { color: green; } h2 { color: rgb(128, 0, 196); } h4 { color: #FF0000; } CSS This paragraph uses the first style above This h2 uses the second style above. This h4 uses the third style above. output
  • 40. Grouping styles ■ A style can select multiple elements separated by commas ■ The individual elements can also have their own styles 40 p, h1, h2 { color: red; } h2 { background-color: yellow; } CSS This paragraph uses the above style. output This h2 uses the above styles.
  • 41. CSS comments /*…*/ ■ CSS (like HTML) is usually not commented as rigorously as programming languages such as Java ■ The // single-line comment style is NOT supported in CSS ■ The <!-- ... --> HTML comment style is also NOT supported in CSS 41 /* This is a comment. It can span many lines in the CSS file. */ p { color: red; background-color: aqua; } CSS
  • 42. CSS properties for fonts property description 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 42 Complete list of font properties
  • 43. font-family ■ Enclose multi-word font names in quotes 43 p { font-family: Georgia; } h2 { font-family: "Courier New"; } CSS This paragraph uses the first style above. This h2 uses the second style above. output
  • 44. More about font-family ■ We can specify multiple fonts from highest to lowest priority ■ Generic font names: – serif, sans-serif, cursive, Roboto ■ If the first font is not found on the user's computer, the next is tried ■ Placing a generic font name at the end of your font-family value, ensures that every computer will use a valid font 44 p { font-family: Garamond, "Times New Roman", serif; } CSS This paragraph uses the above style. output
  • 45. font-size ■ units: pixels (px) vs. point (pt) vs. m-size (em) 16px, 16pt, 1.16em ■ vague font sizes: xx-small, x-small, small, medium, large, x-large, xx-large, smaller, larger ■ percentage font sizes, e.g.: 90%, 120% 45 p { font-size: 24pt; } CSS This paragraph uses the style above. output
  • 46. font-size ■ pt specifies number of point, where a point is 1/72 of an inch onscreen ■ px specifies a number of pixels on the screen ■ em specifies number of m-widths, where 1 em is equal to the font's current size 46 p { font-size: 24pt; } CSS This paragraph uses the style above. output
  • 47. font-weight, font-style ■ Either of the above can be set to normal to turn them off (e.g. headings) 47 p { font-weight: bold; font-style: italic; } CSS This paragraph uses the style above. output
  • 48. CSS properties for text property description text-align alignment of text within its element text-decoration decorations such as underlining line-height, word-spacing, letter-spacing gaps between the various portions of the text text-indent indents the first letter of each paragraph 48
  • 49. text-align ■ text-align can be left, right, center, or justify 49 h2 { text-align: center; } CSS Title Upper Roller lower Roller output
  • 50. text-decoration ■ can also be overline, line-through, blink, or none ■ effects can be combined: text-decoration: overline underline; 50 p { text-decoration: underline; } CSS This paragraph uses the style above. output
  • 51. The list-style-type property ■ Possible values: i. none : No marker ii. disc (default), circle, square iii. Decimal: 1, 2, 3, etc. iv. decimal-leading-zero: 01, 02, 03, etc. v. lower-roman: i, ii, iii, iv, v, etc. vi. upper-roman: I, II, III, IV, V, etc. vii. lower-alpha: a, b, c, d, e, etc. viii. upper-alpha: A, B, C, D, E, etc. x. lower-greek: alpha, beta, gamma, etc. others: hebrew,armenian,georgian, cjk-ideographic, hiragana… 51 ol { list-style-type: lower-roman; } CSS
  • 52. Body styles ■ Applies a style to the entire body of your page ■ Saves you from manually applying a style to each element 52 body { font-size: 16px; } CSS
  • 53. Cascading Style Sheets ■ Properties of an element cascade together in this order: – browser's default styles – external style sheet files (in a <link> tag) – internal style sheets (inside a <style> tag in the page's header) – inline style (the style attribute of the HTML element) 53
  • 54. Inheriting styles ■ when multiple styles apply to an element, they are inherited ■ a more tightly matching rule can override a more general inherited rule 54 body { font-family: sans-serif; background-color: yellow; } p { color: red; background-color: aqua; } a { text-decoration: underline; } h2 { font-weight: bold; text-align: center; } CSS This is a heading • A bulleted list output A styled paragraph. Previous slides are available on the website.
  • 55. Styles that conflict ■ when two styles set conflicting values for the same property, the latter style takes precedence 55 p, h1, h2 { color: blue; font-style: italic; } h2 { color: red; background-color: yellow; } CSS This paragraph uses the first style above. output This heading uses both styles above.
  • 56. CSS properties for backgrounds property description background-color color to fill background background-image image to place in background background-position placement of bg image within element background-repeat whether/how bg image should be repeated background-attachment whether bg image scrolls with page background shorthand to set all background properties 56
  • 57. background-image ■ background image/color fills the element's content area 57 body { background-image: url("images/draft.jpg"); } CSS
  • 58. background-position ■ value consists of two tokens, each of which can be top, left, right, bottom, center, a percentage, or a length value in px, pt, etc. ■ value can be negative to shift left/up by a given amount 58 body { background-image: url("images/draft.jpg"); background-repeat: no-repeat; background-position: 370px 20px; } CSS
  • 59. Responsive ■ @media only screen and (max-width: 600px) { body { background-color: white; } } 59
  • 60. W3C CSSValidator ■ jigsaw.w3.org/css-validator/ ■ checks yourCSS to make sure it meets the official CSS specifications 60

Editor's Notes

  1. Images / Content – taken from pluralsight / wiki
  2. https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_a_href_anchor
  3. https://www.w3schools.com/TAGS/tryit.asp?filename=tryhtml_td_rowspan
  4. https://www.w3schools.com/html/tryit.asp?filename=tryhtml5_video https://html.com/tags/video/
  5. Pic src: PS
  6. Lecture: CSS Essentials
  7. a conflict (two sheets define a style for the same HTML element
  8. a conflict (two sheets define a style for the same HTML element
  9. justify (which widens all full lines of the element so that they occupy its entire width)
  10. not all properties are inherited (notice link's color above)
  11. (later we will learn about more specific styles that can override more general styles)
  12. @media only screen or (max-width: 600px) , (max-height: 300px) { body { background-color: lightblue; } }
  13. more picky than the web browser, which may render malformed CSS correctly