A
A
amazinginternetsites2015-12-20 20:12:13
PHP
amazinginternetsites, 2015-12-20 20:12:13

How to style the 6th diva?

Hello,
There are a number of divs

<div class="fieldset"></div>
<div class="fieldset"></div>
<div class="fieldset"></div>
<div class="fieldset"></div>
<div class="fieldset"></div>
<div class="fieldset"></div>
<div class="fieldset"></div>

How to set a specific style for the 2nd and 6th, for example?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
T
tvelforce, 2015-12-20
@amazinginternetsites

.fieldset:nth-child(6) {...}
on or with jquery:

$(document).ready(function(){
  $(".fieldset:eq(6)").addclass(".newclass"); // добавить CSS класс
  // или
  $(".fieldset:eq(6)").css({"background":"eee"}); // закрасить 6 блок серым
});

E
evnuh, 2015-12-20
@evnuh

:nth-child

A
Anar4you, 2015-12-20
@Anar4you

<div class="fieldset"></div>
<div class="class"></div>
<div class="fieldset"></div>
<div class="fieldset"></div>
<div class="fieldset"></div>
<div class="class"></div>
<div class="fieldset"></div>

what is the problem?

G
GoldenYear, 2015-12-20
@GoldenYear

<div class="fieldset"></div>
<div class="fieldset another-class1"></div>
<div class="fieldset"></div>
<div class="fieldset"></div>
<div class="fieldset"></div>
<div class="fieldset another-class2"></div>
<div class="fieldset"></div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question