Jump to content
  • 0

Смена стилей при наведении на таблицу


Avel_Mink
 Share

Question

Проблема в том как сделать, чтобы при наведении курсора на таблицу менялись стили у тегов <td>, находящихся в данной таблице. Простыми средствами я так понял это не решить, может кто поможет.

вот изначальная таблица:

<table>
<tr>
<td class="a1">
</td>
<td class="a2">
</td>
<td class="a3">
</td>
</tr>
<tr>
<td class="a4">
</td>
<td class="a_c">
CONTENT
</td>
<td class="a5">
</td>
</tr>
<tr>
<td class="a6">
</td>
<td class="a7">
</td>
<td class="a8">
</td>
</tr>
</table>

и надо сделать чтобы при наведении на эту таблицу менялись стили у всех тэгов <td>, то есть стало вот так:

<table>
<tr>
<td class="a1_h">
</td>
<td class="a2_h">
</td>
<td class="a3_h">
</td>
</tr>
<tr>
<td class="a4_h">
</td>
<td class="a_c">
CONTENT
</td>
<td class="a5_h">
</td>
</tr>
<tr>
<td class="a6_h">
</td>
<td class="a7_h">
</td>
<td class="a8_h">
</td>
</tr>
</table>

вот код CSS, если надо:

td.a1 {
width:10px;
height:10px;
background-image:url('/img/a/1.png')
}

td.a2 {
height:10px;
background-image:url('/img/a/2.png')
}

td.a3 {
width:10px;
height:10px;
background-image:url('/img/a/3.png')
}

td.a4 {
width:10px;
background-image:url('/img/a/4.png')
}

td.a_c {
background-color:#FFFFFF;
vertical-align:top;
padding:5px;
}

td.a5 {
width:10px;
background-image:url('/img/a/5.png')
}

td.a6 {
width:10px;
height:10px;
background-image:url('/img/a/6.png')
}

td.a7 {
height:10px;
background-image:url('/img/a/7.png')
}

td.a8 {
width:10px;
height:10px;
background-image:url('/img/a/8.png')
}
td.a1_h {
width:10px;
height:10px;
background-image:url('/img/a/h1.png')
}

td.a2_h {
height:10px;
background-image:url('/img/a/h2.png')
}

td.a3_h {
width:10px;
height:10px;
background-image:url('/img/a/h3.png')
}

td.a4_h {
width:10px;
background-image:url('/img/a/h4.png')
}

td.a_c {
background-color:#FFFFFF;
vertical-align:top;
padding:5px;
}

td.a5_h {
width:10px;
background-image:url('/img/a/h5.png')
}

td.a6_h {
width:10px;
height:10px;
background-image:url('/img/a/h6.png')
}

td.a7_h {
height:10px;
background-image:url('/img/a/h7.png')
}

td.a8_h {
width:10px;
height:10px;
background-image:url('/img/a/h8.png')
}

PS^ Данная конструкция делает вокруг таблицы рамку из картинок если че. Заранее спасибо за помощь

Edited by Avel_Mink
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
для td точно полно информации http://tinyurl.com/32txjta

понимаешь ли если бы я искал и не нашел, я бы сюда не обратился. Просто изменить стили при наведении на <td> это любой может сделать с помощью CSS. У меня же задача (если ты не внимательно прочитал) состоит в том, чтобы изменить стили одновременно у восьми тэгов <td> при наведении на ТАБЛИЦУ (это важно), а не на отдельную ячейку. Думаю тут без помощи js не обойтись, а в нем я не силен, поэтому и прошу помощи.

Link to comment
Share on other sites

  • 0

Avel_Mink,

Можно в принципе и на CSS

table:hover .a1 {прописываем новые стили при наведении}
table:hover .a2 {прописываем новые стили при наведении}
...
table:hover .a8 {прописываем новые стили при наведении}

Думаю мысль понятна. В ИЕ6 работать не будет.

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

  • Обсуждения

    • Актуальные контакты: Telegram: @Nikker_web E-Mail:   tarasevich.email@gmail.com Портфолио https://www.behance.net/d4d4186e Разрабатываю дизайн групп в соц сетях, сайтов, приложений, другой дизайн под заказ    
    • Актуальные контакты: Telegram: @Nikker_web E-Mail:   tarasevich.email@gmail.com   Разрабатываю дизайн групп в соц сетях, сайтов, приложений, другой дизайн под заказ   Портфолио https://www.behance.net/d4d4186e
    • Доброго всем времени суток. Прошу помощи. Научите принципу изменения футера. Движок Xenforo. Версия 2.2.10. Стиль дефолтный. Что именно нужно в итоге на фото примере. Мой шаблон app.footer less имеет следующее значение.  .p-footer { .xf-publicFooter(); a { .xf-publicFooterLink(); } } .p-footer-inner { .m-pageWidth(); .m-pageInset(); padding-top: @xf-paddingMedium; padding-bottom: @xf-paddingLarge; } .p-footer-row { .m-clearFix(); margin-bottom: -@xf-paddingLarge; } .p-footer-row-main { float: left; margin-bottom: @xf-paddingLarge; } .p-footer-row-opposite { float: right; margin-bottom: @xf-paddingLarge; } .p-footer-linkList { .m-listPlain(); .m-clearFix(); > li { float: left; margin-right: .5em; &:last-child { margin-right: 0; } a { padding: 2px 4px; border-radius: @xf-borderRadiusSmall; &:hover { text-decoration: none; background-color: fade(@xf-publicFooterLink--color, 10%); } } } } .p-footer-rssLink { > span { position: relative; top: -1px; display: inline-block; width: 1.44em; height: 1.44em; line-height: 1.44em; text-align: center; font-size: .8em; background-color: #4682B4; border-radius: 2px; } .fa-rss { color: white; } } .p-footer-copyright { margin-top: @xf-elementSpacer; text-align: center; font-size: @xf-fontSizeSmallest; } .p-footer-debug { margin-top: @xf-paddingLarge; text-align: right; font-size: @xf-fontSizeSmallest; .pairs > dt { color: inherit; } } @media (max-width: @xf-responsiveMedium) { .p-footer-row-main, .p-footer-row-opposite { float: none; } .p-footer-copyright { text-align: left; padding: 0 4px; // aligns with other links } }  
    • Нужны сайты с примерами верстки, типа https://css-tricks.com/. Типовые приемы и нестандартные на все случаи жизни. Накидайте ссылок.
×
×
  • 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