Html 将徽标和标题并排放置

Html 将徽标和标题并排放置,html,css,Html,Css,我试着将徽标和标题并排对齐,这样段落就可以放在下面了。我试过浮球,但它不起作用。我怎么能轻松做到?(css noobs) 帕耶芒 我们接受所有主要的信用卡和借记卡,包括万事达卡、Visa卡、美国运通卡和Discover卡。 我们接受贝宝作为一种付款方式 装运 2-3个工作日内免费大陆运输。 加拿大运费4.99美元。在2-3个工作日内发货 退货政策 如果您对您的百吉饼不完全满意,请退货。没有问题。我们将退还您的全部购买价格 您应该使用:文本对齐:左而不是浮动:左将图像向左浮动: img {

我试着将徽标和标题并排对齐,这样段落就可以放在下面了。我试过浮球,但它不起作用。我怎么能轻松做到?(css noobs)


帕耶芒
我们接受所有主要的信用卡和借记卡,包括万事达卡、Visa卡、美国运通卡和Discover卡。
我们接受贝宝作为一种付款方式

装运 2-3个工作日内免费大陆运输。 加拿大运费4.99美元。在2-3个工作日内发货

退货政策 如果您对您的百吉饼不完全满意,请退货。没有问题。我们将退还您的全部购买价格


您应该使用:
文本对齐:左而不是
浮动:左

将图像向左浮动:

img {
  float: left;
}
img{
浮动:左;
}

帕耶芒
我们接受所有主要的信用卡和借记卡,包括万事达卡、Visa卡、美国运通卡和Discover卡。我们接受贝宝作为一种付款方式

装运 2-3个工作日内免费大陆运输。加拿大运费4.99美元。在2-3个工作日内发货

退货政策 如果您对您的百吉饼不完全满意,请退货。没有问题。我们将退还您的全部购买价格

您可以使用以下代码。
帕耶芒

帕耶芒
我们接受所有主要的信用卡和借记卡,包括万事达卡、Visa卡、美国运通卡和Discover卡。
我们接受贝宝作为一种付款方式


只需将img和h2包装在一个div中,并将样式设置为display:flex,您所需要的是这样的:

img, h2 {
    display: inline-block;
}
显然,您可以更详细,比如
类h2,等等
,或者您可以像现在这样进行内联操作。。。虽然是多余的(随便你怎么做)…但这应该可以做到


如果您想使用更现代的css3,也可以在父div上执行
flex
,您可以使用flexbox获得所需的结果。我认为这是最简单的解决办法,也是看起来最好的办法

<div class="left-column" style="float:left; background-color:#FF0; margin-left:10px; margin-top:20px;" width = "515">
  <div class= "Payement" style=" background-color:#D5D5D5">
    <div class = "flex-wrapper">
      <img src="images/Forma1copy.png" class="logo"/>
      <h2>Payement</h2>
      <p> We accept all major credit and debit cards including Mastercard,Visa, American Express, and Discover. 
        We accept Paypal as a method of payment. </p>     
    </div>
  </div>
  <div class= "shipement" style=" background-color:#D5D5D5">
    <div class = "flex-wrapper">
      <img src="images/Forma1_0.png"  class="logo" />
      <h2>Shipement</h2>
      <p>Free continental shipping within 2-3 business days. 
        Canadian shipping for $4.99. Shipped within 2-3 business days.</p>
    </div>
  </div>
  <div class ="return_policy" style=" background-color:#D5D5D5">
    <div class = "flex-wrapper">
      <img src="images/Forma1.png" class="logo" />
      <h2>Return Policy</h2>
      <p> If you are not completely satisfied with your bagels, return it. No questions asked. We will refund your full purchase price.</p>
    </div>
  </div>
</div>

我复制并粘贴了您的代码,所有内容都向左对齐。是否有其他css或文件在更改它?也不需要浮动只需
文本对齐:left
虽然这是默认设置,但我认为您可能会有另一个css将其居中徽标和标题并排放置,这样段落将位于下方。我看我将发送代码段落如何?我将不得不创建另一个div,这样我就可以在下面了?只需在给定代码下使用另一个div,或者只需使用一个p标记,就像下面的一些文本一样,你想要放置我喜欢你的答案,但我已经用第一个答案解决了它张贴。非常感谢。
<div class= "Payement" style=" background-color:#D5D5D5">
     <div style="display:flex">
     <img src="images/Forma1copy.png" class="logo_page"/>
     <h2>Payement</h2>
     </div>
     <p> We accept all major credit and debit cards including Mastercard,Visa, American Express, and Discover. 
 We accept Paypal as a method of payment. </p>
    </div>
img, h2 {
    display: inline-block;
}
<div class="left-column" style="float:left; background-color:#FF0; margin-left:10px; margin-top:20px;" width = "515">
  <div class= "Payement" style=" background-color:#D5D5D5">
    <div class = "flex-wrapper">
      <img src="images/Forma1copy.png" class="logo"/>
      <h2>Payement</h2>
      <p> We accept all major credit and debit cards including Mastercard,Visa, American Express, and Discover. 
        We accept Paypal as a method of payment. </p>     
    </div>
  </div>
  <div class= "shipement" style=" background-color:#D5D5D5">
    <div class = "flex-wrapper">
      <img src="images/Forma1_0.png"  class="logo" />
      <h2>Shipement</h2>
      <p>Free continental shipping within 2-3 business days. 
        Canadian shipping for $4.99. Shipped within 2-3 business days.</p>
    </div>
  </div>
  <div class ="return_policy" style=" background-color:#D5D5D5">
    <div class = "flex-wrapper">
      <img src="images/Forma1.png" class="logo" />
      <h2>Return Policy</h2>
      <p> If you are not completely satisfied with your bagels, return it. No questions asked. We will refund your full purchase price.</p>
    </div>
  </div>
</div>
.flex-wrapper {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.logo {

  flex-shrink: 0;
  width: 30px;
  height: 30px;
  background-color: black; /* remove this line */

}

h2 {

  margin-right: 50px;
  margin-left: 25px;
  width: 100px;
  flex-shrink: 0;

}