|
|
Types - Using identifiers
|
|
Topic |
How to set 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.
Example:
<head>
<style>
a#test1
{
color: red;
background-color: orange;
}
a#test2
{
color: green;
background-color: yellow;
}
</style>
</head>
If we use internal styles with identifiers, we have to set the id for the style to take effect.
EX1:
<a href="index.php" id=test1> Index </a>
Result1: Index
EX1:
<a href="index.php" id=test2> Index </a>
Result1: Index
Now you can see how we have different styles for the same "a" tag.
|
|
A Note |
CSS - Cascading Style Sheets can be used along with html tags as explained in this site.
This simple CSS will help you to create much elegant and neat html web pages.
This does not need any additional softwares or codings.
All web browser are capable of handing CSS codes.
Note 2: If required you can using <span> instead of <div> tags.
div tag will start and end on new lines. span will not exceed the tag area.
|
|
|
|
|
|