Ссылки

Html code href font color

T here are a few settings that can be useful for controlling the colors of text links.

    Define colors for all links on the page.

D efine colors for all links on the page

T he general color of text links is specified in the tag, like in the example below:

D efine colors for individual links on the page

T he method described above is for setting overall link colors for the page.

H owever, you might want one or more links to have different colors than the rest of the page.

    Placing font tags between the and the tag.
    This method will work on all browsers except MSIE 3.

N ote:
The RGB numbers indicate amounts of red, green, and blue using values between 0 and 255. You can read more about converting between RGB colors and hexadecimal colors here .

N ow, since neither of the two methods covers all browsers, we need to use both techniques at once.

T he last example is interesting. Not only because it will work on all browsers. But even more because it shows a general approach to making your pages browser safe.

S ince browsers simply leave out information that is not understood, you can work around browser differences by simply adding different settings for multiple browsers.

I f you want more advanced effects you should jump to the section about stylesheets .

5000 MB Server space !!
60 GB Traffic/Month !!

Php dynamic pages
Perl/cgi scripts
MySQL databases
Password protected folders
Advanced log file stats
Spam & Virus checked mail
Auto-installed scripts:
Forums, Chat, Shop,
Photo album, Livehelp etc.

Источник

There are three ways of changing the link color: inline, internal and external.

Inline method

Add the style attribute directly to the hyperlink code and specify the color property through the style attribute, then give a color value to it.

html> html> head> title>Title of the document title> head> body> p>Visit our a href="https://www.w3docs.com/" style="color: #8ebf42">website a>. p> body> html>

Result

Internal method

html> html> head> title>Title of the document title> style> a < color: #8ebf42; > style> head> body> p>Visit our a href="https://www.w3docs.com/">website a>. p> body> html>

There are 4 link states that links can be styled depending on what state they are in:

  • a:link — a normal, unvisited link,
  • a:visited — a link the user has visited,
  • a:hover — a link when a user mouses over it,
  • a:active — the moment a link is clicked.
Читайте также:  PHP Function Page

When setting the style for several link states, follow these rules:

html> html> head> title>Title of the document title> style> /* unvisited link */ a:link < color: #ccc; > /* visited link */ a:visited < color: #095484; > /* mouse over link */ a:hover < color: #8ebf42; > /* selected link */ a:active < color: #800000; > style> head> body> p>Visit our a href="https://www.w3docs.com/">website a>. p> body> html>

To change the underline color, first of all, you need to remove it with the «none» value of the text-decoration property and set the «none» value, then add the border-bottom property with the width (in this case, used as a hyperlink underline width) and border-style (solid, dotted, or dashed) properties. For the anchor text color, use the color property.

html> html> head> title>Title of the document title> style> a < text-decoration: none; > a:link < color: #000; border-bottom: 1px solid #ff0000; > a:visited < color: #e600e6; border-bottom: 1px solid #b3b3b3; > a:hover < color: #2d8653; border-bottom: 1px solid #000099; > style> head> body> p>Visit our a href="https://www.w3docs.com/">website a>. p> body> html>
html> html> head> title>Title of the document title> style> a.one:link < color: #ccc; > a.one:visited < color: #095484; > a.one:hover < color: #8ebf42; > a.two:link < color: #ccc; > a.two:visited < color: #095484; > a.two:hover < font-size: 150%; > a.three:link < color: #ccc; > a.three:visited < color: #095484; > a.three:hover < background: #8ebf42; > a.four:link < color: #ccc; > a.four:visited < color: #095484; > a.four:hover < font-family: monospace; > a.five:link < color: #095484; text-decoration: none; > a.five:visited < color: #095484; text-decoration: none; > a.five:hover < text-decoration: overline underline; > style> head> body> p>Mouse over the links and watch how they will be changed: p> p> a class="one" href="#">This link changes color a> p> p> a class="two" href="#">This link changes font-size a> p> p> a class="three" href="#">This link changes background-color a> p> p> a class="four" href="#">This link changes font-family a> p> p> a class="five" href="#">This link changes text-decoration a> p> body> html>

Now, we’ll demonstrate another example, where we use the color property with its «inherit» value. This will make the element take the color of its parent.

Читайте также:  Parsing dates in php
html> html> head> title>Title of the document title> style> p < color: green; > p a < color: inherit; > style> head> body> h1>Example h1> a href="https://www.w3docs.com/">W3docs.com a> p>Visit our a href="https://www.w3docs.com/">W3docs.com a> website. p> body> html>
html> html> head> title>Title of the document title> style> a < text-decoration-color: grey; > a:link < color: #777777; > a:hover < color: #2d8653; > style> head> body> p>Visit our a href="https://www.w3docs.com/">website a>. p> body> html>

