2. Internal Styles
•
Here we define style under head tag and use it
for our tags.
Inside head tag we will define styles as given
in the examples.
Internal styles can be used in three ways,
universal,
identifiers,
user defined.
3. How to set internal style for html tags?
• I want all similar html tag to have a common
style.
i.e e.g: I want text inside every <font> tag to
look bold?
4. • Explanation
<head>
<style>
a
{
color: green;
}
</style>
</head>
If we use internal styles like this, the style will take effect for the tag
through out the page. That's all the "a" tag used in the page will have the
style.
Example:
This page defines the style as explained above. So we can see how a "a"
tag looks like
5. 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?
6. 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>
•