Reputation: 619
I want to hide after every 10 div element first 4 div element. So how it's possible using nth-of-type
OR any other style css.
Any one have idea for my question then please update me.
Upvotes: 0
Views: 76
Reputation: 16855
Try to use nth-child
css selector here...you want 4 elements after every 10th element so use 10n+11
, 10n+12
, 10n+13
, 10n+14
...
Note: I have changed the color of selected element just for visual...use display:none
to hide...
.parent {
display: flex;
flex-wrap: wrap;
}
.parent div:nth-child(10n+11),
.parent div:nth-child(10n+12),
.parent div:nth-child(10n+13),
.parent div:nth-child(10n+14) {
background: red;
color: #fff;
}
.parent div {
padding: 10px;
background: #ccc;
font: 13px Verdana;
font-weight: bold;
margin: 4px;
color: #000;
}
<div class="parent">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
<div>22</div>
<div>23</div>
<div>24</div>
<div>25</div>
<div>26</div>
</div>
Upvotes: 5