【问题标题】:img align right not working htmlimg 右对齐不工作 html
【发布时间】:2017-11-18 00:08:06
【问题描述】:

我有一个基本的对齐代码,我想留在页面的右上角:

<a href= "main.html">
<img align="right"  
      position: relative; SRC="../img/vasi.jpg" width="100" height="100" ></a>    

它一直运行良好,但在这里它也与其他代码一起移动:

<html>
<head>
<style> 
.newspaper {
-webkit-columns: 100px 4; /* Chrome, Safari, Opera */
-moz-columns:100px 4; /* Firefox */
columns: 100px 4;
margin-left: 100px;
margin-top: 100px;
}

</style>
<STYLE>
</STYLE>
</head>
<body>
<a href= "main.html">
<img align="right"  
      position: relative; SRC="../img/vasi.jpg" width="100" height="100" ></a>
<div class="newspaper">    

希望有人理解并感谢!

【问题讨论】:

  • 您可以为前端代码添加snippet

标签: html image alignment


【解决方案1】:

兄弟只需将您的&lt;img&gt; 放在&lt;div&gt; 中,并为其指定如下样式:

<div style="float:right;">
<img....................... >
</div>

就是这样!!

【讨论】:

    【解决方案2】:

    您应该开始阅读有关 html 元素及其属性的更多信息。在获得有关它的一般信息后,使用 css 进行样式设置。 您所要求的可以在下面找到。我建议使用引导框架来创建带有冒号的布局,而不是您要使用的代码。

    .newspaper {
    -webkit-columns: 100px 4; /* Chrome, Safari, Opera */
    -moz-columns:100px 4; /* Firefox */
    columns: 100px 4;
    margin-left: 100px;
    margin-top: 100px;
    }
    <a href= "main.html">
    <img align="right" style="position:absolute;top:0;right:0;"src="../img/vasi.jpg" width="100" height="100" ></a>
    
    <div class="newspaper">
    <p>
    paragraph1
    </p>
    <p>
    another paragraph2</p>
    </div>

    【讨论】:

    • 感谢您的回答 :) 我是自学的,所以有时我真的很困惑!并感谢有关列的提示;)
    • @GMM 我可以理解,我也是自学的,但是有了经验,事情变得更容易了。祝你好运:D
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-15
    • 1970-01-01
    • 2015-04-04
    • 2011-06-09
    • 2016-04-30
    相关资源
    最近更新 更多