Web Design P3
Web Design P3
HTML
• HyperText Markup Language
• Basic language for creating documents on the web, and
for creating user interface for web applications
• It is a markup language (not programming language)
• HTML documents are in fact just a text files
• Creating and modifying can be done in any text editor
• File must follow certain version of HTML standard
• Currently actual version is HTML version 5
HTML
HTML
• Two basic elements – type declaration and HTML
element itself
• Type declaration gives information about the HTML
version
HTML
• HTML element (frame) inside document forms the
content, and it is consisted of header and body
HTML
• Tag <HTML> is a frame containing all other tags
• Every HTML document starts with <HTML> and ends
with </HTML>
• Tag <HEAD> is frame for holding information about the
document itself (title, description, key words) and where
script language code is written (JavaScript)
• Everything which we see in the browser window, the
page content, is defined inside <BODY> frame
HTML
HTML
• HTML document is consisted of elements (tags)
– Opening tag <ELEMENT_NAME>
– Closing tag </ELEMENT_NAME>
• Together with the HTML element name, tag can also
have certain number of attributes with values in ” ”
• Element tells the browser what to do, and the attribute
tells how to do it
• There is no difference between small and large letters,
but it is better to keep them small
• Browser depends on the information given in tags to
display the page
• HTML code is realized in the order in which it was written
HTML
• Each element is consisted of paired or unpaired tags
• Paired tags are marks which are used to set text or other
object into the HTML page
• Paired tags have opening and closing tag (introduced for
easier code reading)
• These marks must have symbol to start and symbol to
close tag
• <tag> and </tag>
• Complete text or set of tags inside those two marks is
translated just in context of this element
• Every tag has defined graphical appearance
HTML
• First HTML page
HTML
HTML
• Code can be written in any text editor
• Recommendation – Notepad++ (http://notepad-
plusplus.org/)
• After creating code, file type should be set to HTML
HTML
• Lets take a look at the code
• <!DOCTYPE html> declaration defines that this document is HTML5
• <html> - root element of the HTML page
• <head> holds meta information about the document
• <title> defines title of the document
• <body> visible content
HTML
• As we have already seen, HTML tags are surrounded by
<>
• Usually in pairs, for example <p> and </p>
• Content is written inside:
• For example:
HTML
• Some elements do not have content, and they are called
empty elements
• They don’t have end tag, for example line break
<br/>, or some other examples: <hr/>, <input/>, <img/>…
• Some elements can have nested other elements
HTML
• Comments exist in every programming language, and
they are used to help developers with descriptions and
notes
• They are part of the web page, but not interpreted,
therefore not shown to the user
• Their main role is to help navigating inside the document
• Comments are almost necessary when more than one
people are developing the site, or when PHP approach is
used
• Syntax
<! -- comment text -->
HTML
• Attributes are second building element of the HTML,
together with tags
• Attributes belong to a tag, and cannot be written
separately
• Attributes define with more details how to show tags in
browser, they are not mandatory but sometimes very
important
• Different tags have different allowed attributes
• Attribute names are predefined by HTML, together with
their values, type and interval, except for String
• They are written inside “ ”
• One tag can have more than one attribute
HTML
• Tag <hr/> is used to add one horizontal line (1 to 2 mm
height), with empty row before and after
• It is possible to set height by using attribute size=“n” (n is
number of pixels), width by attribute width=“n” and
alignment with attribute align (possible values LEFT,
RIGHT and CENTER)
• Line length is absolute length, or percentage of width of
whole screen
• Example:
<hr width=“100px”/>
<hr width=“75%”/>
<hr width=“25%”/>
HTML
<hr align="center" noshade size="5" width="150px" />
HTML