Jump to content
  • 0

hover для а с id


resoursa
 Share

Question

Подскажите пожалуйста, как присвоить :hover для <a> с #id.

Вот код, получается для тегов <a> нужен :hover.

<div id="icons">
<a href="#" id="site_map_icon" title="Карта сайта"></a>
<a href="#" id="cotact_icon" title="Контакты"></a>
</div>

div#icons {
width:100%;
height:25px;
border:1px solid #f8f8f8;
}
#cotact_icon {
width:12px;
height:9px;
background:url(../../img/cont_icon.png);
display:block;
margin:7px 40px 0 auto;
}
#site_map_icon {
width:17px;
height:9px;
background:url(../../img/map_icon.png);
display:block;
float:right;
margin:7px 10px 0 auto;
}

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
  On 8/11/2011 at 10:58 AM, Softlink said:

а в чем, собственно сложность?

#cotact_icon:hover{...}

Ну например в хроме не работает... и с а тоже...

Ага, а так он зацепит все ссылки, а мне нужно только эти...

Edited by resoursa
Link to comment
Share on other sites

  • 0
  On 8/11/2011 at 11:11 AM, Temiks said:

Может лучше так


#cotact_icon:hover а{...}

Так обычно делают, чтобы отреагировал какой-то элемент, зависимый от #cotact_icon. А так селектор становится бессмысленным. Ведь #cotact_icon - это уже и есть ссылка.

  Quote

Или так


a:hover {...}

Ведь нужен hover для ссылки

Так не будет работать. Насколько я знаю, селектор по тегу не имеет приоритета перед id. :unsure:

  On 8/11/2011 at 11:17 AM, resoursa said:
  On 8/11/2011 at 10:58 AM, Softlink said:

а в чем, собственно сложность?

#cotact_icon:hover{...}

Ну например в хроме не работает... и с а тоже...

Ага, а так он зацепит все ссылки, а мне нужно только эти...

Как это не работает? У меня все работает.

Link to comment
Share on other sites

  • 0
  Quote

Как это не работает? У меня все работает.

О! Заработало, может чего не внимательно сделал огромный сенкс!!!

Да! Проблема в том что кеш чистить надо иногда... Shift+Ctrl+Del для хрома...

Edited by resoursa
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