Can anyone see or think why I can't hide items 5 onwards?
I would like to show ONLY items #1, #2, #3, and #4 with the rest all hidden (i.e. completely hidden from the code).
I can hide them from the client view but view source you can see the HTML - what am I doing wrong here?
I have tried:
visibility: hidden
As well as
display: none
And still, the code is there...
ul>li {
display: inline-block;
/* You can also add some margins here to make it look prettier */
width: 180px;
zoom: 1;
*display: inline;
/* this fix is needed for IE7- */
}
ul>li:nth-of-type(1n+5) {
display: none;
}
.speakercard {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
max-width: 180px;
margin: auto;
text-align: center;
padding-top: 14px;
}
button {
border: none;
outline: 0;
display: inline-block;
padding: 10px;
color: white;
background-color: #393939;
text-align: center;
cursor: pointer;
width: 100%;
}
a {
text-decoration: none;
color: black;
}
button:hover,
a:hover {
opacity: 0.7;
}
.image-cropper {
width: 100px;
height: 100px;
position: relative;
overflow: hidden;
border-radius: 50%;
border: 1px solid #ccc;
margin-left: auto;
margin-right: auto;
}
.profile-pic {
display: inline;
margin: 0 auto;
height: 100%;
width: auto;
}
<ul>
<li>
<div class="speakercard">
<div class="image-cropper">
<img src="./img.jpeg" class="profile-pic" alt="" style="width:100%">
</div>
<p>1 Poo Doe</p>
<p><button>Speaker Profile</button></p>
</div>
</li>
<li>
<div class="speakercard">
<div class="image-cropper">
<img src="./img.jpeg" class="profile-pic" alt="" style="width:100%">
</div>
<p>2 Doe</p>
<p><button>Speaker Profile</button></p>
</div>
</li>
<li>
<div class="speakercard">
<div class="image-cropper">
<img src="./img.jpeg" class="profile-pic" alt="" style="width:100%">
</div>
<p>3 Doe</p>
<p><button>Speaker Profile</button></p>
</div>
</li>
<li>
<div class="speakercard">
<div class="image-cropper">
<img src="./img.jpeg" class="profile-pic" alt="" style="width:100%">
</div>
<p>4 Doe</p>
<p><button>Speaker Profile</button></p>
</div>
</li>
<li>
<div class="speakercard">
<div class="image-cropper">
<img src="./img.jpeg" class="profile-pic" alt="" style="width:100%">
</div>
<p>THIS SHOULD BE TOTALLY HIDDEN</p>
<p><button>Speaker Profile</button></p>
</div>
</li>
<li>
<div class="speakercard">
<div class="image-cropper">
<img src="./img.jpeg" class="profile-pic" alt="" style="width:100%">
</div>
<p>THIS SHOULD BE TOTALLY HIDDEN</p>
<p><button>Speaker Profile</button></p>
</div>
</li>
<li>
<div class="speakercard">
<div class="image-cropper">
<img src="./img.jpeg" class="profile-pic" alt="" style="width:100%">
</div>
<p>THIS SHOULD BE TOTALLY HIDDEN</p>
<p><button>Speaker Profile</button></p>
</div>
</li>
</ul>
Any idea how to make this happen?
Thanks!