Jump to content
  • 0

Совсем простой вопрос


new01
 Share

Question

Вот у меня вначале страницы указаны цвета ссылок в стилях:


body a{color:red;}
body a:hover{color:red;}
body a:active{color:red;}

Но некоторые ссылки на странице я хчу сделать другим цветом, поэтому делаю так


<a href='' class='newcolor'>link</a>
style:
.newcolor{color:green}

Почему так цвет не меняется? он меняется только если мы сделаем вот так


<a href='' style='color:green;'>link</a>

Как изменить цвет с помощью класса?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Спецефичность в порядок приведите.

body a{color:red;}
body a:hover{color:red;}
body a:active{color:red;}

body уберите из селекторов, нафига оно тут.

А новым ссылки задавайте в таком духе:

a.newcolor:link {}
a.newcolor:visited {}
a.newcolor:hover {}
a.newcolor:active {}

Тогда точно не будет проблем.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy