центрируйте изображение и оберните текст вокруг него на ширину носителя 768 пикселей - PullRequest
0 голосов
/ 03 мая 2019

, когда ширина окна опускается ниже 768 пикселей, я хочу, чтобы горизонтальное изображение альбома и текстовое содержимое трансформировались так, чтобы изображение появлялось ниже текста альбома, но выше следующего текста lorem ipsum.Я пробую код CSS ниже, но он не работает.в настоящее время, когда окно опускается ниже 678 пикселей, изображение все еще находится справа.

https://jsfiddle.net/x1hkzrvw/3/

@media screen{
    .image{
          width:20%;
          float: right;
          border-radius:50%;
          

      }
      }
      @media(max-width:768px) {
        .image{
          display: flex;
            flex-wrap: wrap;
           
        }
      }

1 Ответ

1 голос
/ 03 мая 2019

добавлено ниже css

p {
    display: flex;
    flex-wrap: wrap;
  }
  p img {
    order: 2
  }
  .image {
    width: 50%;
    height: 100px;
  }

@media screen {
  .image {
    width: 20%;
    float: right;
    border-radius: 50%;
    display: flex;
  }
}

@media(max-width:768px) {
  p {
    display: flex;
    flex-wrap: wrap;
  }
  p img {
    order: 2
  }
  .image {
    width: 50%;
    height: 100px;
  }
}
<div>
  <p>
    <img src="https://sample-videos.com/img/Sample-jpg-image-500kb.jpg" alt="Italian Trulli" class="image"> 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, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the
    1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 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, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic
    typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software. It is a long established fact that a reader will
    be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable
    English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes
    by accident, sometimes on purpose (injected humour and the like). It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less
    normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem
    ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
  </p>
</div>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...