Sunteți pe pagina 1din 8

CSS

 CSS stands for Cascading Style Sheets


 CSS describes how HTML elements are to be displayed on screen,
paper, or in other media
 CSS saves a lot of work. It can control the layout of multiple web pages
all at once.
 CSS was introduced together with HTML4 to provide a better way to style
HTML elements.

CSS Syntax
A CSS rule-set consists of a selector and a declaration block:

The selector points to the HTML element you want to style.

The declaration block contains one or more declarations separated by


semicolons.

Each declaration includes a CSS property name and a value, separated by a


colon.

A CSS declaration always ends with a semicolon, and declaration blocks are
surrounded by curly braces.
In the following example all <p> elements will be center-aligned, with a red
text color:

Example
p {
color: red;
text-align: center;
}

The id Selector
The id selector uses the id attribute of an HTML element to select a specific
element.

The id of an element should be unique within a page, so the id selector is used


to select one unique element!

To select an element with a specific id, write a hash (#) character, followed by
the id of the element.

The style rule below will be applied to the HTML element with id="para1":

Example
#para1 {
text-align: center;
color: red;
}

The class Selector


The class selector selects elements with a specific class attribute.

To select elements with a specific class, write a period (.) character, followed by
the name of the class.

In the example below, all HTML elements with class="center" will be red and
center-aligned:
Example
.center {
text-align: center;
color: red;
}

How CSS can be added to HTML?

There are three ways of inserting a style sheet:

 External style sheet


 Internal style sheet
 Inline style

External Style Sheet


With an external style sheet, you can change the look of an entire website by
changing just one file!

Each page must include a reference to the external style sheet file inside the
<link> element. The <link> element goes inside the <head> section:

Example
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

Internal Style Sheet


An internal style sheet may be used if one single page has a unique style.

Internal styles are defined within the <style> element, inside the <head>
section of an HTML page:
Example
<head>
<style>
body {
background-color: linen;
}

h1 {
color: maroon;
}
</style>
</head>

Inline Styles
An inline style may be used to apply a unique style for a single element.

To use inline styles, add the style attribute to the relevant element. The style
attribute can contain any CSS property.

The example below shows how to change the color and the left margin of a
<h1> element:

Example
<h1 style="color:blue;margin-left:30px;">This is a heading</h1>

DOM
The Document Object Model is a programming API for documents. The object model
itself closely resembles the structure of the documents it models.

For instance, consider this table, taken from an HTML document:


<TABLE>
<ROWS>
<TR>
<TD>Shady Grove</TD>
<TD>Aeolian</TD>
</TR>
<TR>
<TD>Over the River, Charlie</TD>
<TD>Dorian</TD>
</TR>
</ROWS>
</TABLE>

The Document Object Model represents this table like this:

CGI
 The Common Gateway Interface (CGI) is a specification defined by the World Wide Web
Consortium (W3C), defining how a program interacts with a Hyper Text Transfer Protocol
(HTTP) server.
 The Common Gateway Interface (CGI) provides the middleware between WWW servers
and external databases and information sources.
 CGI applications perform specific information processing, retrieval, and formatting tasks
on behalf of WWW servers.
 CGI can do two things:

1. It can gather information sent from the web browser to web server and make the
information available to an external program.
2. CGI can send output of a program to a web browser that request it.
Fig: simple diagram of CGI

Working of CGI (Common Gateway Interface)

As shown in the above figure, a Web browser running on a client machine exchanges
information with a Web server using the Hyper Text Transfer Protocol or HTTP. The Web
server and the CGI program normally run on the same system, on which the web server
resides, Depending on the type of request from the browser, the web server either
provides a document from its own document directory or executes a CGI program.

Advantages:
 Web server and language independence.
 Wide acceptance.
 Simple to use.
Disadvantages:
 Each request start up a new process of the CGI.
 Stateless protocol.
 Communication to supplication must go through the web server.

ActiveX
 ActiveX is a set of object-oriented programming technologies and tools
that Microsoft developed for Internet Explorer to facilitate rich media
playback.
 Essentially, Internet Explorer uses the ActiveX software framework to
load other applications in the browser.
 ActiveX modules are more commonly known as controls or ActiveX
controls. ActiveX controls, which are somewhat similar to Java applets,
extend a browser's functionality.

What is ActiveX used for?

ActiveX controls can serve a wide variety of purposes.

For example: ActiveX controls were used early on to allow users to play videos and
other multimedia content directly through the browser without having to open a media
player.

Users could also work with ActiveX to view PDF files through the browser or to support
Flash animations.
Common examples of ActiveX controls include:

 Command button

 List boxes

 Dialog boxes.

 IE browsers

S-ar putea să vă placă și