Skip to main content

Posts

CSS Tutorial – Lesson 1 Part II

In the previous lesson we learned how to define a CSS rule, and we had shown that a CSS rule consists of two parts a selector and a declaration. In the previous lesson we talked that in the selector we might write the html element we want to style. In our lesson today, completing with CSS rules, we’ll see now other types of selectors, The ID selector: CSS allows you to specify a style for a single element, regardless to its tag, depending on its id attribute. as you know, in XHTML each element has an id attribute, and this id must be unique. To define a CSS rule depending on the ID selector below the syntax for it: Example: #theID { font-size: 14px; } Notes: The above CSS rule will be applied for any element whose id = theID, The ID selector must start with #. The Class Selector: Unlike the ID selector, the class selector allows us to define a rule for multiple elements regardless to their tag. The class selector enables us to define a common style for common elements,...

CSS Tutorial – Lesson 1 Part I

What is CSS? CSS refers to Cascading Style Sheets, In general styles define how to display elements on the web page. Why CSS? By CSS, we can define a style for a web page and make it standard for all web pages on the website, changes to the style will be applicable to all pages on the same time. another point of view, CSS responsible for formatting elements of a page, this feature makes the HTML/XHTML responsible on defining the content of the page, and does not have a role in formatting the elements. CSS created by W3C to solve a problem of HTML/XHTML, suppose you want to design your page in some specifications for fonts and colors used, then without using CSS, you have to write these specification for each page you want to apply this design to it, moreover, you might need to apply same design specifications on two different places on the same page, without CSS, you have to write it where ever you want it, this will make page design more complex and poor. Syntax: A CSS rule cons...

XHTML Tutorial–Lesson 1 Part IV

Summary In this lesson, I’ll try to summarize all what we learned in the previous lessons about XHTML. Remember that XHTML refers to EXtensible Markup Language, which is a cleaner version of HTML, defined as an XML application, recommended by W3C, and compatible with all web browsers. Remark that all XHTML elements are written in lower case. Note that XHTML elements must be nested correctly and be a well formed structure. Remark that all XHTML tags must have a closing tag. Remember that empty tags are closed by a space followed by a forward slash then greater than symbol  />. Note that attribute values must be enclosed within double quotes. Attribute minimization is not allowed. Each XHTML document must start with a DOCTYPE declaration. Finally, The structure of XHTML document is, DOCTYPE declaration, followed by html tag, followed by a head tag, followed by title, followed by body tag. Remember that this structure is mandatory and not optional. End of XHTML Tutorial,...

XHTML Tutorial–Lesson 1 Part III

Document Type Definition DTD As we said in the previous lesson, DTD is mandatory for each XHTML document, and we saw the structure for each XHTML document, that consists of DOCTYPE, html, head, title, body. In other words there is three parts that each XHTML document contain, The DOCTYPE definition. The head section. The body section. Remember: DOCTYPE definition is the first thing to be written in the XHTML document. Below an example for an XHTML document: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Welcome</title> </head> <body> <h1>Welcome To my page!</h1> </body> </html> Notes As we said before, each XHTML document must start with a DOCTYPE definition, that describes the syntax of a web page, and the allowed syntax to be used, In other words it specifies allowed tags to be used ...

XHTML Tutorial–Lesson 1 Part II

XHTML vs. HTML Continuing with differentiating XHTML from HTML, in this lesson am going to mention some more rules for XHTML that differs it from HTML. · Attribute values must be enclosed within double quotations. · Attribute minimization is not allowed. · Each XHTML page must have a DTD (Document Type Definition) that describes elements used in the page. Below examples that illustrate the difference between XHTML and HTML for the above points: In HTML, you might write something like this: <font color=red>Anas</font> In XHTML it is not valid, each attribute value must be enclosed within double quotations. <font color=”red”>Anas</font> For the second point, attribute minimization is not allowed in XHTML, For example it is accepted in HTML to write <option checked> Or <frame noresize> Or <input disabled> All the above are not allowed in XHTML, you cannot abbreviate or minimize attributes, To be written correctly in XHTML, it must be writ...

XHTML Tutorial–Lesson 1 Part I

Preamble: This tutorial expects that you’ve the basics of HTML 4.01, and supposes that you are familiar with its syntax and purpose. In this tutorial I’ll try to introduce XHTML concept and why we should use XHTML instead of HTML, we’ll talk about differences between HTML and XHTML. We’ll talk about some of web standards that we have to follow when developing a web-based applications. What is XHTML? XHTML stands for EXtensible Hypertext Markup Language, it is almost identical to HTML 4.01, but it is a cleaner version of HTML. We might look to XHTML from a point of view that it is an HTML defined as an XML application. Above all XHTML is recommended by W3C, and though it’s compatible and supported with all web-browsers. XHTML consists of all HTML 4.01 elements combined together with the structure of XML. Why XHTML? The problem of HTML where on no standardization for web browsers, many web browsers around the world, each browser implemented in a way differs from other browsers,...

PHP Tutorial–Lesson 5: Introduction to PHP- Part III

PHP and MySQL •Our previous application displays all employees in one web page, how about displaying information about one employee? •To display information about a single employee we have to specify some information about this employee, such as his id. •Our next application, will enhance the previous one, and improve it to display information for a single employee. Example: <?php // inquery.php $form=‘<form name=“employee” method=“get” action=“employee.php”> Employee No: <input type=“text” name=“id”><Br> <input type=submit value=“Go”> </form>’; echo $form; ?> <?php // Employee.php // last modified 13/oct/2009 require(“../include/config.php”); If(isset($_GET[‘id’])) $id = $_GET[‘id’]; else die(“Unexpected value for employee id”); $sql = “SELECT * FROM employee WHERE id=$id”; $result = mysql_query($sql); If(!$result) die(“MySql Error: <br>“.mysql_error()); If(mysql_num_rows($result) == 0) echo “No information available<Br>”; else { $...