[英]Image float to the right and not have text or other elements wrap on the left
I want the logo below to align with the right of the page. 我希望下面的徽标与页面右侧对齐。 I've tried adding
float:right
, but that causes the horizontal line to wrap around on the left. 我尝试添加
float:right
,但这会导致水平线在左侧环绕。 I don't want anything else occupying the vertical space. 我不希望其他任何东西占据垂直空间。
Here is my HTML 这是我的HTML
<header >
<div>
<img style="margin-right:40px; padding-bottom:20px" src="./AddFiles/bamboo_logo.png" height="50">
<br>
<hr>
</div>
</header>
You can try adding text align to the containing div
: ( Working jsFiddle ) 您可以尝试将文本对齐方式添加到所包含的
div
:( 工作jsFiddle )
<header>
<div style="text-align:right;"> <!-- add this css, images are by default inline -->
<img style="margin-right:40px; padding-bottom:20px" src="./AddFiles/bamboo_logo.png" height="50">
<br>
<hr>
</div>
</header>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.