Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/myscript/public_html/classes/classdb.php on line 42
Internal Styles - Identifiers style - CSS(HTML) Tutorial

Internal Styles - Identifiers

How to set internal style using identifiers?
I want to set style to standard html tags. But I want to restrict the styles to certain keys only, how to do it?

Explanation


When we use universal styles it will set style for all the tags of that type.
But many times we will want to set different styles at different positions for the same type of tag.
That when we use identifiers.
If we use internal styles with identifiers, we have to set the id for the style to take effect.

Example:


<head>
<style>
a#test1
{
color: red;
background-color: orange;
}
a#test2
{
color: green;
background-color: yellow;
}
</style>
</head>

<a href="index.php" id=test1> Index </a><br><br>
<a href="index.php" id=test2> Index </a>

Result:



Now you can see how we have different styles for the same "a" tag.

Ask Questions

Ask Question