Internet Application Prog Lesson 2
Internet Application Prog Lesson 2
Learning Group:
BSc Computer science
Lecturer: Theuri Patrick
Lesson 2
learning topics
HTML Formatting is a process of formatting text for better look and feel. HTML
provides us ability to format text without using CSS. There are many formatting tags in
HTML. These tags are used to make text bold, italicized, or underlined. There are almost
14 options available that how text appears in HTML and XHTML.
o Physical tag: These tags are used to provide the visual appearance to the text.
o Logical tag: These tags are used to add some logical or semantic value to the text.
<b> This is a physical tag, which is used to bold the text written between it.
<strong> This is a logical tag, which tells the browser that the text is important.
1|Page
<tt> This tag is used to appear a text in teletype. (not supported in HTML5)
<strike> This tag is used to draw a strikethrough on a section of text. (Not supported in HTM
<big> This tag is used to increase the font size by one conventional unit.
<small> This tag is used to decrease the font size by one unit from base font size.
2|Page
Difference between <em> and <i> tag
Similarly, both <em> and <i> tags render the enclosed text in italic type by default, but
the <em> tag indicates that its contents have stressed emphasis compared to
surrounding text, whereas the <i> tag is used for marking up text that is set off from the
normal text for readability reasons, such as a technical term, an idiomatic phrase from
another language, a thought, etc.
1. Inline Style
Inline Style: In Inline styling, the CSS rules are directly written inside the starting
tag using the style attribute. The style attribute includes a series of CSS property and
value pairs. Each ‘property: value ‘pair is separated by a semicolon (;).
CSS Syntax
3|Page
Inline style sheet css save as inlinestyle.html
NB: it will change only the first h1 selector, changing the specific style
where its applied. That’s why in our output result first h1 colors blue and
the other h1 remains by default black.
Embedded style sheets are defined in the <head> section of an HTML document
using the <style> tag. You can define any number of <style> elements inside
the <head> section.
4|Page
3. External Style Sheet:
External style sheets are the most flexible because with an external style sheet, you can
change the look of an entire website by updating just one file.
You can attach external style sheets in two ways — linking and importing:
➢ Time-effective — you only need to create a single CSS file to style all
HTML files.
➢ Faster load time — the site will cache the CSS file for your visitors’ next
visit.
➢ Improve SEO — storing CSS styles in another file makes the HTML file
more concise and readable by search engines.
• If the style-sheet file has large data, then downloading the file takes time
and it increases page download speed.
• For static site with limited pages and different design on each page,
external style-sheets are harder to maintain.
➢ Link rel — element defines the relationship between the file that hosts
this command and the file defined in the href attribute. The standard
value for this attribute is stylesheet.
➢ type — defines the content of the linked file. In this tutorial, set this
attribute’s value to text/css. However, you can skip it altogether if you’re
using HTML5
➢ href — specifies the location of the CSS file you want to link to the HTML.
If the CSS file is in the same directory as the HTML file, you only need to
enter the file name. Otherwise, you need to include the folder name in
which you store the CSS file (example: CSS/stylesheet.css).
5|Page
Step 1. Open sublime text > select file >open folder>select new folder>rename to
your own name of choice.
Step 3. Open new tab ctr+n. write css rules and save as mystyle.css in the same
folder
Step 4. Run the code using html file and right click >select open in browser
6|Page
2.2 HTML LINKS
In HTML, links are defined with the <a> tag:
The HTML anchor tag <a> defines a hyperlink that links one page
to another page. It can create hyperlink to other web page as
well as files, location, or any URL.
Href (pronounced "h" — like the letter — "ref) is short for
Hypertext Reference. This is a goofy name that really only
means a URL (otherwise known as a web site address)
<a href = "..........."> Link Text </a>
<a href="url">link text</a>
Example
<a href="http://www.w3schools.com/html/">Visit our HTML tutorial</a>
7|Page
Local Links
A local link (link to the same web site) is specified with a relative URL (without
http://www... )
_self Opens the linked document in the same frame as it was clicked (this is default)
_top Opens the linked document in the full body of the window
8|Page
framename Opens the linked document in a named frame
The <img> tag is used to insert images in the HTML documents. It is an empty
element and contains attributes only. The syntax of the <img> tag can be
given with:
<img src="url" alt="some_text">
The src and alt are important attributes of HTML img tag. All attributes of HTML image
tag are given below
9|Page
1) src
It is a necessary attribute that describes the source or path of the image. It instructs the
browser where to look for the image on the server.
2) alt
The alt attribute defines an alternate text for the image, if it can't be displayed. The value
of the alt attribute describes the image in words. The alt attribute is considered good for
SEO (search engine optimization) prospective.
3) width
It is an optional attribute which is used to specify the width to display the image. It is
not recommended now. You should apply CSS in place of width attribute.
4) height
It h3 the height of the image. The HTML height attribute also supports iframe, image
and object elements. It is not recommended now. You should apply CSS in place of
height attribute.
10 | P a g
e
Note: If src URL will be incorrect or misspell then it will not
display your image on web page, so try to put correct URL
Style Description
11 | P a g
e
list-style-type:square The list items will be marked with squares
A type attribute can be added to an ordered list, to define the type of the marker:
Type Description
type="I" The list items will be numbered with uppercase roman numbers
type="i" The list items will be numbered with lowercase roman numbers
12 | P a g
e
Uppercase Letters:
HTML also supports description lists. A description list is a list of terms, with a
description of each term.
The <dl> tag defines the description list, the <dt> tag defines the term (name), and
the <dd> tag describes each term:
13 | P a g
e