|
|
Tutorials » Css »
|
Topic |
How to set a different color for visited and unvisited links in Html?
How to have link with no underlines using style sheet?
|
|
Explanation |
Property: a:visited
Many times we want our links to show different colors.
We might want our visited links to be shown in red color and font size as 10px.
We might want our non-visited links to be shown in green color and font size as 15px.
This can be achieved by using internal style sheet coding
For this, in the header portion add the style as
<style>
a{color: green; font-size: 15px}
a:visited{color: red; font-size: 10px;}
</style>
Definition:
We can set the link property for visited links using the tag "a:visited".
We can set any property (text, box, font, background properties).
Example:
The below links will give you the result:
The first link is some dummy value so it will be treated as a non-visited link.
The second link is for the same page("link-styles.php") which is the visited link.
This is non-visited link
This is visited link
No underline Link:
Here we will show how to create links with out any underline
We use the attribute "text-decoration: none;" to handle it.
Example:
<a href="http://www.hscripts.com"
style="color: orange; font-size: 15px; text-decoration: none;">
Creating Link without a underline
</a>
Result:
Creating Link without a underline
|
|
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.
|
|
|
|