I seem to be facing an issue with the code below, possibly due to using both class
and id
in the same div. Despite knowing they are meant to work together.
For more information: Can I use DIV class and ID together in CSS?
.PB {
position: relative;
margin: 0 auto;
background-color: #000;
width: 201px;
height: 422px;
z-index: 1;
}
#pb1-1 {
position: absolute;
margin: 0px;
background-color: green;
width: 65px;
height: 98.5px;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
z-index: 2;
text-align: right;
font-size: 14px;
-webkit-text-stroke: 1px white;
}
#pb1-2 {
position: absolute;
margin: 0px;
background-color: yellow;
width: 65px;
height: 98.5px;
top: 0px;
right: 0px;
bottom: 0px;
left: 68px;
z-index: 2;
text-align: right;
font-size: 14px;
-webkit-text-stroke: 1px white;
}
#pb1-3 {
position: absolute;
margin: 0px;
background-color: red;
width: 65px;
height: 98.5px;
top: 0px;
right: 0px;
bottom: 0px;
left: 136px;
z-index: 2;
text-align: right;
font-size: 14px;
-webkit-text-stroke: 1px white;
}
.pu:hover {
font-size: 24px;
background-color: #999999;
}
<div class="PB">
<div id="pb1-1" class="pu">1 </div>
<div id="pb1-2" class="pu">2 </div>
<div id="pb1-3" class="pu">3 </div>
</div>
Could someone please point out where my mistake lies?