How to change color of a hyperlink

For change of color of hyperlinks in web pages the CSS language color attribute is most often used (Cascading Style Sheets - "Cascading style sheets"). Less functional solutions of this task are also in the HTML language (HyperText Markup Language — "hypertext markup language"). It is required to you • Basic knowledge of the HTML and CSS languages Instruction 1. Prepare the block of the description of styles for hyperlinks. In the simplest view it can look, for example, so: {color: Green } Here ""an"" is called "selector" which specifies that the description of style which is contained in brackets should be applied to all to tags links in the document. Green defines color of the link. It is very much rough definition of color which is applied seldom. Much more often "pseudo-class" is added to the selector - it is a tag which allows to specify style of the link in three different statuses. 2. Use psevdokalass link to set style for a normal (inactive) status of the link. It can look, for example, so: a:link {color: Green } 3. Use psevdokalass hover to specify how the link at guidance of the cursor of a mouse should look. For example: a:hover {color: Lime } 4. Use psevdokalass visited for the description of style of already visited link. For example: a:visited {color: DarkGreen } 5. Integrate all three statuses in one block of the description of styles. Look the HTML-code containing CSS descriptions of styles can, for example, so: Here the opening and closing HTML tags of style report to the browser where the description of styles begins and comes to an end, and between them the description of behavior of links in three statuses is placed. 6. In the sample used above only color responses are specified, but it is possible to include in the description also other attributes. For example, if the design of the page demands that in the normal (inactive) state the link was not underlined, and at guidance of the cursor was emphasized, then the code can be modified so: 7. If it is required to change color only of some links in the page, and to leave the others with installations by default, then it is necessary to add the class attribute to the tag of each changeable link. For example, call this class of hyperlinks by the name newLinks. Then the tag of the link can look so: the text reference the Same class name should be added also to the description of styles: 8. Place prepared on the basis of described above the code of the description of styles in a heading part of the page is model - between the tags and . If necessary add to tags of links the class attribute with the name used in the description of styles. Then save the changed page, and the procedure of change of color of hyperlinks will be complete.

Author: «MirrorInfo» Dream Team


Print