Csce5560 - HTML and CSS
Csce5560 - HTML and CSS
Electronic Commerce
Secure Electronic Commerce
week #3-4
</head>
For example:
<html>
<header><title>This is the title of Hello World
<body> Example</title></header>
(Body: Web page content) <body>
</body> Hello world
</body>
</html> </html>
<body>
<h1>Ima Geeke</h1>
<h2>Ima Geeke</h2>
<h3>Ima Geeke</h3>
<h4>Ima Geeke</h4>
<h5>Ima Geeke</h5>
<h6>Ima Geeke</h6>
</body>
<body>
<h1>Ima Geeke</h1>
<p>123 State Street</p>
<p>Rochester, MN 55901</p>
<p>(507) 555-1212</p>
<p>imageeke@geeke.com</p>
<p>Objective: To get a
really sweet job.</p>
</body>
<h1>Ima Geeke</h1>
<p>123 State Street
<br>Rochester, MN 55901
<br>(507) 555-1212
<br>imageeke@geeke.com</p>
<p>Objective: To get a really
sweet job.</p>
<p>Languages:</p>
<ul>
<li>RPG</li>
<li>COBOL</li>
<li>Java</li>
</ul>
. . .
<p>Languages:</p>
<ul>
<li><a href="rpg.html">RPG</a></li>
<li><a href="cobol.html">COBOL</a></li>
<li><a href="http://java.sun.com">Java</a></li>
</ul>
CSCE 5560, E-COMMERCE HTML AND CSS OVERVIEW 17
Images (<img src>)
Use the image (IMG) tag with required source (SRC) attribute:
◦ Local File:
<img src="mypic.gif">
◦ Full URL:
<img src="http://www.ibm.com/c.gif">
No closing tag (</img>)
<h1>Ima Geeke</h1>
<img src="mypic.gif">
<img src="mypic.gif"
align="right">
. . .
<p align="center">
<b>Objective:</b> To get a
really <i>sweet</i> job.</p>
<body bgcolor="#FFFFAA">
<h1><font face="script" size="7" color="green">Ima
Geeke</font></h1>
CSCE 5560, E-COMMERCE HTML AND CSS OVERVIEW 26
16 Basic Colors
Example
p {
font-family: Georgia;
}
h2 {
font-family: "Courier New";
}
Enclose multi-word font names in quotes
CSCE 5560, E-COMMERCE HTML AND CSS OVERVIEW 35
CSS Properties for Fonts
font-family
◦ Can specify multiple fonts from highest to lowest priority
◦ If first font not found on user’s computer, next is tried
◦ Placing a generic font at end ensures that every computer will use a valid
font
◦ Generic font names:
◦
Example
p {
font-family: Garamond, "Times New Roman", serif;
}
Example
h2 {
border: 5px solid red;
}
Example
p {
padding: 20px; border: 3px solid black;
}
h2 {
padding: 0px; background-color: yellow;
}
Example
p {
margin: 50px;
background-color: fuchsia;
}
Example
p {
width: 350px; background-color: yellow;
}
h2 {
width: 50%; background-color: aqua;
}
• Note:
PHP is a server-side language that can be used in
conjunction with a database to create dynamic web
pages.
Example HTML form using the GET method: Example PHP script to process the GET data:
<?php
<form action="process.php" method="GET"> if (isset($_GET['name'])) {
<label for="name">Name:</label> $name = $_GET['name’];
<input type="text" id="name" name="name"> echo "Hello, $name!";
<input type="submit" value="Submit"> }
</form> ?>
Example HTML form using the POST method: Example PHP script to process the POST data:
<form action="process.php" method="POST"> <?php
<label for="password">Password:</label> if (isset($_POST['password'])) {
<input type="password" id="password" name="password"> $password = $_POST['password’];
<input type="submit" value="Submit"> echo "Password received: $password";
</form> }
?>
∴ Choose the GET method when you want to retrieve data or perform navigation, and
use the POST method when dealing with sensitive or substantial data that should not be
visible in the URL.
CSCE 5560, E-COMMERCE HTML AND CSS OVERVIEW 52
Form Elements
•Used to gather specific pieces of data from the user
•Attributes: we need to use on the form element tags:
◦ NAME attribute
◦ Specifies a name for a piece of data
◦ VALUE attribute
◦ Available on selection elements
◦ Allows the return value to be different than the display text
<p>Comments:
<br><textarea name="comments">
</textarea></p>
</form>
A password field:
<input type="password" name="textfield3" value="secret">
Note two of these use INPUT tag, but one uses TEXTAREA
CSCE 5560, E-COMMERCE HTML AND CSS OVERVIEW 57
Drop-Down List
Use the SELECT tag as the container for the options
◦ Specify the NAME attribute here
<select name="state"></select>
Use the OPTION tag to define each option
◦ Can optionally use the VALUE attribute to return a value that is
different that the display text:
<select name="state">
<option value="MN">Minnesota</option>
</select>
◦ SELECTED attribute pre-selects one of the options
Additional arguments:
◦ SIZE: number of items visible in list (default is "1")
◦ MULTIPLE: if set to "true", any number of items may be
selected (default is "false")
If two or more radio buttons have the same name, the user can only select one of them
at a time
◦ This is how you make a radio button “group”
If you ask for the value of that name, you will get the value specified for the selected
radio button
Radio buttons do not contain any text
CSCE 5560, E-COMMERCE HTML AND CSS OVERVIEW 62
Radio Buttons
<p>Please choose your ranting level:
<br><input type="radio" name="rant" value="1"
checked>Peeved</input>
<br><input type="radio" name="rant" value="2">Seeing Red</input>
<br><input type="radio" name="rant" value="3">Angry</input>
<br><input type="radio" name="rant" value="4">Mad</input>
</p>
TYPE: "checkbox"
NAME: used to reference this form element from PHP
VALUE: value to be returned when element is checked
Note that there is no text associated with the checkbox – you
have to supply text in the surrounding HTML