How To Change Link Color In Html

Table of contents:

How To Change Link Color In Html
How To Change Link Color In Html

Video: How To Change Link Color In Html

Video: How To Change Link Color In Html
Video: 69. How to Change Link Color in HTML (Hindi) 2024, November
Anonim

The color of HTML links is set using the appropriate tag directives. You can also use CSS code to change the parameters of the tag, which allows you to more accurately customize the colors and layout of the page.

How to change link color in html
How to change link color in html

Html

Open the HTML file with any text editor. To do this, right-click on the file and select "Open With", and then select the program to use.

Go to the page tag and set additional link, vlink and alink attributes. The link parameter determines the color of a regular link on the page and is blue by default. Adding the alink attribute will change the color when left-clicking (red by default). Vlink indicates the color of links that have already been visited. You can set the parameters as follows:

In this example, the color of the tagged text has been changed to black. When pressed with the mouse, the fragment will be highlighted in green. When you revisit the page, you will see that the link is brown.

Instead of specifying English names, you can also use HTML hex values to set the desired shade:

CSS

CSS attributes can be used to set the color on the page. For example:

Link

Link 2

The color of the text is set by specifying the CSS color parameter in the style attribute, which can be specified in either hexadecimal or word format.

To set the color for all links on the page using CSS, go to the section. Specify a tag to declare the use of the stylesheet in the document, and then set the visited, active, and hover parameters for the tag. For example, a piece of code might look like this:

Page title

a {color: green; }

a: visited {color: gray; }

a: active {color: yellow; }

a: hover {color: orange; }

& lt / head>

The simple a attribute indicates the color of a normal link placed on the page. A: visited defines the style for a previously visited link, a: active will be highlighted upon clicking. Hover sets the color options for hovering over text.

Save the changes made in the file and check the result of the code you specified in the browser window. If all parameters were specified correctly, you will see changes in the display of hyperlinks. To open an HTML document in a browser, double-click on it with the left mouse button or right-click and select the appropriate item from the “Open with” drop-down menu.

Recommended: