具有属性位置(相对、绝对)或浮动的 Shape-outside

Shape-outside with the attribute position (relative,absolute) or float

我正在尝试构建一个 div 的圆形(边框半径:50%)并围绕这个元素切割 space 这样文本就会变成我的形状div(形状外:圆(50%)。

到目前为止,问题是我无法使用位置属性来设置样式,因为:

  1. 如果我在我的形状上使用 position:absolute,div 将从其他元素(包括我的段落)的流程中取出,因此文本不会如果我将它放在元素附近,请不要移动。

  2. 如果我将属性 position:relative 与 float:left 一起使用,我的 div 的位置将保持在那里,所以形状外:圆(50%)会起作用,我的 div 不会移动,但在这种情况下,形状外部的属性将应用于真实的 space(div 的宽度和高度将取整个 space 加上元素的位置。

这是我的例子,属性位置:相对:

<div class="box">
    <div class="half">
        <div class="rounded">
            <img src="myimage" alt="logo new path">
        </div>
        <div class="shapeout"></div>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>
    </div>
    <div class="half">
        <h1>Holiday Clinic Hours</h1>
        <p>All walk-in clinic locations will be closed for the following holidays in December & January.</p> 
        <p>We are closed:</p>
        <ul>
            <li>Friday, December 22nd</li>
            <li>Monday, December 25th</li>
            <li>Tuesday, December 26th</li>
            <li>Friday, December 29th</li>
        </ul>

        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
    </div>
</div>

和 css:

.box {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-flex: 0;
    -ms-flex: 0 1 auto;
    flex: 0 1 auto;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}
.half {
    padding: 40px;
    color: white;
}
.half:nth-of-type(1) {
    background: #333333;
    -ms-flex-preferred-size: 25%;
    flex-basis: 25%;
    max-width: 25%;
}
.half ul {
    padding: 0;
}
.half li {
    font-weight: bold;
    list-style-type: none;
}
.half:nth-of-type(2) {
    background: #0154A6;
    -ms-flex-preferred-size: 75%;
    flex-basis: 75%;
    max-width: 75%;
}
.half h1 {
    color: white;
}
.rounded {
    width: 100px;
    height: 100px;
    background: white;
    padding: 33px;
    border-radius: 50%;
    position: relative;
    top: -1%;
    left: -11%;
    float: left;
    shape-outside: circle(50%);
}
.rounded img {
    width: 80px;
}

有没有人遇到过我同样的问题?

明确一点,我正在尝试获得类似的东西:

我删除(评论)了 css 中的 "display: flex;" 属性,我能够复制您在屏幕截图中向我们展示的布局。

这对您的场景有帮助吗?

.box {
  display: -webkit-box;
  display: -ms-flexbox;
/*  display: flex; */
  -webkit-box-flex: 0;
  -ms-flex: 0 1 auto;
  flex: 0 1 auto;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -ms-flex-direction: row;
  flex-direction: row;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}

.half {
  padding: 40px;
  color: white;
}

.half:nth-of-type(1) {
  background: #333333;
  -ms-flex-preferred-size: 25%;
  flex-basis: 25%;
  max-width: 25%;
}

.half ul {
  padding: 0;
}

.half li {
  font-weight: bold;
  list-style-type: none;
}

.half:nth-of-type(2) {
  background: #0154A6;
  -ms-flex-preferred-size: 75%;
  flex-basis: 75%;
  max-width: 75%;
}

.half h1 {
  color: white;
}

.rounded {
  width: 100px;
  height: 100px;
  background: white;
  padding: 33px;
  border-radius: 50%;
  position: relative;
  top: -1%;
  left: -11%;
  float: left;
  shape-outside: circle(50%);
}

.rounded img {
  width: 80px;
}
<div class="box">
  <div class="half">
    <div class="rounded">
      <img src="myimage" alt="logo new path">
    </div>
    <div class="shapeout"></div>
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>
  </div>
  <div class="half">
    <h1>Holiday Clinic Hours</h1>
    <p>All walk-in clinic locations will be closed for the following holidays in December & January.</p>
    <p>We are closed:</p>
    <ul>
      <li>Friday, December 22nd</li>
      <li>Monday, December 25th</li>
      <li>Tuesday, December 26th</li>
      <li>Friday, December 29th</li>
    </ul>

    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
  </div>
</div>