简体   繁体   English

将浮动图像与另一个对齐

[英]Align float image over another

I am working with the following html code: 我正在使用以下html代码:

    <div style="background-image: url('Images/banner-transparente.jpg');overflow:hidden;">
    <img src="../Images/A3_2.png" class="icones thumbnail img-circle" alt="A3" style="height:5%; width:5%;float:right;">
    <a href="#" style="float: right;" id="autenticacao">Autenticação: Kerberos </a>
    <img src="../Images/logo-trt-home.png" class="img-responsive">
</div>

JSFiddle JSFiddle

The problem is that the generated code image is as shown below: 问题在于生成的代码映像如下所示: 有问题的图片

However, I would get the result shown in this figure, with the ability to move a bit the image over the background image and center the text underneath or on top of my floating image, as in the example below: 但是,我将得到如图所示的结果,并且能够将图像在背景图像上移动一点并将文本居中于浮动图像的下方或上方,如下例所示:

我想要的图像

Add clear:both to the <a> style, you may also margin-right and margin-top the image to shift it a little: 添加clear:both <a>样式,您也可以在图像的右边距和顶部上方移动一些:

 <img src="http://s15.postimg.org/ra8y0o7az/A3_2.png" class="icones thumbnail img-circle" alt="A3" style="height:5%; width:5%;float:right; margin:20px 50px 0 0;">
 <a href="#" style="float: right;clear:both;" id="autenticacao">Autenticação: Kerberos </a>

JSFiddle JSFiddle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM