3 HTML CSS
3 HTML CSS
3 HTML CSS
Week – 2 (Part – 1)
Enterprise Application Development
Capital University of Science and Technology
(C.U.S.T)
WWW
• Web Browser
• Web Server
• Web Document
3
WWW Architecture
PC/Mac/Unix/Mobile
Client Browser (IE, Firefox, Chrome,
Opera, Safari)
Request:
http://www.bbc.com/default.html
Web/Application Server
Apache Tomcat
Response:
<html>…</html>
4
WWW Languages
• HTTP / HTTPS (URL, GET/POST)
• Stateless protocol between client and server
• Client-side:
• HTML / XHTML (Extensible HyperText Markup Language)
• JavaScript / VBScript (client-side scripting)
• Applets / ActiveX controls
• Server-side:
• ASP.NET (latest generation of ASP)
• Java Servlets
• JSP (Java Server Pages)
• PHP, Phython, JSP, …
HTML
(HYPERTEXT MARKUP
LANGUAGE)
7
HTML
• HyperText Markup Language (HTML) is the language of the web
• HTML is just a document
• Web browsers can display several types of documents, not just
HTML i.e. XML, XHTML, etc.
• the document type is called the Document Type Declaration, or DTD
for short
• The document type for HTML5 is
HTML (continued)
•<> root element: <html> …. </html>
• HTML documents use a specific structure enabling
web browser to read document
<!doctype html>
<html>
<head>
<title>My First Document </title>
</head>
<body>
<div>My Web Page</div>
</body>
</html>
9
Tag Description
<!DOCTYPE> Defines the document type
<html> Defines an HTML document
<title> Defines a title for the document
<body> Defines the document's body
<h1> to <h6> Defines HTML headings
<p> Defines a paragraph
<br> Inserts a single line break
<hr> Introduces horizontal line
<!--xyz--> Defines a comment
10
Tag Description
<abbr> Defines an abbreviation
Defines contact information for the
<address>
author/owner of a document/article
<b> <i><u> Defines bold text
<bdo> Overrides the current text direction
Defines a section that is quoted from
<blockquote>
another source
<cite> Defines the title of a work
<code> Defines a piece of computer code
11
Tag Description
<ul> Defines an unordered list
<ol> Defines an ordered list
<li> Defines a list item
<dl> Defines a description list
<dt> Defines a term/name in a description list
Defines a description of a term/name in
<dd>
a description list
<menu> Defines a list/menu of commands
Defines a command button that a user
<command>
can invoke
13
<table border="3">
<tr align="center"><th>Title</th>
<th>Authors</th>
<th>Publisher</th>
</tr>
<tr><td>HTML: The Definitive Guide</td>
<td>Chuck Musciano and Bill Kennedy</td>
<td>O'Reilly & Associates</td>
</tr>
<tr><td>Learning C# 2005</td>
<td>Jesse Liberty and Brian MacDonald</td>
<td>O'Reilly & Associates</td>
</tr>
</table>
17
Table Example 2
<table width="300">
<tr valign="top">
<td rowspan="2" valign="middle">
<i>You can contact the people listed here.</i></td>
<td width="140">
<img src="sohi-mini.jpg" />
<br /><b><a href="/~sohi/">Prof. Gurindar Sohi
</a></b>
<br />Chair</td>
<td width="140">
<img src="horwitz-mini.jpg" />
<br /><b><a href="/~horwitz/">Prof. Susan Horwitz
</a></b>
<br />Associate Chair</td>
</tr>
<tr><td colspan="2" align="center">
<i>There are a few others we should have listed.</i>
</td>
</tr>
</table>
18
Tag Description
<form> Defines an HTML form for user input
Defines an input control
<input>
http://www.w3schools.com/tags/att_input_type.asp
<textarea> Defines a multiline input control (text area)
<button> Defines a clickable button
<select> Defines a drop-down list
<optgroup> Defines a group of related options in a drop-down list
<option> Defines an option in a drop-down list
<label> Defines a label for an <input> element
<fieldset> Groups related elements in a form
<legend> Defines a caption for a <fieldset> element
<datalist> Specifies a list of pre-defined options for input controls
<keygen> Defines a key-pair generator field (for forms)
<output> Defines the result of a calculation
19
<form id="contact-form" action="script.php" method="post">
<fieldset>
<legend>Contact Us:</legend>
<ul>
<li>
<label for="name">Name:</label>
<input type="text" name="name" id="name" value="" />
</li>
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female
<textarea name="comments" id="comments" cols="25"
rows="3"></textarea>
<input type="checkbox" checked="checked" id="mailing-list"
value="Yes, sign me up!" />
<select>
<option value="edu">Education</option>
<option value="health">Health</option>
<option value="sports">Sports</option>
</select>
<input type="submit" value="submit" />
<input type="reset" value="reset" />
</fieldset>
CSS
(CASCADING STYLE
SHEETS)
21
CSS Syntax
• A CSS rule has two main parts
• a selector, normally HTML element you want to style
• and one or more declarations consists of a property:value; ending
with semicolon;
<!DOCTYPE html>
<html>
<head>
<style>
h1 { color:orange;
text-align:center; }
</style>
</head>
<body>
<h1>Heading 1 with CSS</h1>
</body>
</html>
23
#mypara1 {
text-align:center;
color:red;
}
<p id="mypara1">Centered Text!</p>
<p>This paragraph is not affected
by the style.</p>
24
<head>
<link rel="stylesheet" type="text/css" href="mystle.css">
</head>
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url("images/back40.gif");}
27
CSS Property Groups
• Color • Transform
• Background and Borders • Transition
• Basic Box • Basic User Interface
• Flexible Box • Multi-column
• Text • Paged Media
• Text Decoration • Generated Content
• Fonts • Filter Effects
• Writing Modes • Image/Replaced Content
• Table • Masking
• Lists and Counters • Speech
• Animation • Marquee
28
CSS Selectors
• Selectors are patterns used to select element(s) to style
.class .intro elements with class="intro"
#id #firstname element with id="firstname"
* * selects all elements
element p all <p> elements
[attribute] [target] all elements with a target attribute
:link a:link all unvisited links
:focus input:focus input element which has focus
:first-letter p:first-letter first letter of every <p> element
:first-line p:first-line first line of every <p> element
current active #news element (clicked on a
:target #news:target
URL containing that anchor name)
:not(selector) :not(p) every element that is not a <p> element
Take Home
• WWW consists of a large group of computers (servers), to
provide information (Document; html etc) requested by
client, a piece of computer software (web browser).
• Web Browser and Server speaks (stateless) HTTP
• Client (Browser) languages are HTML, JavaScript, ...
• Server Languages of interest are ASP.net, PHP, ...