You can solve this with a gambit:
#tudo{
font-size: 0;<<-------- esta
text-align: center;
margin: 0 auto;
}
#tudo {
font-size:0;
text-align: center;
margin: 0 auto;
}
.desktop {
display: block;
}
.img {
display: inline-block;
}
<div id="tudo">
<div class="desktop">
<div class="img">
<a href="https://www.google.com">
<img src="http://placehold.it/100x100" height="100%">
</a>
</div>
<div class="img">
<a href="https://www.google.com">
<img src="http://placehold.it/100x100" height="100%">
</a>
</div>
</div>
</div>
When we ident the code we leave some blank spaces, the property inline-block
will place this space between the elements.
For example, if I take your code without any change and put it inline
in indentation it will also work, see :
#tudo {
text-align: center;
margin: 0 auto;
}
.desktop {
display: block;
}
.img {
display: inline-block;
}
<div id="tudo"><div class="desktop"><div class="img"><a href="https://www.google.com"><img src="http://placehold.it/100x100" height="100%"></a></div><div class="img"><a href="https://www.google.com"><img src="http://placehold.it/100x100" height="100%"></a></div></div></div>
Then if there is space the browser inputa the element a standard font size, as it has no character other than the space character, it is this default size, and assigning 0
the font it gets the size 0
..Dhããrrrrrr
There are other ways to solve this. See some
Thanks man, it worked perfectly! Just a question, why did it solve my problem? hahaha
– Juan Lima
I edited it, see if I’m... VLW @Juanlima
– MagicHat
It was great, I understood. Another question: depending on how I render the window, the images are very small and cool. Do you know any way to keep them the same size and glued together? Thanks in advance
– Juan Lima
Maybe setting the size on
height e width
...– MagicHat