Como posso configurar o CSS para deixar o texto alternativo sempre centralizado ao meio na tag <img/>
em navegador Google Chrome?
No firefox aplico apenas display: flex
ou inline-flex
com align-items: center
e justify-content: center
mas infelizmente não é uma solução crossbrowser.
#Img {
background-color: rgb(0,0,0);
display: inline-flex;
align-items: center;
justify-content: center;
color: rgb(255,255,255);
width: 200px;
height: 100px;
}
<img id='Img' src="" onerror="this.alt = `Can't speak Hello world!`" alt="Hello wolrd">
top: valor
com midia-query para ficar ao "centro" sempre que a resolução mudar. – ayelsew 5/09/18 às 21:10