Professional Documents
Culture Documents
WWW course
1st day
Today target
Web and relative terms
Web and web programming Website vs. webpage, domain vs. URL
Course introduction
Objective Content Useful tools
HTML basic
URL
Absolute
http://www.bkitclub.net/forum http://my.opera.com/vietnamese
Relative
/imgs/bg.png ../style/main.css
Course objective
Understand our web Have the ability to implement a static webpage (maybe a website) Have the background to study more about web development.
Our friends
Some major browsers
IE 9 Firefox 6+ with firebug add-on Chrome 14+ Opera 11+
A text editor
Window notepad Notepad++, Gedit Netbeans, Eclipse
10
HTML
Stand for Hypertext Markup Language A markup language, not a programming language An HTML document is eq. to a webpage Its brother: XHTML
11
HTML Element
<a href=page1.html>Click here</a>
12
13
14
</body> </html>
15
Today tags
<title> <h1>, <h2>, <h3>, <h4>, <h5>, <h6> <div>, <p> <blockquote>, <q> <hr>, <br> <b>, <i> <span>
16
<title>
Tags: opening and closing tag Set the page title Attributes: none Examples:
<html> <head>
<title>HTML introduction</title> </head> <body> The content of the document...... </body> </html>
17
is is is is is is
18
<div>
Tags: opening and closing tag Define a division or a section. We usually use the <div> element to group HTML elements and format them with CSS. You can, but not recommended to, use <div> with text content Attributes: global attributes and event attributes Level: block Examples: <div> <h3>This is a heading</h3> <p>This is a paragraph.</p> <a href=/some/where>This is a link.</a> </div>
19
<p>
Tags: opening and closing tag Define a paragraph. Attributes: global attributes and event attributes Level: block Examples:
<p>This is some text in a paragraph.</p> <p>Lorem ipsum dolor sit amet <a href=/a/link>A link inside a paragraph</a></p>
20
<blockquote>
Tags: opening and closing tag The <blockquote> tag specifies a section that is quoted from another source. Attributes: cite, global attributes and event attributes
cite: Specifies the source of the quotation
<blockquote cite="http://www.worldwildlife.org/who/index.html"> For 50 years, WWF has been protecting the future of nature. The worlds leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally. </blockquote>
21
<q>
Tags: opening and closing tag Define a short quotation Attributes: cite, global attributes and event attributes
cite: Specifies the source of the quotation
<p>WWF's goal is to: <q>build a future where people live in harmony with nature</q>. We hope they succeed.</p>
22
<hr />
Tags: opening and self-closing tag Creates a horizontal line in an HTML page. Attributes: global attributes and event attributes Level: block Examples:
<h1>HTML</h1> <p>HTML is a language for describing web pages.</p> <hr />
23
<br />
Tags: opening and self-closing tag Inserts a single line break. We just use it to insert a line break, not to separate two paragraphs. Attributes: global attributes and event attributes Level: block Examples:
24
<p>It was a <b>red</b> house with a <b>blue</b> door.</p> <p>He named his car <i>The lightning</i>, because it was very fast.</p>
25
<span>
Tags: opening and closing tag Provide localized formatting within documents. This tag is also used to group inline elements. Attributes: global attributes and event attributes Level: text Examples:
26
Yu cu
Hin thc mt HTML document theo yu cu sau: Trn trnh duyt hin th tiu ca trang web l Ca hng hoa <tn ca hng> C s dng <hr /> v quotation C t nht hai on, mi on c t nht mt heading
Gii thiu v ca hng Gii thiu v ch ca hng (c th v bn)
WWW course
2nd day
Today target
HTML tags
Link Image List Table Iframe Link, script and style
Description
The URL of the page link goes to The language of the linked document
rel target
The relationship between the current document and the linked document How to open the linked document
Image <img>
Tags: opening and self-closing tag Defines an image in an HTML page. Attributes: src, alt, height, width global attributes and event attributes Level: inline
Image <img>
Attributes http://www.w3schools.com/html5/tag_img.asp Attribute
src alt
Description
The URL of the image The alternate text for an image
width
height
URL Review
http://mydomain.com
index.html
animal
plants
cats.html
flowers
trees.html
dogs.html
roses.html
HTML table
What is a table?
Table header
alt
width height
Table rows
Table columns
Define a cell
10
11
<th>: define a header cell. It has the same attributes as the <td> element.
The table header, body and footer elements have no visual effect.
<caption> Define the caption of the table
12
HTML list
The first item The second item The third item
An unordered list
13
We use <ul> or <ol> with the help of <li> tags to define unordered (or ordered) list in HTML
HTML list
<ul> <ol>
14
The list is no longer styled by HTML code in HTML5, we format our lists by CSS. The ordered list has the start attribute to set the initial value for the first item of the list.
HTML form
HTML forms are used to pass data to a server. <form> tag defines a form. Its attributes: action: specifies where to send the data of the form
enctype: specifies how form-data should be encoded before sending it to the server. method: specifies how to send form data name: the name of the form Inside the <form> tag, we can define many elements.
15
16
Defines an input control (textbox, password box, submit and cancel button, radio, checkbox) Defines a multi-line text input control
Defines a label for an input element Defines a border around elements in a form
<textarea>
<label> <fieldset>
<legend>
<select>
<optgroup>
<option> <button>
17
<pre>
Tags: opening and closing tag Defines preformatted text. This section is displayed in monospace font and it preserves both space and line break. Attributes: global attributes and event attributes Level: block
18
<script>
Tags: opening and closing tag Define a client-side script, such as a JavaScript. Attributes: src global attributes and event attributes
src the URL to the external script file
Level: none
19
HTML comments
The browser ignores these comment when rendering the HTML document. Usage: <!-- The comment --> Use comments to quickly view your changes in a safety way or in debugging process.
20
Description
Define an internal style for the HTML document Set the base URL for all relative URL in the HTML document Define the relationship between a document and a external source (especially a style sheet)
<meta>
<object>
21
22
23
Next subject
WWW course
3rd day
TODAY TARGET
Introduction
Text formation
Content and style CSS and CSS attachment HTML class and id
How is it presented?
Information
CSS
What is presented?
You understand
3
HTML
CSS WHAT IS IT
CSS stands for Cascading Style Sheet Its a W3C recommendation CSS defines how to display HTML elements
Define style of each element by its style attribute. Define style inside the <style></style> of the HTML document. Use <link> tag to define a link to an external style sheet.
/* CSS rule (in a CSS file or inside the <style> tag) */ @import url(url/to/the/css/file);
CLASS AND ID
Both of them are one of the HTML global element attributes An id should be unique in a HTML document. A class can be applied to many elements in a HTML document.
<div id=main class=doc-section> <h1 class=title>......</h1> <div class=post>
</div> </div>
TODAY TARGET
Introduction
Text formation
Content and style CSS and CSS attachment HTML class and id
The style inside the <style> tag The style imported inside the <style> tag via @import
The external style sheet which is linked to by the <link> tag The style imported inside an external style sheet.
CSS SYNTAX
Each declaration
Define the elements this rule applies to A selector can be one or a sequence of
Universal selector * HTML element h1 { ... } Id definition #mainwrap { ... } Class definition .post { ... }
h1, h2, .post, #wrap { ... }
blockquote p { }
#sidebox h1 { }
p.custom-para { }
11
TODAY TARGET
Introduction
Text formation
Content and style CSS and CSS attachment HTML class and id
12
ELEMENT
height
13
Description
The browser calculates the width. This is default Defines the width in px, cm, etc. Defines the width in percent of the containing block
inherit
Specifies that the value of the width property should be inherited from the parent element
http://www.w3schools.com/cssref/pr_dim_width.asp
14
Description
The browser calculates the height. This is default Defines the height in px, cm, etc. Defines the height in percent of the containing block
inherit
Specifies that the value of the height property should be inherited from the parent element
http://www.w3schools.com/cssref/pr_dim_width.asp
15
pt mm, cm, in
Percentage: %
16
17
TODAY TARGET
Introduction
Text formation
Content and style CSS and CSS attachment HTML class and id
18
Description
Aligns the text to the left (default if ltr)
right center
justify inherit
Aligns the text to the right (default if rtl) Centers the text Stretches the lines so that each line has equal width (like in newspapers and magazines)
Specifies that the value of the text-align property should be inherited from the parent element
http://www.w3schools.com/cssref/pr_text_text-align.asp
19
Value color
inherit
Specifies that the color should be inherited from the parent element. IE8 requires !DOCTYPE, IE9 and above support this value.
20
CSS COLOR
21
CSS color name: red, white, navy, Numerical CSS color values:
RGB or RRGGBB values: #06f, #00ff27, RGBA values (CSS3): rgba(r, g, b, alpha) or rgba(r%, g%, b%, alpha)
22
ACTION
Do more, get more
23
FIREFOX EXTENSIONS
Firebug
24
YOUR TASK
25
Next subject
CSS text formation (cont.), CSS font and CSS box model
26
WWW course
4th day
TODAY TARGET
Background
Font properties
Font families Font size and line height Font style Font weight Font variation
Value
none underline overline
line-through blink
inherit
Defines a line through the text Defines a blinking text Specifies that the value of the text-decoration property should be inherited from the parent element
http://www.w3schools.com/cssref/pr_text_text-decoration.asp
3
Description
No capitalization. The text renders as it is. This is default
capitalize
uppercase lowercase inherit
Lorem ipsum dolor sit amet, lugens quia quod ait regem ut casus homini interimat potius accipiet. Rationem non potentiae Apollonium contigit cum obiectum dixit. Dionysiadis eum est se sed esse deprecor.
TODAY TARGET
Background
Font properties
Font families Font size and line height Font style Font weight Font variation
Monospace fonts
http://www.w3schools.com/cssref/pr_font_font-family.asp
Try each font in the declared list until the browser finds this font in the local machine.
Value
xx-small, x-small, small, medium, large, Sets the font-size to a certain size x-large, xx-large smaller
larger Sets the font-size to a smaller size than the parent element Sets the font-size to a larger size than the parent element Sets the font-size to a fixed size in px, cm, etc. Sets the font-size to a percent of the parent element's font size Specifies that the font size should be inherited from the parent element
length
%
inherit
10
Description
A normal line height. This is default A number that will be multiplied with the current font size to set the line height
number length
%
inherit
11
inherit
12
13
Value
font-style
font-variant font-weight fontsize/lineheight font-family
15
Specifies the font size and the line-height. See font-size and line-height for possible values
Specifies the font family. See font-family for possible values
TODAY TARGET
Background
Font properties
Font families Font size and line height Font style Font weight Font variation
16
background-color: sets the background color of an element. Include padding and border, not margin (read more in the 5th day)
Value color Description
Specifies the background color. Look at CSS Color Values for a complete list of possible color values.
transparent
inherit
17
Value
url('URL') The URL to the image none inherit No background image will be displayed. This is default Specifies that the background image should be inherited from the parent element
18
repeat
repeat-x repeat-y no-repeat inherit
19
Specifies that the setting of the background-repeat property should be inherited from the parent element
ackground-attachment: sets whether a background image is fixed or scrolls with the rest of the page.
Description
Value scroll
The background image scrolls with the rest of the page. This is default The background image is fixed
Specifies that the setting of the background-attachment property should be inherited from the parent element
fixed
inherit
20
21
If you only specify one keyword, the other value will be "center"
The first value is the horizontal position and the second value is the vertical. The top left corner is 0% 0%. The right bottom corner is 100% 100%. If you only specify one value, the other value will be 50%. . Default value is: 0% 0% The first value is the horizontal position and the second value is the vertical. The top left corner is 0 0. Units can be pixels (0px 0px) or any other CSS units. If you only specify one value, the other value will be 50%.You can mix % and positions Specifies that the setting of the background-position property should be inherited from the parent element
xpos ypos
inherit
22
23
ACTION
Do more, get more
24
YOUR TASK
25
Next subject
CSS box model
26
WWW course
5th day
TODAY TARGET
Box model
border
http://www.w3schools.com/cssref/pr_text_text-decoration.asp
3
For border, margin, padding, we have 4 subelements in the top, right, bottom and left of the formated element. For a PROP property, we also have another 4 properties:
PROP-right: defines the right PROP property PROP-top: defines the top PROP property
PROP-bottom: defines the bottom PROP property
The PROP property can also be written in a shortand way using one of the following:
PROP: VALUE VALUE VALUE VALUE Defines the top , right, bottom, left value of the PROP PROP: VALUE
Defines value for all four side of the formated PROP property
Defines the top and bottom, left and right value of the PROP
Defines the top , left and right, bottom value of the PROP
CSS BORDER
medium thick
length inherit
http://www.w3schools.com/cssref/pr_border-style.asp
color transparent
inherit
Specifies the background color. Look at CSS Color Values for a complete list of possible color values Specifies that the border color should be transparent. This is default Specifies that the border color should be inherited from the parent element
length
% inherit
Margin
10
length
% inherit
Specifies the padding in px, pt, cm, etc. Default value is 0px
Specifies the padding in percent of the width of the containing element Specifies that the padding should be inherited from the parent element
padding
11
TODAY TARGET
Box model
12
CSS FLOATING
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~~~~~~
Description
The element floats to the left
right
none
inherit
Specifies that the value of the float property should be inherited from the parent element
14
clear: specifies which sides of an element where other floating elements are not allowed.
Description
No floating elements allowed on the left side
No floating elements allowed on the right side No floating elements allowed on either the left or the right side
Value
left
right both
none
inherit
Default. Allows floating elements on both sides Specifies that the value of the clear property should be inherited from the parent element
15
TODAY TARGET
Box model
16
position: specifies the type of positioning method used for an element (static, relative, absolute or fixed).
Description Elements renders in order, as they appear in the document flow. This is default. The element is positioned relative to its first positioned (not static) ancestor element The element is positioned relative to the browser window The element is positioned relative to its normal position, so "left:20" adds 20 pixels to the element's LEFT position
relative inherit
The value of the position property is inherited from the parent element
17
Value
The element will generate no box at all The element will generate a block box (a line break before and after the element)
The element will generate an inline box (no line break before or after the element). This is default The element will generate a block box, laid out as an inline box The element will generate an inline box (like <table>, with no line break before or after)
18
Description The element will generate a block box, and an inline box for the list marker The element will generate a block or inline box, depending on context The element will behave like a table (like <table>, with a line break before and after)
The element will behave like a table caption (like <caption>) The element will behave like a table cell The element will behave like a table column
table-columngroup
19
The element will behave like a table column group (like <colgroup>)
Description The element will behave like a table footer row group The element will behave like a table header row group
The element will behave like a table row The element will behave like a table row group Specifies that the value of the display property should be inherited from the parent element
inherit
20
ACTION
Do more, get more
21
YOUR TASK
Improve your previous website by applying the new CSS rules. You should re-layout it without using table int the main layout.
22
WWW course
6th day
TODAY TARGET
List formating
List style List style image List style position List style type
lovehate rule
replaces the list-item marker with an image. replaces the list-item marker with an image.
Value url none inherit Description The path to the image to be used as a list-item marker No image will be displayed. Instead, the list-style-type property will define what type of list marker will be rendered.This is default Specifies that the value of the list-style-image property should be inherited from the parent element
specifies if the list-item markers should appear inside or outside the content flow.
Value inside outside inherit Description Indents the marker and the text. The bullets appear inside the content flow Keeps the marker to the left of the text. The bullets appears outside the content flow. This is default Specifies that the value of the list-style-position property should be inherited from the parent element
TODAY TARGET
List formating
List style List style image List style position List style type
lovehate rule
Column 2 Novoire idimu Sactum liner practist Echemica sisto Clarif Woodi Sentia Cloro Sacture
10
TODAY TARGET
List formating
List style List style image List style position List style type
lovehate rule
11
Normal apperance
12
:link :visited :hover :active So we have to defines these elements in a certain order call LoVeHAte Pseudo elements will be discussed more in the next class.
13
ACTION
Do more, get more
14
YOUR TASK
Improve your previous website by applying the new CSS rules.You should re-layout it without using table int the main layout.
15
WWW course
7th day
TODAY TARGET
CSS 3: BORDER-RADIUS
IE9+
Firefox 4+
Chrome 14+
Opera
Safari 4+
Horizontal radius/ Vertical radius top-left -> top-right -> bottom-right -> bottom-left
CSS 3: BOX-SHADOW
IE9+
Firefox 4+
Chrome 14+
Opera
Safari 5.1.1+
CSS 3: BOX-SHADOW
Value
CSS 3: OPACITY
Description Specifies the opacity. From 0.0 (fully transparent) to 1.0 (fully opaque) The value of the opacity property should be inherited from the parent element
Before CSS3, there are many special properties which is not standard. When CSS3 is released, we need a period of time to implement all of its standards in ALL browser
filter
-moz-
-webkit-
-o-
-webkit-
TODAY TARGET
Description Used for all media type devices Used for speech and sound synthesizers Used for braille tactile feedback devices Used for paged braille printers Used for small or handheld devices Used for printers Used for computer screens Used for media using a fixed-pitch character grid, like teletypes and terminals Used for television-type devices
CSS MEDIATYPE
When linking to the HTML document <link href= type= rel= media= />
10
ACTION
Do more, get more
11
YOUR TASK
Improve your previous website by applying the new CSS rules.You should re-layout it without using table int the main layout.
12