External method

Using external stylesheets you can take control of all the hyperlinks of your site. With external stylesheets, many attractive hyperlink effects can be created to develop the look of your website.

With the external method, you’ll link your web pages to an external .css file that can be created by any text editor in your device. This is a more efficient method, especially when you need to style a large website. You can change your whole site at once by editing one .css file.

Источник

Свойства ссылок

Для управления видом различных ссылок в CSS используются псевдоклассы, которые указываются после селектора A через двоеточие. В табл. 1 приведены допустимые псевдоклассы и их описания.

Табл. 1. Псевдоклассы при работе со ссылками

Свойство Описание
A:link Определяет стиль для обычной непосещенной ссылки.
A:visited Определяет стиль для посещенной ссылки.
A:active Определяет стиль для активной ссылки. Активной ссылка становится при нажатии на нее.
A:hover Определяет стиль для ссылки при наведении на нее мышью.

Обычно использование псевдокласса link имеет тот же эффект, что и применение стиля к селектору A . Поэтому этот псевдокласс можно опустить.

Ссылки без подчеркивания

Одно из наиболее популярных применений CSS — это скрытие подчеркивания у ссылок. С позиции юзабилити не совсем верное решение, поскольку пользователь может сразу не догадаться, что текст, который он видит, является ссылкой. Все ведь уже привыкли — раз подчеркивание используется, значит это ссылка. Но при правильном применении отсутствие подчеркивания у ссылок может придать определенный эффект сайту. Часто делается, что при наведении курсора, ссылка становится подчеркнутой, меняет свой цвет или используется и тот и другой эффект одновременно (пример 1).

Пример 1. Подчеркивание у ссылки и изменение ее цвета

       

Пример ссылки

Ниже приведено использование данного примера. При наведении курсора на ссылку, она становится подчеркнутой и красной.

Подчеркнутые и надчеркнутые ссылки

Еще один пример демонстрирует использование в ссылках подчеркивания и надчеркивания одновременно. При этом эффекте тонкие линии будут появляться над и под ссылкой при наведении на нее курсора. Это достигается применением свойства text-decoration: underline overline в селекторе A:hover .

Читайте также:  Tailwind css react components

Пример 2. Использование подчеркивания в ссылках

       

Пример ссылки

Изменение размера ссылки

Пример 3 показывает, как изменять размер ссылки при наведении на нее курсора.

Пример 3. Изменение размера ссылки

       

Пример ссылки

Изменение цвета подчеркивания

Со ссылками, при помощи CSS, можно сделать интересную особенность. Цвет ссылки, при наведении на нее курсора мыши, остается неизменным, но зато у нее появляется подчеркивание другого цвета, нежели сама ссылка (пример 4).

Пример 4. Создание подчеркивание другого цвета

Ссылки разных цветов

Часто возникает необходимость на одной странице использовать ссылки разных цветов и размеров. И применять для каждой области веб-страницы ссылки подходящего типа. Одни для меню, другие для текста. В этом случае создаем два или больше класса со своими параметрами и применяем их по своему усмотрению. В примере 6 достаточно поменять значения у соответствующего класса, и цвета у ссылок, где этот класс используются, изменятся автоматически.

Пример 5. Ссылки разных цветов

     A < font-size: 14px; color: red; >A.link1 < font-size: 12px; color: green; >A.link2 

| Ссылка 1 |

Результат данного примера показан на рис. 1.

Разные ссылки на одной странице

Рис. 1. Разные ссылки на одной странице

Источник

Html code href font color

T here are a few settings that can be useful for controlling the colors of text links.

    Define colors for all links on the page.

D efine colors for all links on the page

T he general color of text links is specified in the tag, like in the example below:

D efine colors for individual links on the page

T he method described above is for setting overall link colors for the page.

H owever, you might want one or more links to have different colors than the rest of the page.

    Placing font tags between the and the tag.
    This method will work on all browsers except MSIE 3.

N ote:
The RGB numbers indicate amounts of red, green, and blue using values between 0 and 255. You can read more about converting between RGB colors and hexadecimal colors here .

N ow, since neither of the two methods covers all browsers, we need to use both techniques at once.

T he last example is interesting. Not only because it will work on all browsers. But even more because it shows a general approach to making your pages browser safe.

S ince browsers simply leave out information that is not understood, you can work around browser differences by simply adding different settings for multiple browsers.

I f you want more advanced effects you should jump to the section about stylesheets .

5000 MB Server space !!
60 GB Traffic/Month !!

Php dynamic pages
Perl/cgi scripts
MySQL databases
Password protected folders
Advanced log file stats
Spam & Virus checked mail
Auto-installed scripts:
Forums, Chat, Shop,
Photo album, Livehelp etc.

Источник

Оцените статью