HTML Form Controls: Action
HTML Form Controls: Action
HTML Form Controls: Action
1
action
2
method
Method to be used to upload data. The most frequently used are GET and POST
methods.
3
target
Specify the target window or frame where the result of the script will be displayed. It takes
values like _blank, _self, _parent etc.
4
enctype
You can use the enctype attribute to specify how the browser encodes the data before it
sends it to the server. Possible values are −
mutlipart/form-data − This is used when you want to upload binary data in the form of
files like image, word file etc.
Note − You can refer to Perl & CGI for a detail on how form data upload works.
HTML - Marquees
n HTML marquee is a scrolling piece of text displayed either horizontally across or
vertically down your webpage depending on the settings. This is created by using
HTML <marquees> tag.
Note − The <marquee> tag deprecated in HTML5. Do not use this element, instead
you can use JavaScript and CSS to create such effects.
Syntax
A simple syntax to use HTML <marquee> tag is as follows −
<marquee attribute_name = "attribute_value"....more attributes>
One or more lines or text message or image
</marquee>
1
width
This specifies the width of the marquee. This can be a value like 10 or 20% etc.
2
height
This specifies the height of the marquee. This can be a value like 10 or 20% etc.
3
direction
This specifies the direction in which marquee should scroll. This can be a value like up,
down, left or right.
4
behavior
This specifies the type of scrolling of the marquee. This can have a value like scroll,
slide and alternate.
5
scrolldelay
This specifies how long to delay between each jump. This will have a value like 10 etc.
6
scrollamount
This specifies the speed of marquee text. This can have a value like 10 etc.
7
loop
This specifies how many times to loop. The default value is INFINITE, which means that
the marquee loops endlessly.
8
bgcolor
This specifies background color in terms of color name or color hex value.
9
hspace
This specifies horizontal space around the marquee. This can be a value like 10 or 20%
etc.
10
vspace
This specifies vertical space around the marquee. This can be a value like 10 or 20% etc.
Examples - 1
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML marquee Tag</title>
</head>
<body>
<marquee>This is basic example of marquee</marquee>
</body>
</html>
Examples - 2
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML marquee Tag</title>
</head>
<body>
<marquee width = "50%">This example will take only 50%
width</marquee>
</body>
</html>
Examples - 3
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML marquee Tag</title>
</head>
<body>
<marquee direction = "right">This text will scroll from left
to right</marquee>
</body>
</html>
Examples - 4
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML marquee Tag</title>
</head>
<body>
<marquee direction = "up">This text will scroll from bottom
to up</marquee>
</body>
</html>
HTML - Header
We have learnt that a typical HTML document will have following structure −
Document declaration tag
<html>
<head>
Document header related tags
</head>
<body>
Document body related tags
</body>
</html>
This chapter will give a little more detail about header part which is represented by
HTML <head> tag. The <head> tag is a container of various important tags like <title>,
<meta>, <link>, <base>, <style>, <script>, and <noscript> tags.
The HTML <title> Tag
The HTML <title> tag is used for specifying the title of the HTML document. Following
is an example to give a title to an HTML document −
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML Title Tag Example</title>
</head>
<body>
<p>Hello, World!</p>
</body>
</html>
Following are few of the important usages of <meta> tag inside an HTML document −
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML Meta Tag Example</title>
</head>
<body>
<p>Hello, World!</p>
</body>
</html>
For example, all the given pages and images will be searched after prefixing the given
URLs with base URL http://www.tutorialspoint.com/ directory −
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML Base Tag Example</title>
<base href = "https://www.tutorialspoint.com/" />
</head>
<body>
<img src = "/images/logo.png" alt = "Logo Image"/>
<a href = "/html/index.htm" title = "HTML Tutorial"/>HTML
Tutorial</a>
</body>
</html>
But if you change base URL to something else, for example, if base URL is
http://www.tutorialspoint.com/home then image and other given links will become like
http://www.tutorialspoint.com/home/images/logo.png and
http://www.tutorialspoint.com/html/index.htm
<!DOCTYPE html>
<html>
<head>
<title>HTML link Tag Example</title>
<base href = "https://www.tutorialspoint.com/" />
<link rel = "stylesheet" type = "text/css" href =
"/css/style.css">
</head>
<body>
<p>Hello, World!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>HTML style Tag Example</title>
<base href = "https://www.tutorialspoint.com/" />
<body>
<p class = "myclass">Hello, World!</p>
</body>
</html>
Note − To learn about how Cascading Style Sheet works, kindly check a separate
tutorial available at css
<!DOCTYPE html>
<html>
<head>
<title>HTML script Tag Example</title>
<base href = "http://www.tutorialspoint.com/" />
<body>
<input type = "button" onclick = "Hello();" name = "ok" value
= "OK" />
</body>
</html>
This will produce the following result, where you can try to click on the given button −
Cascading Style Sheets (CSS) provide easy and effective alternatives to specify
various attributes for the HTML tags. Using CSS, you can specify a number of style
properties for a given HTML element. Each property has a name and a value,
separated by a colon (:). Each property declaration is separated by a semi-colon (;).
Example
First let's consider an example of HTML document which makes use of <font> tag and
associated attributes to specify text color and font size −
<!DOCTYPE html>
<html>
<head>
<title>HTML CSS</title>
</head>
<body>
<p><font color = "green" size = "5">Hello, World!</font></p>
</body>
</html>
We can re-write above example with the help of Style Sheet as follows −
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML CSS</title>
</head>
<body>
<p style = "color:green; font-size:24px;" >Hello, World!</p>
</body>
</html>
External Style Sheet − Define style sheet rules in a separate .css file and then
include that file in your HTML document using HTML <link> tag.
Internal Style Sheet − Define style sheet rules in header section of the HTML
document using <style> tag.
Inline Style Sheet − Define style sheet rules directly along-with the HTML
elements using style attribute.
Let's see all the three cases one by one with the help of suitable examples.
Example
Consider we define a style sheet file style.css which has following rules −
.red {
color: red;
}
.thick {
font-size:20px;
}
.green {
color:green;
}
Here we defined three CSS rules which will be applicable to three different classes
defined for the HTML tags. I suggest you should not bother about how these rules are
being defined because you will learn them while studying CSS. Now let's make use of
the above external CSS file in our following HTML document −
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML External CSS</title>
<link rel = "stylesheet" type = "text/css" href =
"/html/style.css">
</head>
<body>
<p class = "red">This is red</p>
<p class = "thick">This is thick</p>
<p class = "green">This is green</p>
<p class = "thick green">This is thick and green</p>
</body>
</html>
Rules defined in internal style sheet overrides the rules defined in an external CSS file.
Example
Let's re-write above example once again, but here we will write style sheet rules in the
same HTML document using <style> tag −
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML Internal CSS</title>
<style type = "text/css">
.red {
color: red;
}
.thick{
font-size:20px;
}
.green {
color:green;
}
</style>
</head>
<body>
<p class = "red">This is red</p>
<p class = "thick">This is thick</p>
<p class = "green">This is green</p>
<p class = "thick green">This is thick and green</p>
</body>
</html>
Rules defined inline with the element overrides the rules defined in an external CSS file
as well as the rules defined in <style> element.
Example
Let's re-write above example once again, but here we will write style sheet rules along
with the HTML elements using style attribute of those elements.
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML Inline CSS</title>
</head>
<body>
<p style = "color:red;">This is red</p>
<p style = "font-size:20px;">This is thick</p>
<p style = "color:green;">This is green</p>
<p style = "color:green;font-size:20px;">This is thick and
green</p>
</body>
</html>