【问题标题】:Paragraph inline with img与 img 内联的段落
【发布时间】:2016-04-02 23:58:07
【问题描述】:

我在将段落与内联图像对齐时遇到问题。

<p id="intro">blah blah blah lots of text.</p>
<img src="macro.jpg" height="476" id="photograph" width="267" />

我在 CSS 中试过这个:

  #intro {
    font-size: 0.8em;
    color: black;
    float: left;
    }

  #photograph {
    float: right;
    }

但它仍然没有对齐它们......请帮助

【问题讨论】:

    标签: html css alignment inline


    【解决方案1】:

    您可以这样做以在调整窗口大小时使其流畅。

    See this fiddle

    #photograph {
        float: right;
        width: 267px;
    
    }
    #intro {    
      width: calc(100% - 267px);
      font-size: 0.8em;
      color: black;
      float: left;
    }
    

    【讨论】:

      【解决方案2】:

      你在找这样的东西吗???

      #intro {
          font-size: 0.8em;
          color: black;
        
          }
      
        #photograph {
         
          }
          .test{
            display:flex;
            justify-content:space-between;
            background-color:pink;
            align-items: center;
          }
      <div class="test">
      <p id="intro">blah blah blah lots of text.</p>
      <img src="macro.jpg" height="476" id="photograph" width="267" />
      </div>

      【讨论】:

        猜你喜欢
        • 2011-04-19
        • 2019-05-27
        • 2016-10-31
        • 1970-01-01
        • 2010-09-27
        • 2012-01-07
        • 2012-01-28
        • 2015-03-09
        • 1970-01-01
        相关资源
        最近更新 更多