Home
XHTML
CSS
PHP
MySQL
SEO
JavaScript
Computer Basics
Number Systems
LINUX


CSS Classes and IDs

CSS | Styles | Colors | Type | Classes-IDs | Layout | Properties | Value Types

Tags are generally used repeatedly in an XHTML file. A CSS style can modify a single tag element, ignoring other identical tag elements. A Class or ID attribute is appended to the selected tag, then referenced in CSS with a given name.

Classes and IDs have only one difference and can be used interchangeably. A class can be declared multiple times. An ID can be declared only once. In the CSS file, a class is declared with the  .  period operator. An ID is declared with the  #  pound operator. Any name can be given to a class or ID, but must match the name appended to the XHTML tag. The CSS file is coded as...

.text {property:value;}

#head {property:value;}
#side {property:value;}
#body {property:value;}
#foot {property:value;}

The XHTML file is coded as...

<html>
<head>
<title>Title of Webpage</title>

<link rel="stylesheet" type="text/css" href="file.css" />

</head>
<body>

<div id="head">
<h1>Header Section</h1>
<p class="text">This is a paragraph.</p>
</div>

<div id="side">
<h1>Sidebar Section</h1>
<p class="text">This is a paragraph.</p>
</div>

<div id="body">
<h1>Body Section</h1>
<p class="text">This is a paragraph.</p>
</div>

<div id="foot">
<h1>Footer Section</h1>
<p class="text">This is a paragraph.</p>
</div>

</body>
</html>



SEO Vancouver, Washington
SEO Portland, Oregon
Website Design Vancouver, Washington