0% found this document useful (0 votes)
22 views

Css Mod4

Uploaded by

mahanoct1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Css Mod4

Uploaded by

mahanoct1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

HTML CLASS ATTRIBUTE

 The HTML class attribute is used to specify a class for an HTML element.
 Multiple HTML elements can share the same class.
Using The class Attribute:
The class attribute is often used to point to a class name in a style sheet. It can also be
used by a JavaScript to access and manipulate elements with the specific class name.
In the following example we have three <div> elements with a class attribute with the
value of "city". All of the three <div> elements will be styled equally according to the .city
style definition in the head section:
CSS PSEUDO-CLASSES
A pseudo-class is used to define a special state of an element.
For example, it can be used to:
 Style an element when a user mouses over it.
 Style visited and unvisited links differently.
 Style an element when it gets focus.

Syntax
The syntax of pseudo-classes:

selector:pseudo-class {
property: value;
}
Pseudo-classes can be combined with HTML classes:
When you hover over the link in the example, it will change color:
Hover on <div>
An example of using the :hover pseudo-class on a <div> element:
Simple Tooltip Hover
Hover over a <div> element to show a <p> element (like a tooltip):

CSS - The :first-child Pseudo-class


The :first-child pseudo-class matches a specified element that is the first
child of another element.
Match the first <p> element
In the following example, the selector matches any <p> element that is the
first child of any element:

Match the first <i> element in all <p> elements

In the following example, the selector matches the first <i> element in all
<p> elements:
Match all <i> elements in all first child <p> elements
In the following example, the selector matches all <i> elements in <p>
elements that are the first child of another element:
CSS - The :lang Pseudo-class
The :lang pseudo-class allows you to define special rules for different
languages.

In the example below, :lang defines the quotation marks for <q> elements
with lang="no":

CELL SPANNING
HTML tables can have cells that span over multiple rows and/or columns.
 Colspan
 Rowspan

HTML Table – Colspan


 To make a cell span over multiple columns, use the colspan attribute:
HTML Table - Rowspan
 To make a cell span over multiple rows, use the rowspan attribute:
Note:
 The value of the rowspan attribute represents the number of rows to
span.
 The value of the colspan attribute represents the number of columns
to span.

You might also like