Question: I am facing an issue where .main-index a:nth-child(4)
works on my first a
link, but not .main-index a:nth-child(1)
.
I have been unable to identify the problem or figure out what I might be doing incorrectly.
The current method works, but I acknowledge that it may not be the correct way to select the first one. Can anyone provide guidance on how to properly select the first a
within .main-index
?
.main-index h2 {
height: 60px;
text-align: center;
line-height: 60px;
background-color: #3b3b3b;
color: white;
font-size: 25px;
letter-spacing: 1px;
margin: 0;
font-family: "LemonMilk";
}
/********************************************
3.0 feedback
*********************************************/
.main-index p:nth-of-type(1) {
margin: 15px 0 0 10px;
text-transform: uppercase;
font-size: 14px;
float: left;
font-family: "NeueHaasGrotesk Light";
}
.main-index p:nth-of-type(2) {
clear: both;
margin-top: 10px;
display: inline-block;
}
.main-index img {
margin: 10px 0 0 5px;
height: 25px;
float: left;
}
.main-index a:nth-child(4) {
float: right;
margin: 7px 10px 0 0;
padding: 10px;
background-color: #0e8f9c;
color: white;
border: none;
font-size: 13px;
text-transform: capitalize;
letter-spacing: 1px;
font-family: "NeueHaasGrotesk medium";
}
/********************************************
5.0 Ticket Info International Student
*********************************************/
.main-index p:nth-of-type(2) {
margin: 10px;
font-size: 18px;
}
.main-index a:nth-child(6) {
background-color: #d3464e;
padding: 10px;
margin: 15px;
display: block;
text-align: center;
}
/********************************************
6.0 main content
*********************************************/
.background-home {
background-image: url(../img/goingoutparadiso.jpg);
background-size: cover;
background-repeat: no-repeat;
background-position: 80%;
padding: 20px 0;
}
.background-home li {
text-align: center;
line-height: 90px;
font-size: 50px;
border-bottom: 5px solid white;
border-top: 5px solid white;
box-shadow: 1px 1px 2px #3b3b3b;
text-transform: uppercase;
padding-top: 10px;
padding-bottom: 10px;
width: 100%;
}
.background-home a {
display: block;
}
.background-home h3 {
margin: 0;
font-family: "NeueHaasGrotesk bold";
text-shadow: 2px 2px #3b3b3b;
border: 3px solid white;
padding: 5px;
display: inline;
}
.background-home li:nth-child(1) {
border-top: 0;
}
.background-home li:nth-child(2) {
margin-top: 20px;
margin-bottom: 20px;
}
.background-home li:nth-child(3) {
margin-top: 20px;
margin-bottom: 20px;
}
.background-home li:nth-child(4) {
border-bottom: 0;
}
<main class="main-index">
<h2>different spots</h2>
<p>your feedback matters</p>
<img alt="feedback page indicator" src="img/more-info-arrow-black.svg">
<a href="feedback.html">feedback</a>
<p>Just like every student, you as an international student can get discount in several clubs and bars in Amsterdam. This ticket will save you time and money!</p>
<a href="https://www.tiqets.com/en/amsterdam-c75061/amsterdam-nightlife-clubs-free-drinks-p973786" target="_blank">Tickets for Amsterdam Nightlife & Clubs + Free Drinks</a>
<nav>
<ul class="background-home">
<li>
<a href="clubs.html"><h3>clubs</h3></a>
</li>
<li>
<a href="bars.html"><h3>bars</h3></a>
</li>
<li>
<a href=""><h3>music</h3></a>
</li>
<li>
<a href=""><h3>festivals</h3></a>
</li>
</ul>
</nav>
</main>