Web Development Course: CSS, or Cascading Styles Sheets, Is A Way To Style
Web Development Course: CSS, or Cascading Styles Sheets, Is A Way To Style
In-line
In-line styles are plunked straight into the HTML tags
using the style attribute.
They look something like this:
<p style="color: red">text</p>
Internal
Embedded, or internal styles are used for the whole
page. Inside the head tags, the style tags surround all
of the styles for the page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>CSS Example</title>
<style type="text/css">
p { color: red;
}
a{
color: blue;
}
</style>
010101010101010101011111010101110101010101
Army Management Information Center
010101010101010101011111010101110101010101
Internal
Embedded, or internal styles are used for the whole
page. Inside the head tags, the style tags surround all
of the styles for the page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>CSS Example</title>
<style type="text/css">
p { color: red;
}
a{
color: blue;
}
</style>
010101010101010101011111010101110101010101
Army Management Information Center
010101010101010101011111010101110101010101
External
External styles are used for the whole, multiple-page
website. There is a separate CSS file, which will
simply look something like:
p { color: red;
}
a { color: blue;
}
border-spacing Sets the distance that separates cell borders (only for length length
the "separated borders" model)
table-layout Sets the algorithm used to display the table cells, auto
rows, and columns fixed
010101010101010101011111010101110101010101
Army Management Information Center
010101010101010101011111010101110101010101
CSS Dimension
The CSS dimension properties allow you to control the height and width
of an element. It also allows you to increase the space between two
lines.
Examples
Set the height of an image using a pixel value
This example demonstrates how to set the height of an element using a pixel
value.
Set the height of an image using percent
This example demonstrates how to set the height of an element using a percent
value.
Set the width of an element using a pixel value
This example demonstrates how to set the width of an element using a pixel
value.
Set the width of an element using percent
This example demonstrates how to set the width of an element using a percent
value.
010101010101010101011111010101110101010101
Army Management Information Center
010101010101010101011111010101110101010101
CSS Classification
The CSS classification properties allow you to specify how and where to
display an element.
Examples
How to display an element as an inline element.
This example demonstrates how to display an element as an inline element.
How to display an element as a block element
This example demonstrates how to display an element as a block element.
A simple use of the float property
Let an image float to the right in a paragraph.
An image with border and margins that floats to the right in a paragraph
Let an image float to the right in a paragraph. Add border and margins to the
image.
010101010101010101011111010101110101010101
Army Management Information Center
010101010101010101011111010101110101010101
Position:absolute
This example demonstrates how to position an element using an absolute
value.
How to make an element invisible
This example demonstrates how to make an element invisible. Do you want
the element to show or not?
How to make a table element collapse
This example demonstrates how to make a table element collapse.
Change the cursor
This example demonstrates how to change the cursor.
Clear the sides of an element
This example demonstrates how clear the sides of other floating elements.
010101010101010101011111010101110101010101
Army Management Information Center
010101010101010101011111010101110101010101
CSS Positioning
The CSS positioning properties allows you to position an element.
Examples
Position:relative
This example demonstrates how to position an element relative to its
normal position.
Position:absolute
This example demonstrates how to position an element using an absolute
value.
Position:fixed
This example demonstrates how to position an element with relative to the
browser window.
010101010101010101011111010101110101010101
Army Management Information Center
010101010101010101011111010101110101010101
Z-index
Z-index can be used to place an element "behind" another element.
Z-index
The elements in the example above have now changed their Z-index.