Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
图像旁边的HTML CSS flexbox文本_Html_Css_Flexbox - Fatal编程技术网

图像旁边的HTML CSS flexbox文本

图像旁边的HTML CSS flexbox文本,html,css,flexbox,Html,Css,Flexbox,我第一次尝试使用flexbox将文本放在图像旁边。我在.flex container中有4个div:1.image 2.title 3.button 4.text。问题是只有4个文本。 不知何故,它不能像你在屏幕上看到的那样完美工作,因为文本放在图像下面 html: 您的第四个DIV位于图像下方,因为它们位于一个公共容器中,flex wrap处于活动状态 要使Div#4直接位于#2和#3之下,请将这三个(即2、3和4)放入一个单独的包装器Div(在当前的flex容器内),并将其应用于displa

我第一次尝试使用flexbox将文本放在图像旁边。我在
.flex container
中有4个div:1.image 2.title 3.button 4.text。问题是只有4个文本。 不知何故,它不能像你在屏幕上看到的那样完美工作,因为文本放在图像下面

html:


您的第四个DIV位于图像下方,因为它们位于一个公共容器中,
flex wrap
处于活动状态


要使Div#4直接位于#2和#3之下,请将这三个(即2、3和4)放入一个单独的包装器
Div
(在当前的flex容器内),并将其应用于
display:flex
flex wrap:wrap
,然后从当前
.flex容器的设置中删除
flex wrap:wrap
,如果你想学习flexbox,那么它是一个很好的入门网站。
<div class="details-section">
  <div class="container-fluid">
    <div class="flex-container">
      <div>
        <img src="{{ product.image }}"
             class="details-img">
      </div>
      <div class="details-title"> {{ product.name }} </div>
      <div class="details-price-button">{{ product.price }} PLN
        <button (click)="addToCart()"
                class="btn btn-secondary btn-sm">Add to cart
        </button>
      </div>
      <div class="details-description">{{ product.details }}</div>
    </div>
  </div>
</div>
.flex-container{
  padding-top: 40px;
  display: flex;
  flex-wrap: wrap;
}

.details-section {
  margin-top: 60px
}

.details-title {
  padding-left: 400px;
  font-size: 25px;
  font-weight: 600;
  text-align: center;
  height: 100px;
}

.details-price-button{
  margin-left: 150px;
  margin-top: 5px;
  float: right;
  font-weight: 500;
  height: 100px;
}

.details-img {
  border-radius: 8px;

}

.details-description {
    margin-left: 450px;
    margin-bottom: 200px;
    padding-bottom: 200px;
    height: 200px;
}