3
I have a list of social media icons, which I know how to do, I’m not here to ask how to do, but rather, a more correct way, to minimize my work, if there is, of course.
My HTML is like this:
<ul>
<li class="rodapeTitulos">Redes Sociais</li>
<li class="icoFB"></li>
<li class="icoTT"></li>
<li class="icoIns"></li>
<li class="icoPlu"></li>
<li class="icoPin"></li>
</ul>
My CSS:
.icoFB{
background-image: url("../imagens/fb.jpg");
background-repeat: no-repeat;
background-position: center 0;
width: 43px;
height: 43px;
float: left;
margin-right: 1px;
}
.icoFB:hover{background-position: center 43px;}
Ok, with this, the Facebook icon will change the position of the image with the Hover effect. Until then quiet, I just make this same process for each of them, icoTT, icoIns...
I wonder if there is an easier way, maybe a class that stores properties that will repeat on all Divs, something like this:
.icoRodape{
background-repeat: no-repeat;
background-position: center 0;
width: 43px;
height: 43px;
float: left;
margin-right: 1px;
}
.icoRodape.icoFB{background-image: url("../imagens/fb.jpg");}
.icoRodape.icoTT{background-image: url("../imagens/tt.jpg");}
.icoRodape.icoIns{background-image: url("../imagens/inst.jpg");}
.icoRodape.icoPlu{background-image: url("../imagens/gpl.jpg");}
.icoRodape.icoPin{background-image: url("../imagens/pin.jpg");}
.icoRodape:hover{background-position: center 43px;}
Okay, that’s not correct, just to give you an example. Is there any way to minimize my work and code?
Hello. Yes, if I use both classes in HTML, it will inherit both. My doubt is more in question of structuring in the same CSS, not to have to put the properties of each class more than once, being that only one of them.
– Felipe Viero Goulart
Forget what I said, hehe. It worked 100%:D
– Felipe Viero Goulart