【问题标题】:How can I do the same thing on the other side of the page我怎样才能在页面的另一边做同样的事情
【发布时间】:2021-06-16 17:05:50
【问题描述】:

我的代码在这里我想在另一边加上另一个引号(例如在左边)请尽快帮助我

<div style="display: table;background-color:#d4af37; padding:20px;
    color:white; width: 200px; height:170px;x;  border-radius:50px">
        <p style="display: table-cell; vertical-align: middle;">
            <b>“I intend to leave after my death a large fund for the 
            promotion of the peace idea, but I am skeptical as to its 
            results.”</b>- <em>Alfred Nobel </em>

P.S 我在评论中发布了代码我不确定这个网站什么时候编译代码,什么时候不抱歉,我是新人

【问题讨论】:

  • “我打算在我死后留下一大笔资金用于促进和平理念,但我对它的结果持怀疑态度。” - 阿尔弗雷德·诺贝尔
  • 您可以使用不需要的代码删除您的评论;您只需格式化问题中的代码 - 缩进 4 个空格。
  • 您的 html 不完整。您可以尝试使用左右浮动。

标签: html text html-table


【解决方案1】:

为了按照您的要求执行您在页面另一侧已经完成的相同操作,您首先需要使用相应的结束标记 &lt;/p&gt; 关闭您的 &lt;p&gt; 标记,并且相同使用您的&lt;div&gt; 标签,添加一个结束&lt;/div&gt;。删除x; 的拼写错误,然后将另一个样式属性和float:left; 的值设置为&lt;div&gt; 元素。

完成后,您可以复制整个 div 代码,粘贴到其下方并将float:left; 更改为float:right;

我已经包含了一个完整的 sn-p 供您尝试,它可以完成上述所有操作。 (它将替换您在问题中包含的代码)

编码愉快:)

<div style="float:left; display:table; background-color:#d4af37; padding:20px; color:white; width:200px; height:170px; border-radius:50px">
  <p style="display:table-cell; vertical-align:middle;"><b>“I intend to leave after my death a large fund for the promotion of the peace idea, but I am skeptical as to its results.”</b>- <em>Alfred Nobel </em></p>
</div>
<div style="float:right; display:table; background-color:#d4af37; padding:20px; color:white; width:200px; height:170px; border-radius:50px">
  <p style="display:table-cell; vertical-align:middle;"><b>“I intend to leave after my death a large fund for the promotion of the peace idea, but I am skeptical as to its results.”</b>- <em>Alfred Nobel </em></p>
</div>

【讨论】:

    【解决方案2】:

    使用flexbox 将项目彼此相邻放置。如果您有引号,请使用 q element 短内联引号或 blockquote element 长引号:

    .quotes {
      display: flex;
      gap: 10px;
    }
    
    .quote {
      flex-basis: 50%;
      background-color: #d4af37;
      border-radius: 5px;
    }
    
    q {
      font-weight: bold;
    }
    <div class="quotes">
      <div class="quote">
        <q>I intend to leave after my death a large fund for the promotion of the peace idea, but I am skeptical as to its results.</q> - <em>Alfred Nobel </em>
      </div>
      <div class="quote">
        <q>Don't believe everything you read on the internet.</q> - <em>Abraham Lincolm</em>
      </div>
    </div>

    【讨论】:

      猜你喜欢
      相关资源
      最近更新 更多
      热门标签